Content-Length: 1223816 | pFad | https://github.com/googleapis/python-language/commit/fa4547f61179b9e8a4065bdd0a2bd7760b033985

E3 fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#409) · googleapis/python-language@fa4547f · GitHub
Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit fa4547f

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#409)
* 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: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b 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>
1 parent 017c68a commit fa4547f

File tree

12 files changed

+88
-85
lines changed

12 files changed

+88
-85
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "2.6.1" # {x-release-please-version}

google/cloud/language_v1/services/language_service/async_client.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.language_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -219,7 +220,7 @@ async def analyze_sentiment(
219220
document: Optional[language_service.Document] = None,
220221
encoding_type: Optional[language_service.EncodingType] = None,
221222
retry: OptionalRetry = gapic_v1.method.DEFAULT,
222-
timeout: Optional[float] = None,
223+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
223224
metadata: Sequence[Tuple[str, str]] = (),
224225
) -> language_service.AnalyzeSentimentResponse:
225226
r"""Analyzes the sentiment of the provided text.
@@ -336,7 +337,7 @@ async def analyze_entities(
336337
document: Optional[language_service.Document] = None,
337338
encoding_type: Optional[language_service.EncodingType] = None,
338339
retry: OptionalRetry = gapic_v1.method.DEFAULT,
339-
timeout: Optional[float] = None,
340+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
340341
metadata: Sequence[Tuple[str, str]] = (),
341342
) -> language_service.AnalyzeEntitiesResponse:
342343
r"""Finds named entities (currently proper names and
@@ -455,7 +456,7 @@ async def analyze_entity_sentiment(
455456
document: Optional[language_service.Document] = None,
456457
encoding_type: Optional[language_service.EncodingType] = None,
457458
retry: OptionalRetry = gapic_v1.method.DEFAULT,
458-
timeout: Optional[float] = None,
459+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
459460
metadata: Sequence[Tuple[str, str]] = (),
460461
) -> language_service.AnalyzeEntitySentimentResponse:
461462
r"""Finds entities, similar to
@@ -575,7 +576,7 @@ async def analyze_syntax(
575576
document: Optional[language_service.Document] = None,
576577
encoding_type: Optional[language_service.EncodingType] = None,
577578
retry: OptionalRetry = gapic_v1.method.DEFAULT,
578-
timeout: Optional[float] = None,
579+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
579580
metadata: Sequence[Tuple[str, str]] = (),
580581
) -> language_service.AnalyzeSyntaxResponse:
581582
r"""Analyzes the syntax of the text and provides sentence
@@ -690,7 +691,7 @@ async def classify_text(
690691
*,
691692
document: Optional[language_service.Document] = None,
692693
retry: OptionalRetry = gapic_v1.method.DEFAULT,
693-
timeout: Optional[float] = None,
694+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
694695
metadata: Sequence[Tuple[str, str]] = (),
695696
) -> language_service.ClassifyTextResponse:
696697
r"""Classifies a document into categories.
@@ -799,7 +800,7 @@ async def annotate_text(
799800
features: Optional[language_service.AnnotateTextRequest.Features] = None,
800801
encoding_type: Optional[language_service.EncodingType] = None,
801802
retry: OptionalRetry = gapic_v1.method.DEFAULT,
802-
timeout: Optional[float] = None,
803+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
803804
metadata: Sequence[Tuple[str, str]] = (),
804805
) -> language_service.AnnotateTextResponse:
805806
r"""A convenience method that provides all the features
@@ -926,14 +927,9 @@ async def __aexit__(self, exc_type, exc, tb):
926927
await self.transport.close()
927928

928929

929-
try:
930-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
931-
gapic_version=pkg_resources.get_distribution(
932-
"google-cloud-language",
933-
).version,
934-
)
935-
except pkg_resources.DistributionNotFound:
936-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
930+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
931+
gapic_version=package_version.__version__
932+
)
937933

938934

939935
__all__ = ("LanguageServiceAsyncClient",)

