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

Commit

Permalink
feat: add from_service_account_info factory and fix sphinx identifiers (
Browse files Browse the repository at this point in the history
#66)

feat: add 'from_service_account_info' factory to clients
fix: fix sphinx identifiers
PiperOrigin-RevId: 350246057

Source-Author: Google APIs <noreply@google.com>
Source-Date: Tue Jan 5 16:44:11 2021 -0800
Source-Repo: googleapis/googleapis
Source-Sha: 520682435235d9c503983a360a2090025aa47cd1
Source-Link: googleapis/googleapis@5206824
  • Loading branch information
yoshi-automation authored Jan 6, 2021
1 parent 3476c0f commit cc8a180
Show file tree
Hide file tree
Showing 16 changed files with 328 additions and 243 deletions.
22 changes: 2 additions & 20 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 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
#
# https://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.

# Generated by synthtool. DO NOT EDIT!
[run]
branch = True
omit =
google/cloud/__init__.py

[report]
fail_under = 100
show_missing = True
omit = google/cloud/language/__init__.py
omit =
google/cloud/language/__init__.py
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
Expand Down
6 changes: 6 additions & 0 deletions docs/language_v1/language_service.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LanguageService
---------------------------------

.. automodule:: google.cloud.language_v1.services.language_service
:members:
:inherited-members:
6 changes: 3 additions & 3 deletions docs/language_v1/services.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Services for Google Cloud Language v1 API
=========================================
.. toctree::
:maxdepth: 2

.. automodule:: google.cloud.language_v1.services.language_service
:members:
:inherited-members:
language_service
1 change: 1 addition & 0 deletions docs/language_v1/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Types for Google Cloud Language v1 API

.. automodule:: google.cloud.language_v1.types
:members:
:undoc-members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/language_v1beta2/language_service.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LanguageService
---------------------------------

.. automodule:: google.cloud.language_v1beta2.services.language_service
:members:
:inherited-members:
6 changes: 3 additions & 3 deletions docs/language_v1beta2/services.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Services for Google Cloud Language v1beta2 API
==============================================
.. toctree::
:maxdepth: 2

.. automodule:: google.cloud.language_v1beta2.services.language_service
:members:
:inherited-members:
language_service
1 change: 1 addition & 0 deletions docs/language_v1beta2/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Types for Google Cloud Language v1beta2 API

.. automodule:: google.cloud.language_v1beta2.types
:members:
:undoc-members:
:show-inheritance:
54 changes: 30 additions & 24 deletions google/cloud/language_v1/services/language_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class LanguageServiceAsyncClient:
LanguageServiceClient.parse_common_location_path
)

from_service_account_info = LanguageServiceClient.from_service_account_info
from_service_account_file = LanguageServiceClient.from_service_account_file
from_service_account_json = from_service_account_file

