|
34 | 34 | from google.api_core.client_options import ClientOptions |
35 | 35 | from google.auth import credentials as ga_credentials # type: ignore |
36 | 36 | 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 |
38 | 39 |
|
39 | 40 | try: |
40 | 41 | OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] |
@@ -219,7 +220,7 @@ async def analyze_sentiment( |
219 | 220 | document: Optional[language_service.Document] = None, |
220 | 221 | encoding_type: Optional[language_service.EncodingType] = None, |
221 | 222 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
222 | | - timeout: Optional[float] = None, |
| 223 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
223 | 224 | metadata: Sequence[Tuple[str, str]] = (), |
224 | 225 | ) -> language_service.AnalyzeSentimentResponse: |
225 | 226 | r"""Analyzes the sentiment of the provided text. |
@@ -337,7 +338,7 @@ async def analyze_entities( |
337 | 338 | document: Optional[language_service.Document] = None, |
338 | 339 | encoding_type: Optional[language_service.EncodingType] = None, |
339 | 340 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
340 | | - timeout: Optional[float] = None, |
| 341 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
341 | 342 | metadata: Sequence[Tuple[str, str]] = (), |
342 | 343 | ) -> language_service.AnalyzeEntitiesResponse: |
343 | 344 | r"""Finds named entities (currently proper names and |
@@ -456,7 +457,7 @@ async def analyze_entity_sentiment( |
456 | 457 | document: Optional[language_service.Document] = None, |
457 | 458 | encoding_type: Optional[language_service.EncodingType] = None, |
458 | 459 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
459 | | - timeout: Optional[float] = None, |
| 460 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
460 | 461 | metadata: Sequence[Tuple[str, str]] = (), |
461 | 462 | ) -> language_service.AnalyzeEntitySentimentResponse: |
462 | 463 | r"""Finds entities, similar to |
@@ -576,7 +577,7 @@ async def analyze_syntax( |
576 | 577 | document: Optional[language_service.Document] = None, |
577 | 578 | encoding_type: Optional[language_service.EncodingType] = None, |
578 | 579 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
579 | | - timeout: Optional[float] = None, |
| 580 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
580 | 581 | metadata: Sequence[Tuple[str, str]] = (), |
581 | 582 | ) -> language_service.AnalyzeSyntaxResponse: |
582 | 583 | r"""Analyzes the syntax of the text and provides sentence |
@@ -691,7 +692,7 @@ async def classify_text( |
691 | 692 | *, |
692 | 693 | document: Optional[language_service.Document] = None, |
693 | 694 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
694 | | - timeout: Optional[float] = None, |
| 695 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
695 | 696 | metadata: Sequence[Tuple[str, str]] = (), |
696 | 697 | ) -> language_service.ClassifyTextResponse: |
697 | 698 | r"""Classifies a document into categories. |
@@ -800,7 +801,7 @@ async def annotate_text( |
800 | 801 | features: Optional[language_service.AnnotateTextRequest.Features] = None, |
801 | 802 | encoding_type: Optional[language_service.EncodingType] = None, |
802 | 803 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
803 | | - timeout: Optional[float] = None, |
| 804 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
804 | 805 | metadata: Sequence[Tuple[str, str]] = (), |
805 | 806 | ) -> language_service.AnnotateTextResponse: |
806 | 807 | r"""A convenience method that provides all syntax, |
@@ -927,14 +928,9 @@ async def __aexit__(self, exc_type, exc, tb): |
927 | 928 | await self.transport.close() |
928 | 929 |
|
929 | 930 |
|
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 | +) |
938 | 934 |
|
939 | 935 |
|
940 | 936 | __all__ = ("LanguageServiceAsyncClient",) |
0 commit comments