Skip to content

Commit 695618c

Browse files
Luke Sneeringersoftware-dov
authored andcommitted
[fix] Alphabetically sort lines in a few more spots. (#155)
1 parent 56e6516 commit 695618c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gapic/templates/$namespace/$name_$version/$sub/__init__.py.j2

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,32 @@ from . import {{ subpackage }}
77
{% endfor -%}
88

99
{# Import services for this package. -#}
10+
{% filter sort_lines -%}
1011
{% for service in api.services.values()|sort(attribute='name')
1112
if service.meta.address.subpackage == api.subpackage_view -%}
1213
from .services.{{ service.name|snake_case }} import {{ service.name }}
1314
{% endfor -%}
15+
{% endfilter -%}
1416

1517
{# Import messages from each proto.
1618
It is safe to import all of the messages into the same namespace here,
1719
because protocol buffers itself enforces selector uniqueness within
1820
a proto package.
1921
-#}
22+
{% filter sort_lines -%}
2023
{% for proto in api.protos.values()|sort(attribute='module_name')
2124
if proto.meta.address.subpackage == api.subpackage_view -%}
2225
{% for message in proto.messages.values()|sort(attribute='name') -%}
2326
from .types.{{ proto.module_name }} import {{ message.name }}
24-
{% endfor %}{% endfor %}
27+
{% endfor %}{% endfor -%}
28+
{% endfilter %}
2529

2630
{# Define __all__.
2731
This requires the full set of imported names, so we iterate over
2832
them again.
2933
-#}
3034
__all__ = (
35+
{%- filter sort_lines %}
3136
{%- for subpackage in api.subpackages.keys() %}
3237
'{{ subpackage }}',
3338
{%- endfor %}
@@ -40,5 +45,6 @@ __all__ = (
4045
{%- for message in proto.messages.values()|sort(attribute='name') %}
4146
'{{ message.name }}',
4247
{%- endfor %}{% endfor %}
48+
{%- endfilter %}
4349
)
4450
{% endblock %}

gapic/templates/$namespace/$name_$version/$sub/types/$proto.py.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
import proto{% if p != 'proto' %} as {{ p }}{% endif %} # type: ignore
77
{% endif %}
88

9+
{% filter sort_lines -%}
910
{% for import_ in proto.python_modules -%}
1011
{{ import_ }}
11-
{% endfor %}
12+
{% endfor -%}
13+
{% endfilter %}
14+
1215

1316
__protobuf__ = {{ p }}.module(
1417
package='{{ '.'.join(proto.meta.address.package) }}',

0 commit comments

Comments
 (0)