Skip to content

Commit bfe3b14

Browse files
committed
chore: remove code formatting for google dir
1 parent a58092d commit bfe3b14

File tree

194 files changed

+26064
-20505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+26064
-20505
lines changed

gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ def test_{{ method_name }}_field_headers():
785785
assert (
786786
'x-goog-request-params',
787787
'{% for field_header in method.field_headers -%}
788-
{{ field_header.raw }}={{ method.input.get_field(field_header.disambiguated).mock_value|trim("'") }}
788+
{{ field_header.raw }}={{ method.input.get_field(field_header.disambiguated).mock_value|trim('"') }}
789789
{%- if not loop.last %}&{% endif %}
790790
{%- endfor -%}',
791791
) in kw['metadata']

gapic/schema/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def rel(self, address: "Address") -> str:
313313
# created, so there is no way for one nested class to reference
314314
# another at class instantiation time.
315315
if self.parent and address.parent and self.parent[0] == address.parent[0]:
316-
return f"'{'.'.join(self.parent)}.{self.name}'"
316+
return f"\"{'.'.join(self.parent)}.{self.name}\""
317317

318318
# Edge case: Similar to above, if this is a message that is
319319
# referencing a nested message that it contains, we need
@@ -333,7 +333,7 @@ def rel(self, address: "Address") -> str:
333333
# identifier. It is guaranteed to work all the time because
334334
# it bumps name resolution until a time when all types in a module
335335
# are guaranteed to be fully defined.
336-
return f"'{'.'.join(self.parent + (self.name,))}'"
336+
return f"\"{'.'.join(self.parent + (self.name,))}\""
337337

338338
# Return the usual `module.Name`.
339339
return str(self)

gapic/schema/wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def primitive_mock_as_str(self) -> str:
309309
answer = self.primitive_mock()
310310

311311
if isinstance(answer, str):
312-
answer = f"'{answer}'"
312+
answer = f'"{answer}"'
313313
else:
314314
answer = str(answer)
315315

