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

Side by Side Diff: tools/json_schema_compiler/json_parse.py

Issue 23549025: Clean up JSON Schema Compiler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed enum test and added blank lines. Created 7 years, 3 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 import json
6 import logging
7 import os 6 import os
8 import sys 7 import sys
9 8
10 _FILE_PATH = os.path.dirname(os.path.realpath(__file__)) 9 _FILE_PATH = os.path.dirname(os.path.realpath(__file__))
11 _SYS_PATH = sys.path[:] 10 _SYS_PATH = sys.path[:]
12 try: 11 try:
13 _COMMENT_EATER_PATH = os.path.join( 12 _COMMENT_EATER_PATH = os.path.join(
14 _FILE_PATH, os.pardir, 'json_comment_eater') 13 _FILE_PATH, os.pardir, 'json_comment_eater')
15 sys.path.insert(0, _COMMENT_EATER_PATH) 14 sys.path.insert(0, _COMMENT_EATER_PATH)
16 import json_comment_eater 15 import json_comment_eater
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 'json_schema_compiler')) 49 'json_schema_compiler'))
51 import simplejson 50 import simplejson
52 from simplejson import OrderedDict 51 from simplejson import OrderedDict
53 finally: 52 finally:
54 sys.path = _SYS_PATH 53 sys.path = _SYS_PATH
55 54
56 def Parse(json_str): 55 def Parse(json_str):
57 return simplejson.loads(json_comment_eater.Nom(json_str), 56 return simplejson.loads(json_comment_eater.Nom(json_str),
58 object_pairs_hook=OrderedDict) 57 object_pairs_hook=OrderedDict)
59 58
59
60 def IsDict(item): 60 def IsDict(item):
61 return isinstance(item, (dict, OrderedDict)) 61 return isinstance(item, (dict, OrderedDict))
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/idl_schema_test.py ('k') | tools/json_schema_compiler/json_schema.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698