This repository was archived by the owner on Mar 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
chore: fix line length for code with inline mypy guard #2554
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d161d35
chore: avoid formatting code with mypy comments
ohmayr f709c01
add comments
ohmayr 70d9f45
update goldens
ohmayr d669568
fix typo
ohmayr 2f61739
address feedback
ohmayr dbfe132
revert WORKSPACE
ohmayr e9615e7
address PR feedback
ohmayr 22f7a2f
address PR feedback
ohmayr df24f8e
remove fmt skip from pragma NO COVER lines
ohmayr 7d92db1
remove unnecessary fmt skips
ohmayr 8fd1fbe
update goldens
ohmayr 0a802ff
update goldens
ohmayr 10a1960
fix line length
ohmayr 20906c8
Merge branch 'main' into update-templates-to-ignore-templates
daniel-sanche 39580a6
Trigger CI
ohmayr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
Contributor
Author
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. Addressed. |
||
| {# 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 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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__ | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?