Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
chore: Update gapic-generator-python to v1.6.1 (#392)
Browse files Browse the repository at this point in the history
* chore: update to gapic-generator-python 1.5.0

feat: add support for `google.cloud.<api>.__version__`
PiperOrigin-RevId: 484665853

Source-Link: googleapis/googleapis@8eb249a

Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9

* 🦉 Updates from OwlBot post-processor

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

* update version in gapic_version.py

* add .release-please-manifest.json with correct version

* add owlbot.py to exclude generated gapic_version.py

* set manifest to true in .github/release-please.yml

* add release-please-config.json

* fix spacing

* revert

* typo

* chore: Update to gapic-generator-python 1.6.0

feat(python): Add typing to proto.Message based class attributes

feat(python): Snippetgen handling of repeated enum field

PiperOrigin-RevId: 487326846

Source-Link: googleapis/googleapis@da380c7

Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9

* 🦉 Updates from OwlBot post-processor

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

* feat: new APIs added to reflect updates to the filestore service

- Add ENTERPRISE Tier
- Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot
- Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare
- Add ConnectMode to NetworkConfig (for Private Service Access support)
- New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING)
- Add SuspensionReason (for KMS related suspension)
- Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled

PiperOrigin-RevId: 487492758

Source-Link: googleapis/googleapis@5be5981

Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9

* 🦉 Updates from OwlBot post-processor

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

* update path to snippet metadata json

* chore: Update gapic-generator-python to v1.6.1

PiperOrigin-RevId: 488036204

Source-Link: googleapis/googleapis@08f275f

Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9

* 🦉 Updates from OwlBot post-processor

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

* configure release-please to use manifest

* drop flake8-import-order

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 Nov 27, 2022
1 parent cb1b186 commit 3ff2900
Show file tree
Hide file tree
Showing 26 changed files with 541 additions and 400 deletions.
1 change: 1 addition & 0 deletions .github/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
releaseType: python
handleGHRelease: true
manifest: true
# NOTE: this section is generated by synthtool.languages.python
# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py
branches:
Expand Down
1 change: 0 additions & 1 deletion docs/language_v1/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ Types for Google Cloud Language v1 API

.. automodule:: google.cloud.language_v1.types
:members:
:undoc-members:
:show-inheritance:
1 change: 0 additions & 1 deletion docs/language_v1beta2/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ Types for Google Cloud Language v1beta2 API

.. automodule:: google.cloud.language_v1beta2.types
:members:
:undoc-members:
:show-inheritance:
4 changes: 4 additions & 0 deletions google/cloud/language/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.language import gapic_version as package_version

__version__ = package_version.__version__