google/cloud/language_v1/services/language_service/client.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.language_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -426,7 +427,7 @@ def analyze_sentiment(
426427
document: Optional[language_service.Document] = None,
427428
encoding_type: Optional[language_service.EncodingType] = None,
428429
retry: OptionalRetry = gapic_v1.method.DEFAULT,
429-
timeout: Optional[float] = None,
430+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
430431
metadata: Sequence[Tuple[str, str]] = (),
431432
) -> language_service.AnalyzeSentimentResponse:
432433
r"""Analyzes the sentiment of the provided text.
@@ -533,7 +534,7 @@ def analyze_entities(
533534
document: Optional[language_service.Document] = None,
534535
encoding_type: Optional[language_service.EncodingType] = None,
535536
retry: OptionalRetry = gapic_v1.method.DEFAULT,
536-
timeout: Optional[float] = None,
537+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
537538
metadata: Sequence[Tuple[str, str]] = (),
538539
) -> language_service.AnalyzeEntitiesResponse:
539540
r"""Finds named entities (currently proper names and
@@ -642,7 +643,7 @@ def analyze_entity_sentiment(
642643
document: Optional[language_service.Document] = None,
643644
encoding_type: Optional[language_service.EncodingType] = None,
644645
retry: OptionalRetry = gapic_v1.method.DEFAULT,
645-
timeout: Optional[float] = None,
646+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
646647
metadata: Sequence[Tuple[str, str]] = (),
647648
) -> language_service.AnalyzeEntitySentimentResponse:
648649
r"""Finds entities, similar to
@@ -752,7 +753,7 @@ def analyze_syntax(
752753
document: Optional[language_service.Document] = None,
753754
encoding_type: Optional[language_service.EncodingType] = None,
754755
retry: OptionalRetry = gapic_v1.method.DEFAULT,
755-
timeout: Optional[float] = None,
756+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
756757
metadata: Sequence[Tuple[str, str]] = (),
757758
) -> language_service.AnalyzeSyntaxResponse:
758759
r"""Analyzes the syntax of the text and provides sentence
@@ -857,7 +858,7 @@ def classify_text(
857858
*,
858859
document: Optional[language_service.Document] = None,
859860
retry: OptionalRetry = gapic_v1.method.DEFAULT,
860-
timeout: Optional[float] = None,
861+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
861862
metadata: Sequence[Tuple[str, str]] = (),
862863
) -> language_service.ClassifyTextResponse:
863864
r"""Classifies a document into categories.
@@ -956,7 +957,7 @@ def annotate_text(
956957
features: Optional[language_service.AnnotateTextRequest.Features] = None,
957958
encoding_type: Optional[language_service.EncodingType] = None,
958959
retry: OptionalRetry = gapic_v1.method.DEFAULT,
959-
timeout: Optional[float] = None,
960+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
960961
metadata: Sequence[Tuple[str, str]] = (),
961962
) -> language_service.AnnotateTextResponse:
962963
r"""A convenience method that provides all the features
@@ -1080,14 +1081,9 @@ def __exit__(self, type, value, traceback):
10801081
self.transport.close()
10811082

10821083

1083-
try:
1084-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1085-
gapic_version=pkg_resources.get_distribution(
1086-
"google-cloud-language",
1087-
).version,
1088-
)
1089-
except pkg_resources.DistributionNotFound:
1090-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1084+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1085+
gapic_version=package_version.__version__
1086+
)
10911087

10921088

10931089
__all__ = ("LanguageServiceClient",)

google/cloud/language_v1/services/language_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@
2323
import google.auth # type: ignore
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.oauth2 import service_account # type: ignore
26-
import pkg_resources
2726

27+
from google.cloud.language_v1 import gapic_version as package_version
2828
from google.cloud.language_v1.types import language_service
2929

30-
try:
31-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32-
gapic_version=pkg_resources.get_distribution(
33-
"google-cloud-language",
34-
).version,
35-
)
36-
except pkg_resources.DistributionNotFound:
37-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
30+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
31+
gapic_version=package_version.__version__
32+
)
3833

3934

4035
class LanguageServiceTransport(abc.ABC):
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "2.6.1" # {x-release-please-version}

google/cloud/language_v1beta2/services/language_service/async_client.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.language_v1beta2 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -219,7 +220,7 @@ async def analyze_sentiment(
219220
document: Optional[language_service.Document] = None,
220221
encoding_type: Optional[language_service.EncodingType] = None,
221222
retry: OptionalRetry = gapic_v1.method.DEFAULT,
222-
timeout: Optional[float] = None,
223+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
223224
metadata: Sequence[Tuple[str, str]] = (),
224225
) -> language_service.AnalyzeSentimentResponse:
225226
r"""Analyzes the sentiment of the provided text.
@@ -337,7 +338,7 @@ async def analyze_entities(
337338
document: Optional[language_service.Document] = None,
338339
encoding_type: Optional[language_service.EncodingType] = None,
339340
retry: OptionalRetry = gapic_v1.method.DEFAULT,
340-
timeout: Optional[float] = None,
341+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
341342
metadata: Sequence[Tuple[str, str]] = (),
342343
) -> language_service.AnalyzeEntitiesResponse:
343344
r"""Finds named entities (currently proper names and
@@ -456,7 +457,7 @@ async def analyze_entity_sentiment(
456457
document: Optional[language_service.Document] = None,
457458
encoding_type: Optional[language_service.EncodingType] = None,
458459
retry: OptionalRetry = gapic_v1.method.DEFAULT,
459-
timeout: Optional[float] = None,
460+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
460461
metadata: Sequence[Tuple[str, str]] = (),
461462
) -> language_service.AnalyzeEntitySentimentResponse:
462463
r"""Finds entities, similar to
@@ -576,7 +577,7 @@ async def analyze_syntax(
576577
document: Optional[language_service.Document] = None,
577578
encoding_type: Optional[language_service.EncodingType] = None,
578579
retry: OptionalRetry = gapic_v1.method.DEFAULT,
579-
timeout: Optional[float] = None,
580+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
580581
metadata: Sequence[Tuple[str, str]] = (),
581582
) -> language_service.AnalyzeSyntaxResponse:
582583
r"""Analyzes the syntax of the text and provides sentence
@@ -691,7 +692,7 @@ async def classify_text(
691692
*,
692693
document: Optional[language_service.Document] = None,
693694
retry: OptionalRetry = gapic_v1.method.DEFAULT,
694-
timeout: Optional[float] = None,
695+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
695696
metadata: Sequence[Tuple[str, str]] = (),
696697
) -> language_service.ClassifyTextResponse:
697698
r"""Classifies a document into categories.
@@ -800,7 +801,7 @@ async def annotate_text(
800801
features: Optional[language_service.AnnotateTextRequest.Features] = None,
801802
encoding_type: Optional[language_service.EncodingType] = None,
802803
retry: OptionalRetry = gapic_v1.method.DEFAULT,
803-
timeout: Optional[float] = None,
804+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
804805
metadata: Sequence[Tuple[str, str]] = (),
805806
) -> language_service.AnnotateTextResponse:
806807
r"""A convenience method that provides all syntax,
@@ -927,14 +928,9 @@ async def __aexit__(self, exc_type, exc, tb):
927928
await self.transport.close()
928929

929930

930-
try:
931-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
932-
gapic_version=pkg_resources.get_distribution(
933-
"google-cloud-language",
934-
).version,
935-
)
936-
except pkg_resources.DistributionNotFound:
937-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
931+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
932+
gapic_version=package_version.__version__
933+
)
938934

