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

Unified Diff: tools/json_schema_compiler/model.py

Issue 22228002: Add optional schema compiler error messages (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code clean up, fixed tests, improved errors. Created 7 years, 4 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/model.py
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py
index d0e816d4b54614aacb55cd817a3ff692854ef53f..50a9c581403ec992d64fe5c25c69c3aa5ea93057 100644
--- a/tools/json_schema_compiler/model.py
+++ b/tools/json_schema_compiler/model.py
@@ -50,7 +50,7 @@ class Namespace(object):
- |functions| a map of function names to their model.Function
- |events| a map of event names to their model.Function
- |properties| a map of property names to their model.Property
- - |compiler_options| the compiler_options dict, only present if
+ - |compiler_options| the compiler_options dict, only not empty if
|include_compiler_options| is True
"""
def __init__(self, json, source_file, include_compiler_options=False):
@@ -71,8 +71,8 @@ class Namespace(object):
self.functions = _GetFunctions(self, json, self)
self.events = _GetEvents(self, json, self)
self.properties = _GetProperties(self, json, self, toplevel_origin)
- if include_compiler_options:
- self.compiler_options = json.get('compiler_options', {})
+ self.compiler_options = (json.get('compiler_options', {})
+ if include_compiler_options else {})
class Origin(object):
"""Stores the possible origin of model object as a pair of bools. These are:

Powered by Google App Engine
This is Rietveld 408576698