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

Unified Diff: tools/json_schema_compiler/schema_util.py

Issue 10659021: Move chrome.appWindow to chrome.app.window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 8 years, 5 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/schema_util.py
diff --git a/tools/json_schema_compiler/schema_util.py b/tools/json_schema_compiler/schema_util.py
index 177e77f9b1ba5ec847f559df1546daa10a17465f..046e2bdb3367fd31bc7622bee42095ace773386f 100644
--- a/tools/json_schema_compiler/schema_util.py
+++ b/tools/json_schema_compiler/schema_util.py
@@ -4,6 +4,9 @@
"""Utilies for the processing of schema python structures.
"""
+def CapitalizeFirstLetter(value):
+ return value[0].capitalize() + value[1:]
+
def GetNamespace(ref_type):
if '.' in ref_type:
return ref_type[:ref_type.rindex('.')]
@@ -39,3 +42,16 @@ def _PrefixWithNamespace(namespace, schema):
elif type(schema) == list:
for s in schema:
_PrefixWithNamespace(namespace, s)
+
+def JsFunctionNameToClassName(namespace_name, function_name):
+ """Transform a fully qualified function name like foo.bar.baz into FooBarBaz
+
+ Also strips any leading 'Experimental' prefix."""
+ parts = []
+ full_name = namespace_name + "." + function_name
+ for part in full_name.split("."):
+ parts.append(CapitalizeFirstLetter(part))
+ if parts[0] == "Experimental":
+ del parts[0]
+ class_name = "".join(parts)
+ return class_name
« no previous file with comments | « tools/json_schema_compiler/schema_bundle_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