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

Side by Side Diff: mojo/public/tools/bindings/generators/python_templates/module.py.tmpl

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
(Empty)
1 {% from "module_macros.tmpl" import enum_values %}
2 {% from "module_macros.tmpl" import struct_descriptor %}
3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 import mojo_bindings.descriptor as _descriptor
8 import mojo_bindings.reflection as _reflection
9 {% if imports %}
10
11 {% for import in imports %}
12 import {{import.python_module}}
13 {% endfor %}
14 {% endif %}
15 {#--- Constants #}
16 {% if module.constants %}
17
18 {% for constant in module.constants %}
19 {{constant|name}} = {{constant.value|expression_to_text}}
20 {% endfor %}
21 {% endif %}
22 {% for enum in enums %}
23
24 class {{enum|name}}(object):
25 __metaclass__ = _reflection.MojoEnumType
26 VALUES = {{enum_values(enum)|indent(2)}}
27 {% endfor %}
28 {% for struct in structs %}
29
30 class {{struct|name}}(object):
31 __metaclass__ = _reflection.MojoStructType
32 DESCRIPTOR = {{struct_descriptor(struct)|indent(2)}}
33 {% endfor %}
34 {% for interface in interfaces %}
35
36 class {{interface|name}}(object):
37 __metaclass__ = _reflection.MojoInterfaceType
38 DESCRIPTOR = {
39 {% if interface.client %}
40 'client': lambda: {{interface.qualified_client|fully_qualified_name}},
41 {% endif %}
42 'methods': [
43 {% for method in interface.methods %}
44 {
45 'name': '{{method|name}}',
46 'ordinal': {{method.ordinal}},
47 {% set request_struct = method|struct_from_method %}
48 'parameters': {{struct_descriptor(request_struct)|indent(8)}},
49 {% if method.response_parameters != None %}
50 {% set response_struct = method|response_struct_from_method %}
51 'responses': {{struct_descriptor(response_struct)|indent(8)}},
52 {% endif %}
53 },
54 {% endfor %}
55 ],
56 }
57 {% endfor %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698