Skip to content

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#409)
Browse files Browse the repository at this point in the history
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0

fix: Drop usage of pkg_resources

fix: Fix timeout default values

docs(samples): Snippetgen should call await on the operation coroutine before calling result

PiperOrigin-RevId: 493260409

Source-Link: googleapis/googleapis@fea4387

Source-Link: googleapis/googleapis-gen@387b734
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add gapic_version.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Dec 8, 2022
1 parent e7da3c3 commit 90b6112
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 85 deletions.
5 changes: 0 additions & 5 deletions packages/google-cloud-language/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ exclude_lines =
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.6.1" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.language_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -219,7 +220,7 @@ async def analyze_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSentimentResponse:
r"""Analyzes the sentiment of the provided text.
Expand Down Expand Up @@ -336,7 +337,7 @@ async def analyze_entities(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitiesResponse:
r"""Finds named entities (currently proper names and
Expand Down Expand Up @@ -455,7 +456,7 @@ async def analyze_entity_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitySentimentResponse:
r"""Finds entities, similar to
Expand Down Expand Up @@ -575,7 +576,7 @@ async def analyze_syntax(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSyntaxResponse:
r"""Analyzes the syntax of the text and provides sentence
Expand Down Expand Up @@ -690,7 +691,7 @@ async def classify_text(
*,
document: Optional[language_service.Document] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.ClassifyTextResponse:
r"""Classifies a document into categories.
Expand Down Expand Up @@ -799,7 +800,7 @@ async def annotate_text(
features: Optional[language_service.AnnotateTextRequest.Features] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnnotateTextResponse:
r"""A convenience method that provides all the features
Expand Down Expand Up @@ -926,14 +927,9 @@ async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-language",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("LanguageServiceAsyncClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.language_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -426,7 +427,7 @@ def analyze_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSentimentResponse:
r"""Analyzes the sentiment of the provided text.
Expand Down Expand Up @@ -533,7 +534,7 @@ def analyze_entities(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitiesResponse:
r"""Finds named entities (currently proper names and
Expand Down Expand Up @@ -642,7 +643,7 @@ def analyze_entity_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitySentimentResponse:
r"""Finds entities, similar to
Expand Down Expand Up @@ -752,7 +753,7 @@ def analyze_syntax(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSyntaxResponse:
r"""Analyzes the syntax of the text and provides sentence
Expand Down Expand Up @@ -857,7 +858,7 @@ def classify_text(
*,
document: Optional[language_service.Document] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.ClassifyTextResponse:
r"""Classifies a document into categories.
Expand Down Expand Up @@ -956,7 +957,7 @@ def annotate_text(
features: Optional[language_service.AnnotateTextRequest.Features] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnnotateTextResponse:
r"""A convenience method that provides all the features
Expand Down Expand Up @@ -1080,14 +1081,9 @@ def __exit__(self, type, value, traceback):
self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-language",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("LanguageServiceClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.language_v1 import gapic_version as package_version
from google.cloud.language_v1.types import language_service

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-language",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


class LanguageServiceTransport(abc.ABC):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.6.1" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.language_v1beta2 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -219,7 +220,7 @@ async def analyze_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSentimentResponse:
r"""Analyzes the sentiment of the provided text.
Expand Down Expand Up @@ -337,7 +338,7 @@ async def analyze_entities(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitiesResponse:
r"""Finds named entities (currently proper names and
Expand Down Expand Up @@ -456,7 +457,7 @@ async def analyze_entity_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitySentimentResponse:
r"""Finds entities, similar to
Expand Down Expand Up @@ -576,7 +577,7 @@ async def analyze_syntax(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSyntaxResponse:
r"""Analyzes the syntax of the text and provides sentence
Expand Down Expand Up @@ -691,7 +692,7 @@ async def classify_text(
*,
document: Optional[language_service.Document] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.ClassifyTextResponse:
r"""Classifies a document into categories.
Expand Down Expand Up @@ -800,7 +801,7 @@ async def annotate_text(
features: Optional[language_service.AnnotateTextRequest.Features] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnnotateTextResponse:
r"""A convenience method that provides all syntax,
Expand Down Expand Up @@ -927,14 +928,9 @@ async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-language",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("LanguageServiceAsyncClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.language_v1beta2 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -426,7 +427,7 @@ def analyze_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSentimentResponse:
r"""Analyzes the sentiment of the provided text.
Expand Down Expand Up @@ -534,7 +535,7 @@ def analyze_entities(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitiesResponse:
r"""Finds named entities (currently proper names and
Expand Down Expand Up @@ -643,7 +644,7 @@ def analyze_entity_sentiment(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitySentimentResponse:
r"""Finds entities, similar to
Expand Down Expand Up @@ -753,7 +754,7 @@ def analyze_syntax(
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSyntaxResponse:
r"""Analyzes the syntax of the text and provides sentence
Expand Down Expand Up @@ -858,7 +859,7 @@ def classify_text(
*,
document: Optional[language_service.Document] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.ClassifyTextResponse:
r"""Classifies a document into categories.
Expand Down Expand Up @@ -957,7 +958,7 @@ def annotate_text(
features: Optional[language_service.AnnotateTextRequest.Features] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnnotateTextResponse:
r"""A convenience method that provides all syntax,
Expand Down Expand Up @@ -1081,14 +1082,9 @@ def __exit__(self, type, value, traceback):
self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-language",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("LanguageServiceClient",)
Loading

0 comments on commit 90b6112

Please sign in to comment.