chore: onboard google-maps-mapmanagement API#16856
chore: onboard google-maps-mapmanagement API#16856noahdietz wants to merge 2 commits intogoogleapis:mainfrom
Conversation
|
The docs error is something that suggests we might need to change the templates: The librarian.yaml change looks good to me though. |
There was a problem hiding this comment.
Code Review
This pull request introduces the initial implementation of the google-maps-mapmanagement Python client library, providing support for the Map Management v2beta API. The review feedback identifies a potential AttributeError in the async client's logging logic when credentials are not provided, recommends removing redundant Python 3.7 compatibility code as the library requires version 3.9 or higher, and corrects a malformed warning string that lacks an f-string prefix for variable interpolation.
| self._client._transport._credentials, "universe_domain", "" | ||
| ), | ||
| "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", | ||
| "credentialsInfo": getattr( | ||
| self.transport._credentials, "get_cred_info", lambda: None | ||
| )(), | ||
| } |
There was a problem hiding this comment.
This logging block will raise an AttributeError if self._client._transport._credentials is None. This occurs when a custom channel is provided to the client constructor, as credentials are then ignored. A check for None should be added before accessing attributes of _credentials to avoid crashing the client initialization.
"universeDomain": getattr(
self._client._transport._credentials, "universe_domain", ""
) if self._client._transport._credentials else "",
"credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}" if self._client._transport._credentials else None,
"credentialsInfo": getattr(
self.transport._credentials, "get_cred_info", lambda: None
)() if self._client._transport._credentials else None,| if sys.version_info >= (3, 8): # pragma: NO COVER | ||
| from importlib import metadata | ||
| else: # pragma: NO COVER | ||
| # 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 |
| "Could not determine the version of Python " | ||
| + "currently being used. To continue receiving " | ||
| + "updates for {_package_label}, ensure you are " | ||
| + "using a supported version of Python; see " |
There was a problem hiding this comment.
The warning message is missing the f prefix, so {_package_label} will be rendered as a literal string instead of being interpolated. Additionally, _package_label might not be defined if an exception occurs early in the try block. It is safer to use the literal package name here.
| + "using a supported version of Python; see " | |
| + "updates for google.maps.mapmanagement_v2beta, ensure you are " |
@jskeet Yes, just started a thread about it. I'm guessing you are referring to a Python generator template change? |
|
Either that or synthtool (which would be annoying - I've been trying not to touch it). Python folks will have better answers than me though. |
Onboard
google-maps-mapmanagementAPI with initialv2betaversion.Produced by running the following commands:
Towards b/503325033