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

Side by Side Diff: mojo/public/tools/bindings/generators/mojom_python_generator.py

Issue 855043003: Revert "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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Generates Python source files from a mojom.Module.""" 5 """Generates Python source files from a mojom.Module."""
6 6
7 import re 7 import re
8 from itertools import ifilter 8 from itertools import ifilter
9 9
10 import mojom.generate.generator as generator 10 import mojom.generate.generator as generator
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 'struct_from_method': GetStructFromMethod, 291 'struct_from_method': GetStructFromMethod,
292 } 292 }
293 293
294 @UseJinja('python_templates/module.py.tmpl', filters=python_filters) 294 @UseJinja('python_templates/module.py.tmpl', filters=python_filters)
295 def GeneratePythonModule(self): 295 def GeneratePythonModule(self):
296 return { 296 return {
297 'enums': self.module.enums, 297 'enums': self.module.enums,
298 'imports': self.GetImports(), 298 'imports': self.GetImports(),
299 'interfaces': self.GetQualifiedInterfaces(), 299 'interfaces': self.GetQualifiedInterfaces(),
300 'module': ComputeStaticValues(self.module), 300 'module': ComputeStaticValues(self.module),
301 'namespace': self.module.namespace,
302 'structs': self.GetStructs(), 301 'structs': self.GetStructs(),
303 } 302 }
304 303
305 def GenerateFiles(self, args): 304 def GenerateFiles(self, args):
306 import_path = MojomToPythonImport(self.module.name) 305 import_path = MojomToPythonImport(self.module.name)
307 self.Write(self.GeneratePythonModule(), 306 self.Write(self.GeneratePythonModule(),
308 self.MatchMojomFilePath('%s.py' % import_path)) 307 self.MatchMojomFilePath('%s.py' % import_path))
309 308
310 def GetImports(self): 309 def GetImports(self):
311 for each in self.module.imports: 310 for each in self.module.imports:
(...skipping 18 matching lines...) Expand all
330 'Unable to find interface %s declared as client of %s.' % 329 'Unable to find interface %s declared as client of %s.' %
331 (interface.client, interface.name)) 330 (interface.client, interface.name))
332 interface.qualified_client = interfaces_by_name[interface.client] 331 interface.qualified_client = interfaces_by_name[interface.client]
333 return sorted(interfaces, key=lambda i: (bool(i.client), i.name)) 332 return sorted(interfaces, key=lambda i: (bool(i.client), i.name))
334 333
335 def GetJinjaParameters(self): 334 def GetJinjaParameters(self):
336 return { 335 return {
337 'lstrip_blocks': True, 336 'lstrip_blocks': True,
338 'trim_blocks': True, 337 'trim_blocks': True,
339 } 338 }
OLDNEW
« no previous file with comments | « mojo/public/python/src/common.cc ('k') | mojo/public/tools/bindings/generators/python_templates/module.py.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698