Skip to content

Commit 0828dea

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#283)
* 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: googleapis/googleapis-gen@387b734 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 a9f270b commit 0828dea

File tree

12 files changed

+74
-71
lines changed

12 files changed

+74
-71
lines changed

packages/google-cloud-trace/.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__ = "1.7.3" # {x-release-please-version}

packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/async_client.py

Lines changed: 8 additions & 12 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.trace_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 list_traces(
219220
*,
220221
project_id: Optional[str] = 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
) -> pagers.ListTracesAsyncPager:
225226
r"""Returns of a list of traces that match the specified
@@ -348,7 +349,7 @@ async def get_trace(
348349
project_id: Optional[str] = None,
349350
trace_id: Optional[str] = None,
350351
retry: OptionalRetry = gapic_v1.method.DEFAULT,
351-
timeout: Optional[float] = None,
352+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
352353
metadata: Sequence[Tuple[str, str]] = (),
353354
) -> trace.Trace:
354355
r"""Gets a single trace by its ID.
@@ -477,7 +478,7 @@ async def patch_traces(
477478
project_id: Optional[str] = None,
478479
traces: Optional[trace.Traces] = None,
479480
retry: OptionalRetry = gapic_v1.method.DEFAULT,
480-
timeout: Optional[float] = None,
481+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
481482
metadata: Sequence[Tuple[str, str]] = (),
482483
) -> None:
483484
r"""Sends new traces to Stackdriver Trace or updates
@@ -593,14 +594,9 @@ async def __aexit__(self, exc_type, exc, tb):
593594
await self.transport.close()
594595

595596

596-
try:
597-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
598-
gapic_version=pkg_resources.get_distribution(
599-
"google-cloud-trace",
600-
).version,
601-
)
602-
except pkg_resources.DistributionNotFound:
603-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
597+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
598+
gapic_version=package_version.__version__
599+
)
604600

605601

606602
__all__ = ("TraceServiceAsyncClient",)

packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/client.py

Lines changed: 8 additions & 12 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.trace_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -428,7 +429,7 @@ def list_traces(
428429
*,
429430
project_id: Optional[str] = None,
430431
retry: OptionalRetry = gapic_v1.method.DEFAULT,
431-
timeout: Optional[float] = None,
432+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
432433
metadata: Sequence[Tuple[str, str]] = (),
433434
) -> pagers.ListTracesPager:
434435
r"""Returns of a list of traces that match the specified
@@ -547,7 +548,7 @@ def get_trace(
547548
project_id: Optional[str] = None,
548549
trace_id: Optional[str] = None,
549550
retry: OptionalRetry = gapic_v1.method.DEFAULT,
550-
timeout: Optional[float] = None,
551+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
551552
metadata: Sequence[Tuple[str, str]] = (),
552553
) -> trace.Trace:
553554
r"""Gets a single trace by its ID.
@@ -666,7 +667,7 @@ def patch_traces(
666667
project_id: Optional[str] = None,
667668
traces: Optional[trace.Traces] = None,
668669
retry: OptionalRetry = gapic_v1.method.DEFAULT,
669-
timeout: Optional[float] = None,
670+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
670671
metadata: Sequence[Tuple[str, str]] = (),
671672
) -> None:
672673
r"""Sends new traces to Stackdriver Trace or updates
@@ -779,14 +780,9 @@ def __exit__(self, type, value, traceback):
779780
self.transport.close()
780781

781782

782-
try:
783-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
784-
gapic_version=pkg_resources.get_distribution(
785-
"google-cloud-trace",
786-
).version,
787-
)
788-
except pkg_resources.DistributionNotFound:
789-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
783+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
784+
gapic_version=package_version.__version__
785+
)
790786

791787

792788
__all__ = ("TraceServiceClient",)

packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.oauth2 import service_account # type: ignore
2626
from google.protobuf import empty_pb2 # type: ignore
27-
import pkg_resources
2827

28+
from google.cloud.trace_v1 import gapic_version as package_version
2929
from google.cloud.trace_v1.types import trace
3030

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

4035

4136
class TraceServiceTransport(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__ = "1.7.3" # {x-release-please-version}

packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/async_client.py

Lines changed: 7 additions & 11 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.trace_v2 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -225,7 +226,7 @@ async def batch_write_spans(
225226
name: Optional[str] = None,
226227
spans: Optional[MutableSequence[trace.Span]] = None,
227228
retry: OptionalRetry = gapic_v1.method.DEFAULT,
228-
timeout: Optional[float] = None,
229+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
229230
metadata: Sequence[Tuple[str, str]] = (),
230231
) -> None:
231232
r"""Sends new spans to new or existing traces. You cannot
@@ -330,7 +331,7 @@ async def create_span(
330331
request: Optional[Union[trace.Span, dict]] = None,
331332
*,
332333
retry: OptionalRetry = gapic_v1.method.DEFAULT,
333-
timeout: Optional[float] = None,
334+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
334335
metadata: Sequence[Tuple[str, str]] = (),
335336
) -> trace.Span:
336337
r"""Creates a new span.
@@ -437,14 +438,9 @@ async def __aexit__(self, exc_type, exc, tb):
437438
await self.transport.close()
438439

439440

440-
try:
441-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
442-
gapic_version=pkg_resources.get_distribution(
443-
"google-cloud-trace",
444-
).version,
445-
)
446-
except pkg_resources.DistributionNotFound:
447-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
441+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
442+
gapic_version=package_version.__version__
443+
)
448444

449445

450446
__all__ = ("TraceServiceAsyncClient",)

packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/client.py

Lines changed: 7 additions & 11 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.trace_v2 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -454,7 +455,7 @@ def batch_write_spans(
454455
name: Optional[str] = None,
455456
spans: Optional[MutableSequence[trace.Span]] = None,
456457
retry: OptionalRetry = gapic_v1.method.DEFAULT,
457-
timeout: Optional[float] = None,
458+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
458459
metadata: Sequence[Tuple[str, str]] = (),
459460
) -> None:
460461
r"""Sends new spans to new or existing traces. You cannot
@@ -559,7 +560,7 @@ def create_span(
559560
request: Optional[Union[trace.Span, dict]] = None,
560561
*,
561562
retry: OptionalRetry = gapic_v1.method.DEFAULT,
562-
timeout: Optional[float] = None,
563+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
563564
metadata: Sequence[Tuple[str, str]] = (),
564565
) -> trace.Span:
565566
r"""Creates a new span.
@@ -664,14 +665,9 @@ def __exit__(self, type, value, traceback):
664665
self.transport.close()
665666

666667

667-
try:
668-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
669-
gapic_version=pkg_resources.get_distribution(
670-
"google-cloud-trace",
671-
).version,
672-
)
673-
except pkg_resources.DistributionNotFound:
674-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
668+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
669+
gapic_version=package_version.__version__
670+
)
675671

676672

677673
__all__ = ("TraceServiceClient",)

packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.oauth2 import service_account # type: ignore
2626
from google.protobuf import empty_pb2 # type: ignore
27-
import pkg_resources
2827

28+
from google.cloud.trace_v2 import gapic_version as package_version
2929
from google.cloud.trace_v2.types import trace, tracing
3030

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

4035

4136
class TraceServiceTransport(abc.ABC):

packages/google-cloud-trace/release-please-config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
".": {
55
"release-type": "python",
66
"extra-files": [
7+
"google/cloud/trace_v2/gapic_version.py",
8+
"google/cloud/trace_v1/gapic_version.py",
79
"google/cloud/trace/gapic_version.py",
810
{
911
"type": "json",

0 commit comments

Comments
 (0)