Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: tools/json_schema_compiler/json_schema.py

Issue 11079010: Extensions Docs Server: Preserve JSON declaration order in extensions documentation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more efficient ordered_dict Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/json_schema_compiler/json_schema.py
diff --git a/tools/json_schema_compiler/json_schema.py b/tools/json_schema_compiler/json_schema.py
index b3eca78194d66697572f3d312057a9347388b5af..9fe1ffc886c89bbea09bd233722d3082d2d1a933 100644
--- a/tools/json_schema_compiler/json_schema.py
+++ b/tools/json_schema_compiler/json_schema.py
@@ -3,20 +3,18 @@
# found in the LICENSE file.
import copy
-import json
-import os.path
+import os
import sys
-_script_path = os.path.realpath(__file__)
-sys.path.insert(0, os.path.normpath(_script_path + "/../../"))
-import json_comment_eater
+from json_parse import OrderedDict, Parse
import schema_util
def DeleteNocompileNodes(item):
def HasNocompile(thing):
- return type(thing) == dict and thing.get('nocompile', False)
+ return (isinstance(thing, (dict, OrderedDict)) and
+ thing.get('nocompile', False))
- if type(item) == dict:
+ if isinstance(item, (dict, OrderedDict)):
toDelete = []
for key, value in item.items():
if HasNocompile(value):
@@ -33,7 +31,7 @@ def DeleteNocompileNodes(item):
def Load(filename):
with open(filename, 'r') as handle:
- schemas = json.loads(json_comment_eater.Nom(handle.read()))
+ schemas = Parse(handle.read())
schema_util.PrefixSchemasWithNamespace(schemas)
return schemas

Powered by Google App Engine
This is Rietveld 408576698