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

Unified Diff: tools/json_schema_compiler/schema_util.py

Issue 11953121: Fix up how the JSON Schema compiler decides whether to include or forward (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert changes to webview so that this can land Created 7 years, 11 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
« no previous file with comments | « tools/json_schema_compiler/h_generator.py ('k') | tools/json_schema_compiler/schema_util_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/schema_util.py
diff --git a/tools/json_schema_compiler/schema_util.py b/tools/json_schema_compiler/schema_util.py
index e71be8ba33a9d3cea09f051087f172fced585527..7ce399e8ed31e0a0a75a76d82176a39a9a00e6a1 100644
--- a/tools/json_schema_compiler/schema_util.py
+++ b/tools/json_schema_compiler/schema_util.py
@@ -9,15 +9,19 @@ import json_parse
def CapitalizeFirstLetter(value):
return value[0].capitalize() + value[1:]
-def GetNamespace(ref_type):
- if '.' in ref_type:
- return ref_type[:ref_type.rindex('.')]
+def GetNamespace(ref):
+ return SplitNamespace(ref)[0]
-def StripSchemaNamespace(s):
- last_dot = s.rfind('.')
- if not last_dot == -1:
- return s[last_dot + 1:]
- return s
+def StripNamespace(ref):
+ return SplitNamespace(ref)[1]
+
+def SplitNamespace(ref):
+ """Returns (namespace, entity) from |ref|, e.g. app.window.AppWindow ->
+ (app.window, AppWindow). If |ref| isn't qualified then returns (None, ref).
+ """
+ if '.' in ref:
+ return tuple(ref.rsplit('.', 1))
+ return (None, ref)
def JsFunctionNameToClassName(namespace_name, function_name):
"""Transform a fully qualified function name like foo.bar.baz into FooBarBaz
« no previous file with comments | « tools/json_schema_compiler/h_generator.py ('k') | tools/json_schema_compiler/schema_util_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698