-
Notifications
You must be signed in to change notification settings - Fork 78
chore: avoid formatting code with mypy comments #2554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d161d35
f709c01
70d9f45
d669568
2f61739
dbfe132
e9615e7
22f7a2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,11 @@ import sys | |
|
|
||
| __version__ = package_version.__version__ | ||
|
|
||
| if sys.version_info >= (3, 8): # pragma: NO COVER | ||
| {# Add `# fmt: skip` to keep `# pragma: NO COVER` on the same line #} | ||
| if sys.version_info >= (3, 8): # pragma: NO COVER # fmt: skip | ||
| from importlib import metadata | ||
| else: # pragma: NO COVER | ||
| {# Add `# fmt: skip` to keep `# pragma: NO COVER` on the same line #} | ||
| else: # pragma: NO COVER # fmt: skip | ||
| # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove | ||
| # this code path once we drop support for Python 3.7 | ||
| import importlib_metadata as metadata | ||
|
|
@@ -46,7 +48,8 @@ from .types.{{ proto.module_name }} import {{ enum.name }} | |
| {% endfor %} | ||
| {% endfor %} | ||
|
|
||
| if hasattr(api_core, "check_python_version") and hasattr(api_core, "check_dependency_versions"): # pragma: NO COVER | ||
| {# Add `# fmt: skip` to keep `# pragma: NO COVER` on the same line #} | ||
| if hasattr(api_core, "check_python_version") and hasattr(api_core, "check_dependency_versions"): # pragma: NO COVER # fmt: skip | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of skipping the formatting, can this be broken into multiple lines? This is 129 characters, so it will stand out quite a bit |
||
| {# TODO(api_core): remove `type:ignore` below when minimum version of api_core makes the else clause unnecessary. #} | ||
| api_core.check_python_version("{{package_path}}") # type: ignore | ||
| api_core.check_dependency_versions("{{package_path}}") # type: ignore | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,7 +98,8 @@ class {{ service.async_client_name }}: | |
| Returns: | ||
| {{ service.async_client_name }}: The constructed client. | ||
| """ | ||
| return {{ service.client_name }}.from_service_account_info.__func__({{ service.async_client_name }}, info, *args, **kwargs) # type: ignore | ||
| {# Add `# fmt: skip` to keep `# type: ignore` on the same line #} | ||
| return {{ service.client_name }}.from_service_account_info.__func__({{ service.async_client_name }}, info, *args, **kwargs) # type: ignore # fmt: skip | ||
|
|
||
| @classmethod | ||
| def from_service_account_file(cls, filename: str, *args, **kwargs): | ||
|
|
@@ -114,7 +115,8 @@ class {{ service.async_client_name }}: | |
| Returns: | ||
| {{ service.async_client_name }}: The constructed client. | ||
| """ | ||
| return {{ service.client_name }}.from_service_account_file.__func__({{ service.async_client_name }}, filename, *args, **kwargs) # type: ignore | ||
| {# Add `# fmt: skip` to keep `# type: ignore` on the same line #} | ||
| return {{ service.client_name }}.from_service_account_file.__func__({{ service.async_client_name }}, filename, *args, **kwargs) # type: ignore # fmt: skip | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be broken up? |
||
|
|
||
| from_service_account_json = from_service_account_file | ||
|
|
||
|
|
@@ -150,7 +152,8 @@ class {{ service.async_client_name }}: | |
| Raises: | ||
| google.auth.exceptions.MutualTLSChannelError: If any errors happen. | ||
| """ | ||
| return {{ service.client_name }}.get_mtls_endpoint_and_cert_source(client_options) # type: ignore | ||
| {# Add `# fmt: skip` to keep `# type: ignore` on the same line #} | ||
| return {{ service.client_name }}.get_mtls_endpoint_and_cert_source(client_options) # type: ignore # fmt: skip | ||
|
|
||
| @property | ||
| def transport(self) -> {{ service.name }}Transport: | ||
|
|
@@ -252,7 +255,8 @@ class {{ service.async_client_name }}: | |
|
|
||
| ) | ||
|
|
||
| if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER | ||
| {# Add ` # fmt: skip` to keep `# pragma: NO COVER` on the same line #} | ||
| if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER # fmt: skip | ||
| _LOGGER.debug( | ||
| "Created client `{{ service.meta.address.proto_package_versioned }}.{{ service.async_client_name }}`.", | ||
| extra = { | ||
|
|
@@ -727,7 +731,8 @@ class {{ service.async_client_name }}: | |
|
|
||
| DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) | ||
|
|
||
| if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER | ||
| {# Add `# fmt: skip` to keep `# pragma: NO COVER` on the same line #} | ||
| if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER # fmt: skip | ||
| DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__ | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused why the skip tag is needed here. Is ruff doing anything to this line? Or is this just in case?