from google.cloud.language_v1.services.language_service.async_client import (
LanguageServiceAsyncClient,
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/language_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.language import gapic_version as package_version

__version__ = package_version.__version__


from .services.language_service import LanguageServiceAsyncClient, LanguageServiceClient
from .types.language_service import (
Expand Down
78 changes: 45 additions & 33 deletions google/cloud/language_v1/services/language_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
from collections import OrderedDict
import functools
import re
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
from typing import (
Dict,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
Type,
Union,
)

from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
Expand Down Expand Up @@ -158,9 +168,9 @@ def transport(self) -> LanguageServiceTransport:
def __init__(
self,
*,
credentials: ga_credentials.Credentials = None,
credentials: Optional[ga_credentials.Credentials] = None,
transport: Union[str, LanguageServiceTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_options: Optional[ClientOptions] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiates the language service client.
Expand Down Expand Up @@ -204,12 +214,12 @@ def __init__(

async def analyze_sentiment(
self,
request: Union[language_service.AnalyzeSentimentRequest, dict] = None,
request: Optional[Union[language_service.AnalyzeSentimentRequest, dict]] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSentimentResponse:
r"""Analyzes the sentiment of the provided text.
Expand Down Expand Up @@ -244,7 +254,7 @@ async def sample_analyze_sentiment():
print(response)
Args:
request (Union[google.cloud.language_v1.types.AnalyzeSentimentRequest, dict]):
request (Optional[Union[google.cloud.language_v1.types.AnalyzeSentimentRequest, dict]]):
The request object. The sentiment analysis request
message.
document (:class:`google.cloud.language_v1.types.Document`):
Expand Down Expand Up @@ -321,12 +331,12 @@ async def sample_analyze_sentiment():

async def analyze_entities(
self,
request: Union[language_service.AnalyzeEntitiesRequest, dict] = None,
request: Optional[Union[language_service.AnalyzeEntitiesRequest, dict]] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitiesResponse:
r"""Finds named entities (currently proper names and
Expand Down Expand Up @@ -364,7 +374,7 @@ async def sample_analyze_entities():
print(response)
Args:
request (Union[google.cloud.language_v1.types.AnalyzeEntitiesRequest, dict]):
request (Optional[Union[google.cloud.language_v1.types.AnalyzeEntitiesRequest, dict]]):
The request object. The entity analysis request message.
document (:class:`google.cloud.language_v1.types.Document`):
Required. Input document.
Expand Down Expand Up @@ -438,12 +448,14 @@ async def sample_analyze_entities():

async def analyze_entity_sentiment(
self,
request: Union[language_service.AnalyzeEntitySentimentRequest, dict] = None,
request: Optional[
Union[language_service.AnalyzeEntitySentimentRequest, dict]
] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitySentimentResponse:
r"""Finds entities, similar to
Expand Down Expand Up @@ -481,7 +493,7 @@ async def sample_analyze_entity_sentiment():
print(response)
Args:
request (Union[google.cloud.language_v1.types.AnalyzeEntitySentimentRequest, dict]):
request (Optional[Union[google.cloud.language_v1.types.AnalyzeEntitySentimentRequest, dict]]):
The request object. The entity-level sentiment analysis
request message.
document (:class:`google.cloud.language_v1.types.Document`):
Expand Down Expand Up @@ -558,12 +570,12 @@ async def sample_analyze_entity_sentiment():

async def analyze_syntax(
self,
request: Union[language_service.AnalyzeSyntaxRequest, dict] = None,
request: Optional[Union[language_service.AnalyzeSyntaxRequest, dict]] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSyntaxResponse:
r"""Analyzes the syntax of the text and provides sentence
Expand Down Expand Up @@ -600,7 +612,7 @@ async def sample_analyze_syntax():
print(response)
Args:
request (Union[google.cloud.language_v1.types.AnalyzeSyntaxRequest, dict]):
request (Optional[Union[google.cloud.language_v1.types.AnalyzeSyntaxRequest, dict]]):
The request object. The syntax analysis request message.
document (:class:`google.cloud.language_v1.types.Document`):
Required. Input document.
Expand Down Expand Up @@ -674,11 +686,11 @@ async def sample_analyze_syntax():

async def classify_text(
self,
request: Union[language_service.ClassifyTextRequest, dict] = None,
request: Optional[Union[language_service.ClassifyTextRequest, dict]] = None,
*,
document: language_service.Document = None,
document: Optional[language_service.Document] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.ClassifyTextResponse:
r"""Classifies a document into categories.
Expand Down Expand Up @@ -713,7 +725,7 @@ async def sample_classify_text():
print(response)
Args:
request (Union[google.cloud.language_v1.types.ClassifyTextRequest, dict]):
request (Optional[Union[google.cloud.language_v1.types.ClassifyTextRequest, dict]]):
The request object. The document classification request
message.
document (:class:`google.cloud.language_v1.types.Document`):
Expand Down Expand Up @@ -781,13 +793,13 @@ async def sample_classify_text():

async def annotate_text(
self,
request: Union[language_service.AnnotateTextRequest, dict] = None,
request: Optional[Union[language_service.AnnotateTextRequest, dict]] = None,
*,
document: language_service.Document = None,
features: language_service.AnnotateTextRequest.Features = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
features: Optional[language_service.AnnotateTextRequest.Features] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnnotateTextResponse:
r"""A convenience method that provides all the features
Expand Down Expand Up @@ -824,7 +836,7 @@ async def sample_annotate_text():
print(response)
Args:
request (Union[google.cloud.language_v1.types.AnnotateTextRequest, dict]):
request (Optional[Union[google.cloud.language_v1.types.AnnotateTextRequest, dict]]):
The request object. The request message for the text
annotation API, which can perform multiple analysis
types (sentiment, entities, and syntax) in one call.
Expand Down
72 changes: 43 additions & 29 deletions google/cloud/language_v1/services/language_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@
from collections import OrderedDict
import os
import re
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
from typing import (
Dict,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
Type,
Union,
cast,
)

from google.api_core import client_options as client_options_lib
from google.api_core import exceptions as core_exceptions
Expand Down Expand Up @@ -57,7 +68,7 @@ class LanguageServiceClientMeta(type):

def get_transport_class(
cls,
label: str = None,
label: Optional[str] = None,
) -> Type[LanguageServiceTransport]:
"""Returns an appropriate transport class.
Expand Down Expand Up @@ -312,8 +323,8 @@ def __init__(
self,
*,
credentials: Optional[ga_credentials.Credentials] = None,
transport: Union[str, LanguageServiceTransport, None] = None,
client_options: Optional[client_options_lib.ClientOptions] = None,
transport: Optional[Union[str, LanguageServiceTransport]] = None,
client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiates the language service client.
Expand All @@ -327,7 +338,7 @@ def __init__(
transport (Union[str, LanguageServiceTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
client_options (google.api_core.client_options.ClientOptions): Custom options for the
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
Expand Down Expand Up @@ -357,6 +368,7 @@ def __init__(
client_options = client_options_lib.from_dict(client_options)
if client_options is None:
client_options = client_options_lib.ClientOptions()
client_options = cast(client_options_lib.ClientOptions, client_options)

api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(
client_options
Expand Down Expand Up @@ -409,12 +421,12 @@ def __init__(

def analyze_sentiment(
self,
request: Union[language_service.AnalyzeSentimentRequest, dict] = None,
request: Optional[Union[language_service.AnalyzeSentimentRequest, dict]] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSentimentResponse:
r"""Analyzes the sentiment of the provided text.
Expand Down Expand Up @@ -516,12 +528,12 @@ def sample_analyze_sentiment():

def analyze_entities(
self,
request: Union[language_service.AnalyzeEntitiesRequest, dict] = None,
request: Optional[Union[language_service.AnalyzeEntitiesRequest, dict]] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitiesResponse:
r"""Finds named entities (currently proper names and
Expand Down Expand Up @@ -623,12 +635,14 @@ def sample_analyze_entities():

def analyze_entity_sentiment(
self,
request: Union[language_service.AnalyzeEntitySentimentRequest, dict] = None,
request: Optional[
Union[language_service.AnalyzeEntitySentimentRequest, dict]
] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeEntitySentimentResponse:
r"""Finds entities, similar to
Expand Down Expand Up @@ -733,12 +747,12 @@ def sample_analyze_entity_sentiment():

def analyze_syntax(
self,
request: Union[language_service.AnalyzeSyntaxRequest, dict] = None,
request: Optional[Union[language_service.AnalyzeSyntaxRequest, dict]] = None,
*,
document: language_service.Document = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnalyzeSyntaxResponse:
r"""Analyzes the syntax of the text and provides sentence
Expand Down Expand Up @@ -839,11 +853,11 @@ def sample_analyze_syntax():

def classify_text(
self,
request: Union[language_service.ClassifyTextRequest, dict] = None,
request: Optional[Union[language_service.ClassifyTextRequest, dict]] = None,
*,
document: language_service.Document = None,
document: Optional[language_service.Document] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.ClassifyTextResponse:
r"""Classifies a document into categories.
Expand Down Expand Up @@ -936,13 +950,13 @@ def sample_classify_text():

def annotate_text(
self,
request: Union[language_service.AnnotateTextRequest, dict] = None,
request: Optional[Union[language_service.AnnotateTextRequest, dict]] = None,
*,
document: language_service.Document = None,
features: language_service.AnnotateTextRequest.Features = None,
encoding_type: language_service.EncodingType = None,
document: Optional[language_service.Document] = None,
features: Optional[language_service.AnnotateTextRequest.Features] = None,
encoding_type: Optional[language_service.EncodingType] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
timeout: Optional[float] = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> language_service.AnnotateTextResponse:
r"""A convenience method that provides all the features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
self,
*,
host: str = DEFAULT_HOST,
credentials: ga_credentials.Credentials = None,
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
Expand Down
Loading

0 comments on commit 3ff2900

Please sign in to comment.