Expand Down Expand Up @@ -151,17 +152,18 @@ async def analyze_sentiment(
r"""Analyzes the sentiment of the provided text.
Args:
request (:class:`~.language_service.AnalyzeSentimentRequest`):
request (:class:`google.cloud.language_v1.types.AnalyzeSentimentRequest`):
The request object. The sentiment analysis request
message.
document (:class:`~.language_service.Document`):
document (:class:`google.cloud.language_v1.types.Document`):
Input document.
This corresponds to the ``document`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
encoding_type (:class:`~.language_service.EncodingType`):
encoding_type (:class:`google.cloud.language_v1.types.EncodingType`):
The encoding type used by the API to
calculate sentence offsets.
This corresponds to the ``encoding_type`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand All @@ -173,7 +175,7 @@ async def analyze_sentiment(
sent along with the request as metadata.
Returns:
~.language_service.AnalyzeSentimentResponse:
google.cloud.language_v1.types.AnalyzeSentimentResponse:
The sentiment analysis response
message.
Expand Down Expand Up @@ -236,16 +238,17 @@ async def analyze_entities(
properties.
Args:
request (:class:`~.language_service.AnalyzeEntitiesRequest`):
request (:class:`google.cloud.language_v1.types.AnalyzeEntitiesRequest`):
The request object. The entity analysis request message.
document (:class:`~.language_service.Document`):
document (:class:`google.cloud.language_v1.types.Document`):
Input document.
This corresponds to the ``document`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
encoding_type (:class:`~.language_service.EncodingType`):
encoding_type (:class:`google.cloud.language_v1.types.EncodingType`):
The encoding type used by the API to
calculate offsets.
This corresponds to the ``encoding_type`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand All @@ -257,7 +260,7 @@ async def analyze_entities(
sent along with the request as metadata.
Returns:
~.language_service.AnalyzeEntitiesResponse:
google.cloud.language_v1.types.AnalyzeEntitiesResponse:
The entity analysis response message.
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -318,17 +321,18 @@ async def analyze_entity_sentiment(
and its mentions.
Args:
request (:class:`~.language_service.AnalyzeEntitySentimentRequest`):
request (:class:`google.cloud.language_v1.types.AnalyzeEntitySentimentRequest`):
The request object. The entity-level sentiment analysis
request message.
document (:class:`~.language_service.Document`):
document (:class:`google.cloud.language_v1.types.Document`):
Input document.
This corresponds to the ``document`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
encoding_type (:class:`~.language_service.EncodingType`):
encoding_type (:class:`google.cloud.language_v1.types.EncodingType`):
The encoding type used by the API to
calculate offsets.
This corresponds to the ``encoding_type`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand All @@ -340,7 +344,7 @@ async def analyze_entity_sentiment(
sent along with the request as metadata.
Returns:
~.language_service.AnalyzeEntitySentimentResponse:
google.cloud.language_v1.types.AnalyzeEntitySentimentResponse:
The entity-level sentiment analysis
response message.
Expand Down Expand Up @@ -402,16 +406,17 @@ async def analyze_syntax(
tags, dependency trees, and other properties.
Args:
request (:class:`~.language_service.AnalyzeSyntaxRequest`):
request (:class:`google.cloud.language_v1.types.AnalyzeSyntaxRequest`):
The request object. The syntax analysis request message.
document (:class:`~.language_service.Document`):
document (:class:`google.cloud.language_v1.types.Document`):
Input document.
This corresponds to the ``document`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
encoding_type (:class:`~.language_service.EncodingType`):
encoding_type (:class:`google.cloud.language_v1.types.EncodingType`):
The encoding type used by the API to
calculate offsets.
This corresponds to the ``encoding_type`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand All @@ -423,7 +428,7 @@ async def analyze_syntax(
sent along with the request as metadata.
Returns:
~.language_service.AnalyzeSyntaxResponse:
google.cloud.language_v1.types.AnalyzeSyntaxResponse:
The syntax analysis response message.
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -480,10 +485,10 @@ async def classify_text(
r"""Classifies a document into categories.
Args:
request (:class:`~.language_service.ClassifyTextRequest`):
request (:class:`google.cloud.language_v1.types.ClassifyTextRequest`):
The request object. The document classification request
message.
document (:class:`~.language_service.Document`):
document (:class:`google.cloud.language_v1.types.Document`):
Input document.
This corresponds to the ``document`` field
on the ``request`` instance; if ``request`` is provided, this
Expand All @@ -496,7 +501,7 @@ async def classify_text(
sent along with the request as metadata.
Returns:
~.language_service.ClassifyTextResponse:
google.cloud.language_v1.types.ClassifyTextResponse:
The document classification response
message.
Expand Down Expand Up @@ -557,23 +562,24 @@ async def annotate_text(
analyzeSyntax provide in one call.
Args:
request (:class:`~.language_service.AnnotateTextRequest`):
request (:class:`google.cloud.language_v1.types.AnnotateTextRequest`):
The request object. The request message for the text
annotation API, which can perform multiple analysis
types (sentiment, entities, and syntax) in one call.
document (:class:`~.language_service.Document`):
document (:class:`google.cloud.language_v1.types.Document`):
Input document.
This corresponds to the ``document`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
features (:class:`~.language_service.AnnotateTextRequest.Features`):
features (:class:`google.cloud.language_v1.types.AnnotateTextRequest.Features`):
The enabled features.
This corresponds to the ``features`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
encoding_type (:class:`~.language_service.EncodingType`):
encoding_type (:class:`google.cloud.language_v1.types.EncodingType`):
The encoding type used by the API to
calculate offsets.
This corresponds to the ``encoding_type`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand All @@ -585,7 +591,7 @@ async def annotate_text(
sent along with the request as metadata.
Returns:
~.language_service.AnnotateTextResponse:
google.cloud.language_v1.types.AnnotateTextResponse:
The text annotations response
message.
Expand Down
Loading

0 comments on commit cc8a180

Please sign in to comment.