Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#151)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

docs: list oneofs in docstring
fix(deps): require google-api-core >= 1.28.0
fix(deps): drop packaging dependency

committer: busunkim96@
PiperOrigin-RevId: 406468269

Source-Link: googleapis/googleapis@83d81b0

Source-Link: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Nov 1, 2021
1 parent 121c68e commit a91ba9f
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.trace_v1.services.trace_service import pagers
from google.cloud.trace_v1.types import trace
from .transports.base import TraceServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -163,18 +165,18 @@ def __init__(

async def list_traces(
self,
request: trace.ListTracesRequest = None,
request: Union[trace.ListTracesRequest, dict] = None,
*,
project_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListTracesAsyncPager:
r"""Returns of a list of traces that match the specified
filter conditions.
Args:
request (:class:`google.cloud.trace_v1.types.ListTracesRequest`):
request (Union[google.cloud.trace_v1.types.ListTracesRequest, dict]):
The request object. The request message for the
`ListTraces` method. All fields are required unless
specified.
Expand Down Expand Up @@ -248,18 +250,18 @@ async def list_traces(

async def get_trace(
self,
request: trace.GetTraceRequest = None,
request: Union[trace.GetTraceRequest, dict] = None,
*,
project_id: str = None,
trace_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> trace.Trace:
r"""Gets a single trace by its ID.
Args:
request (:class:`google.cloud.trace_v1.types.GetTraceRequest`):
request (Union[google.cloud.trace_v1.types.GetTraceRequest, dict]):
The request object. The request message for the
`GetTrace` method.
project_id (:class:`str`):
Expand Down Expand Up @@ -334,11 +336,11 @@ async def get_trace(

async def patch_traces(
self,
request: trace.PatchTracesRequest = None,
request: Union[trace.PatchTracesRequest, dict] = None,
*,
project_id: str = None,
traces: trace.Traces = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand All @@ -351,7 +353,7 @@ async def patch_traces(
a new trace is created.
Args:
request (:class:`google.cloud.trace_v1.types.PatchTracesRequest`):
request (Union[google.cloud.trace_v1.types.PatchTracesRequest, dict]):
The request object. The request message for the
`PatchTraces` method.
project_id (:class:`str`):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.trace_v1.services.trace_service import pagers
from google.cloud.trace_v1.types import trace
from .transports.base import TraceServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -340,7 +342,7 @@ def list_traces(
request: Union[trace.ListTracesRequest, dict] = None,
*,
project_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListTracesPager:
Expand Down Expand Up @@ -416,7 +418,7 @@ def get_trace(
*,
project_id: str = None,
trace_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> trace.Trace:
Expand Down Expand Up @@ -492,7 +494,7 @@ def patch_traces(
*,
project_id: str = None,
traces: trace.Traces = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand All @@ -36,15 +35,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class TraceServiceTransport(abc.ABC):
"""Abstract transport class for TraceService."""
Expand Down Expand Up @@ -98,7 +88,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -131,29 +121,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from google.api_core import grpc_helpers_async # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.trace_v2.types import trace
from google.cloud.trace_v2.types import tracing
from google.protobuf import timestamp_pb2 # type: ignore
Expand Down Expand Up @@ -168,19 +170,19 @@ def __init__(

async def batch_write_spans(
self,
request: tracing.BatchWriteSpansRequest = None,
request: Union[tracing.BatchWriteSpansRequest, dict] = None,
*,
name: str = None,
spans: Sequence[trace.Span] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Sends new spans to new or existing traces. You cannot
update existing spans.
Args:
request (:class:`google.cloud.trace_v2.types.BatchWriteSpansRequest`):
request (Union[google.cloud.trace_v2.types.BatchWriteSpansRequest, dict]):
The request object. The request message for the
`BatchWriteSpans` method.
name (:class:`str`):
Expand Down Expand Up @@ -244,16 +246,16 @@ async def batch_write_spans(

async def create_span(
self,
request: trace.Span = None,
request: Union[trace.Span, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> trace.Span:
r"""Creates a new span.
Args:
request (:class:`google.cloud.trace_v2.types.Span`):
request (Union[google.cloud.trace_v2.types.Span, dict]):
The request object. A span represents a single operation
within a trace. Spans can be nested to form a trace
tree. Often, a trace contains a root span that describes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.trace_v2.types import trace
from google.cloud.trace_v2.types import tracing
from google.protobuf import timestamp_pb2 # type: ignore
Expand Down Expand Up @@ -360,7 +362,7 @@ def batch_write_spans(
*,
name: str = None,
spans: Sequence[trace.Span] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down Expand Up @@ -434,7 +436,7 @@ def create_span(
self,
request: Union[trace.Span, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> trace.Span:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand All @@ -37,15 +36,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class TraceServiceTransport(abc.ABC):
"""Abstract transport class for TraceService."""
Expand Down Expand Up @@ -98,7 +88,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -131,29 +121,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from google.api_core import grpc_helpers_async # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down
19 changes: 19 additions & 0 deletions packages/google-cloud-trace/google/cloud/trace_v2/types/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,24 @@ class Attributes(proto.Message):
class TimeEvent(proto.Message):
r"""A time-stamped annotation or message event in the Span.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
time (google.protobuf.timestamp_pb2.Timestamp):
The timestamp indicating the time the event
occurred.
annotation (google.cloud.trace_v2.types.Span.TimeEvent.Annotation):
Text annotation with a set of attributes.
This field is a member of `oneof`_ ``value``.
message_event (google.cloud.trace_v2.types.Span.TimeEvent.MessageEvent):
An event describing a message sent/received
between Spans.
This field is a member of `oneof`_ ``value``.
"""

class Annotation(proto.Message):
Expand Down Expand Up @@ -326,13 +335,23 @@ class Links(proto.Message):
class AttributeValue(proto.Message):
r"""The allowed types for [VALUE] in a ``[KEY]:[VALUE]`` attribute.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
string_value (google.cloud.trace_v2.types.TruncatableString):
A string up to 256 bytes long.
This field is a member of `oneof`_ ``value``.
int_value (int):
A 64-bit signed integer.
This field is a member of `oneof`_ ``value``.
bool_value (bool):
A Boolean value represented by ``true`` or ``false``.
This field is a member of `oneof`_ ``value``.
"""

string_value = proto.Field(
Expand Down
Loading

0 comments on commit a91ba9f

Please sign in to comment.