939935

940936
__all__ = ("LanguageServiceAsyncClient",)

google/cloud/language_v1beta2/services/language_service/client.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.language_v1beta2 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -426,7 +427,7 @@ def analyze_sentiment(
426427
document: Optional[language_service.Document] = None,
427428
encoding_type: Optional[language_service.EncodingType] = None,
428429
retry: OptionalRetry = gapic_v1.method.DEFAULT,
429-
timeout: Optional[float] = None,
430+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
430431
metadata: Sequence[Tuple[str, str]] = (),
431432
) -> language_service.AnalyzeSentimentResponse:
432433
r"""Analyzes the sentiment of the provided text.
@@ -534,7 +535,7 @@ def analyze_entities(
534535
document: Optional[language_service.Document] = None,
535536
encoding_type: Optional[language_service.EncodingType] = None,
536537
retry: OptionalRetry = gapic_v1.method.DEFAULT,
537-
timeout: Optional[float] = None,
538+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
538539
metadata: Sequence[Tuple[str, str]] = (),
539540
) -> language_service.AnalyzeEntitiesResponse:
540541
r"""Finds named entities (currently proper names and
@@ -643,7 +644,7 @@ def analyze_entity_sentiment(
643644
document: Optional[language_service.Document] = None,
644645
encoding_type: Optional[language_service.EncodingType] = None,
645646
retry: OptionalRetry = gapic_v1.method.DEFAULT,
646-
timeout: Optional[float] = None,
647+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
647648
metadata: Sequence[Tuple[str, str]] = (),
648649
) -> language_service.AnalyzeEntitySentimentResponse:
649650
r"""Finds entities, similar to
@@ -753,7 +754,7 @@ def analyze_syntax(
753754
document: Optional[language_service.Document] = None,
754755
encoding_type: Optional[language_service.EncodingType] = None,
755756
retry: OptionalRetry = gapic_v1.method.DEFAULT,
756-
timeout: Optional[float] = None,
757+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
757758
metadata: Sequence[Tuple[str, str]] = (),
758759
) -> language_service.AnalyzeSyntaxResponse:
759760
r"""Analyzes the syntax of the text and provides sentence
@@ -858,7 +859,7 @@ def classify_text(
858859
*,
859860
document: Optional[language_service.Document] = None,
860861
retry: OptionalRetry = gapic_v1.method.DEFAULT,
861-
timeout: Optional[float] = None,
862+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
862863
metadata: Sequence[Tuple[str, str]] = (),
863864
) -> language_service.ClassifyTextResponse:
864865
r"""Classifies a document into categories.
@@ -957,7 +958,7 @@ def annotate_text(
957958
features: Optional[language_service.AnnotateTextRequest.Features] = None,
958959
encoding_type: Optional[language_service.EncodingType] = None,
959960
retry: OptionalRetry = gapic_v1.method.DEFAULT,
960-
timeout: Optional[float] = None,
961+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
961962
metadata: Sequence[Tuple[str, str]] = (),
962963
) -> language_service.AnnotateTextResponse:
963964
r"""A convenience method that provides all syntax,
@@ -1081,14 +1082,9 @@ def __exit__(self, type, value, traceback):
10811082
self.transport.close()
10821083

10831084

1084-
try:
1085-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1086-
gapic_version=pkg_resources.get_distribution(
1087-
"google-cloud-language",
1088-
).version,
1089-
)
1090-
except pkg_resources.DistributionNotFound:
1091-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1085+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1086+
gapic_version=package_version.__version__
1087+
)
10921088

10931089

10941090
__all__ = ("LanguageServiceClient",)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/python-language/commit/fa4547f61179b9e8a4065bdd0a2bd7760b033985

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy