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

Unified Diff: mojo/public/tools/bindings/generators/mojom_python_generator.py

Issue 796373006: Content handler for python. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
Index: mojo/public/tools/bindings/generators/mojom_python_generator.py
diff --git a/mojo/public/tools/bindings/generators/mojom_python_generator.py b/mojo/public/tools/bindings/generators/mojom_python_generator.py
index 33bfdd5743b480029ef3ef778a607d1c825716b6..0bac90de0aa0e17316e87ff58afce3a9522b604a 100644
--- a/mojo/public/tools/bindings/generators/mojom_python_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_python_generator.py
@@ -311,6 +311,14 @@ class Generator(generator.Generator):
each['python_module'] = MojomToPythonImport(each['module_name'])
return self.module.imports
+ def GetNormalizedName(self, kind):
+ """Returns a normalized name (C++-style fully qualified name) of the
+ provided object."""
+ normalized = kind.name
+ if self.module.namespace:
+ normalized = '::'.join(self.module.namespace.split('.') + [kind.name])
+ return normalized
+
def GetQualifiedInterfaces(self):
"""
Returns the list of interfaces of the module. Each interface that has a
@@ -324,6 +332,7 @@ class Generator(generator.Generator):
each['module'].interfaces];
interfaces_by_name = dict((x.name, x) for x in all_interfaces)
for interface in interfaces:
+ interface.normalized_name = self.GetNormalizedName(interface)
qsr 2015/01/14 18:08:41 Try to not modify the object if not needed. Either
etiennej 2015/01/15 00:03:07 Done.
if interface.client:
assert interface.client in interfaces_by_name, (
'Unable to find interface %s declared as client of %s.' %

Powered by Google App Engine
This is Rietveld 408576698