gapic/templates/%namespace/%name/__init__.py.j2

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,24 @@ from {% if api.naming.module_namespace %}{{ api.naming.module_namespace|join('.'
4949
#}
5050

5151
__all__ = (
52-
{%- filter indent %}
5352
{% for subpackage, _ in api.subpackages|dictsort %}
54-
'{{ subpackage }}',
53+
"{{ subpackage }}",
5554
{% endfor %}
5655
{% for service in api.services.values()|sort(attribute='name')
5756
if service.meta.address.subpackage == api.subpackage_view %}
58-
'{{ service.client_name }}',
57+
"{{ service.client_name }}",
5958
{% if 'grpc' in opts.transport %}
60-
'{{ service.async_client_name }}',
59+
"{{ service.async_client_name }}",
6160
{% endif %}
6261
{% endfor %}
6362
{% for proto in api.protos.values()|sort(attribute='module_name')
6463
if proto.meta.address.subpackage == api.subpackage_view %}
6564
{% for message in proto.messages.values()|sort(attribute='name') %}
66-
'{{ message.name }}',
65+
"{{ message.name }}",
6766
{% endfor %}
6867
{% for enum in proto.enums.values()|sort(attribute='name')
6968
if proto.meta.address.subpackage == api.subpackage_view %}
70-
'{{ enum.name }}',
69+
"{{ enum.name }}",
7170
{% endfor %}{% endfor %}
72-
{% endfilter %}
7371
)
7472
{% endblock %}

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

Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ from .types.{{ proto.module_name }} import {{ enum.name }}
4646
{% endfor %}
4747
{% endfor %}
4848

49-
if hasattr(api_core, "check_python_version") and hasattr(api_core, "check_dependency_versions"): # pragma: NO COVER
50-
{# TODO(api_core): remove `type:ignore` below when minimum version of api_core makes the else clause unnecessary. #}
51-
api_core.check_python_version("{{package_path}}") # type: ignore
52-
api_core.check_dependency_versions("{{package_path}}") # type: ignore
53-
else: # pragma: NO COVER
49+
if hasattr(api_core, "check_python_version") and hasattr(api_core, "check_dependency_versions"): # pragma: NO COVER
50+
api_core.check_python_version("{{package_path}}") # type: ignore
51+
api_core.check_dependency_versions("{{package_path}}") # type: ignore
52+
else: # pragma: NO COVER
5453
{# TODO(api_core): Remove this try-catch when we require api-core at a version that
5554
supports the changes in https://github.com/googleapis/python-api-core/pull/832
5655
@@ -66,20 +65,24 @@ else: # pragma: NO COVER
6665
_py_version_str = sys.version.split()[0]
6766
_package_label = "{{package_path}}"
6867
if sys.version_info < (3, 9):
69-
warnings.warn("You are using a non-supported Python version " +
70-
f"({_py_version_str}). Google will not post any further " +
71-
f"updates to {_package_label} supporting this Python version. " +
72-
"Please upgrade to the latest Python version, or at " +
73-
f"least to Python 3.9, and then update {_package_label}.",
74-
FutureWarning)
68+
warnings.warn(
69+
"You are using a non-supported Python version "
70+
+ f"({_py_version_str}). Google will not post any further "
71+
+ f"updates to {_package_label} supporting this Python version. "
72+
+ "Please upgrade to the latest Python version, or at "
73+
+ f"least to Python 3.9, and then update {_package_label}.",
74+
FutureWarning,
75+
)
7576
if sys.version_info[:2] == (3, 9):
76-
warnings.warn(f"You are using a Python version ({_py_version_str}) " +
77-
f"which Google will stop supporting in {_package_label} in " +
78-
"January 2026. Please " +
79-
"upgrade to the latest Python version, or at " +
80-
"least to Python 3.10, before then, and " +
81-
f"then update {_package_label}.",
82-
FutureWarning)
77+
warnings.warn(
78+
f"You are using a Python version ({_py_version_str}) "
79+
+ f"which Google will stop supporting in {_package_label} in "
80+
+ "January 2026. Please "
81+
+ "upgrade to the latest Python version, or at "
82+
+ "least to Python 3.10, before then, and "
83+
+ f"then update {_package_label}.",
84+
FutureWarning,
85+
)
8386

8487
def parse_version_to_tuple(version_string: str):
8588
"""Safely converts a semantic version string to a comparable tuple of integers.
@@ -117,51 +120,59 @@ else: # pragma: NO COVER
117120
_recommendation = " (we recommend 6.x)"
118121
(_version_used, _version_used_string) = _get_version(_dependency_package)
119122
if _version_used and _version_used < _next_supported_version_tuple:
120-
warnings.warn(f"Package {_package_label} depends on " +
121-
f"{_dependency_package}, currently installed at version " +
122-
f"{_version_used_string}. Future updates to " +
123-
f"{_package_label} will require {_dependency_package} at " +
124-
f"version {_next_supported_version} or higher{_recommendation}." +
125-
" Please ensure " +
126-
"that either (a) your Python environment doesn't pin the " +
127-
f"version of {_dependency_package}, so that updates to " +
128-
f"{_package_label} can require the higher version, or " +
129-
"(b) you manually update your Python environment to use at " +
130-
f"least version {_next_supported_version} of " +
131-
f"{_dependency_package}.",
132-
FutureWarning)
123+
warnings.warn(
124+
f"Package {_package_label} depends on "
125+
+ f"{_dependency_package}, currently installed at version "
126+
+ f"{_version_used_string}. Future updates to "
127+
+ f"{_package_label} will require {_dependency_package} at "
128+
+ f"version {_next_supported_version} or higher{_recommendation}."
129+
+ " Please ensure "
130+
+ "that either (a) your Python environment doesn't pin the "
131+
+ f"version of {_dependency_package}, so that updates to "
132+
+ f"{_package_label} can require the higher version, or "
133+
+ "(b) you manually update your Python environment to use at "
134+
+ f"least version {_next_supported_version} of "
135+
+ f"{_dependency_package}.",
136+
FutureWarning,
137+
)
133138
except Exception:
134-
warnings.warn("Could not determine the version of Python " +
135-
"currently being used. To continue receiving " +
136-
"updates for {_package_label}, ensure you are " +
137-
"using a supported version of Python; see " +
138-
"https://devguide.python.org/versions/")
139+
warnings.warn(
140+
"Could not determine the version of Python "
141+
+ "currently being used. To continue receiving "
142+
+ "updates for {_package_label}, ensure you are "
143+
+ "using a supported version of Python; see "
144+
+ "https://devguide.python.org/versions/"
145+
)
139146

140147
{# Define __all__.
141148
This requires the full set of imported names, so we iterate over
142149
them again.
143150
-#}
144-
__all__ = (
145-
{% filter sort_lines -%}
146-
{% for subpackage in api.subpackages -%}
147-
'{{ subpackage }}',
148-
{% endfor -%}
151+
152+
153+
{% with imported_names = [] %}
154+
__all__ = ({% for subpackage in api.subpackages %}
155+
{% do imported_names.append(subpackage) %}
156+
{% endfor %}
149157
{% for service in api.services.values()
150-
if service.meta.address.subpackage == api.subpackage_view -%}
151-
'{{ service.client_name }}',
158+
if service.meta.address.subpackage == api.subpackage_view %}
159+
{% do imported_names.append(service.client_name) %}
152160
{% if 'grpc' in opts.transport %}
153-
'{{ service.async_client_name }}',
161+
{% do imported_names.append(service.async_client_name) %}
154162
{% endif %}
155-
{% endfor -%}
163+
{% endfor %}
156164
{% for proto in api.protos.values()
157-
if proto.meta.address.subpackage == api.subpackage_view -%}
158-
{% for message in proto.messages.values()|sort(attribute='name') -%}
159-
'{{ message.name }}',
160-
{% endfor -%}
161-
{% for enum in proto.enums.values() -%}
162-
'{{ enum.name }}',
163-
{% endfor -%}
164-
{% endfor -%}
165-
{% endfilter %}
165+
if proto.meta.address.subpackage == api.subpackage_view %}
166+
{% for message in proto.messages.values()|sort(attribute='name') %}
167+
{% do imported_names.append(message.name) %}
168+
{% endfor %}
169+
{% for enum in proto.enums.values() %}
170+
{% do imported_names.append(enum.name) %}
171+
{% endfor %}
172+
{% endfor %}
173+
{% for name in imported_names|sort %}
174+
"{{ name }}",
175+
{% endfor %}
166176
)
177+
{% endwith %}
167178
{% endblock %}

gapic/templates/%namespace/%name_%version/%sub/services/%service/__init__.py.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ from .async_client import {{ service.async_client_name }}
88
{% endif %}
99

1010
__all__ = (
11-
'{{ service.client_name }}',
11+
"{{ service.client_name }}",
1212
{% if 'grpc' in opts.transport %}
13-
'{{ service.async_client_name }}',
13+
"{{ service.async_client_name }}",
1414
{% endif %}
1515
)
1616
{% endblock %}

0 commit comments

Comments
 (0)