Sort Exposes Alphabetically By Type

This makes it much easier to find components of
a specific type because they will be grouped together.

Tested: Sensor list was still the same

Change-Id: Iab15be34e003be1aac120864c18a80eaaa9b391c
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/scripts/autojson.py b/scripts/autojson.py
index e4f2818..582631d 100755
--- a/scripts/autojson.py
+++ b/scripts/autojson.py
@@ -6,9 +6,15 @@
 from sys import argv
 
 for file in argv[1:]:
-   print("formatting file {}".format(file))
-   with open(file) as f:
-      j = json.load(f)
+    print("formatting file {}".format(file))
+    with open(file) as f:
+        j = json.load(f)
 
-   with open(file, 'w') as f:
-      f.write(json.dumps(j, indent=4, sort_keys=True, separators=(',', ': ')))
+    if isinstance(j, list):
+        for item in j:
+            item["Exposes"] = sorted(item["Exposes"], key=lambda k: k["Type"])
+    else:
+        j["Exposes"] = sorted(j["Exposes"], key=lambda k: k["Type"])
+
+    with open(file, 'w') as f:
+        f.write(json.dumps(j, indent=4, sort_keys=True, separators=(',', ': ')))