Skip to content

Commit d15fdda

Browse files
chore: Use gapic-generator-python 0.65.0 (#227)
* chore: Use gapic-generator-python 0.65.0 PiperOrigin-RevId: 440970084 Source-Link: googleapis/googleapis@5e0a3d5 Source-Link: googleapis/googleapis-gen@b0c628a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent ac7e6c5 commit d15fdda

File tree

5 files changed

+73
-33
lines changed

5 files changed

+73
-33
lines changed

packages/google-analytics-data/google/analytics/data_v1beta/services/beta_analytics_data/async_client.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import functools
1818
import re
19-
from typing import Dict, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

2222
from google.api_core.client_options import ClientOptions
@@ -220,7 +220,6 @@ async def run_report(
220220
Dimensions break down metrics across some common
221221
criteria, such as country or event name.
222222
223-
224223
.. code-block:: python
225224
226225
from google.analytics import data_v1beta
@@ -297,7 +296,6 @@ async def run_pivot_report(
297296
in a pivot. Multiple pivots can be specified to further
298297
dissect your data.
299298
300-
301299
.. code-block:: python
302300
303301
from google.analytics import data_v1beta
@@ -371,7 +369,6 @@ async def batch_run_reports(
371369
r"""Returns multiple reports in a batch. All reports must
372370
be for the same GA4 Property.
373371
374-
375372
.. code-block:: python
376373
377374
from google.analytics import data_v1beta
@@ -445,7 +442,6 @@ async def batch_run_pivot_reports(
445442
r"""Returns multiple pivot reports in a batch. All
446443
reports must be for the same GA4 Property.
447444
448-
449445
.. code-block:: python
450446
451447
from google.analytics import data_v1beta
@@ -529,7 +525,6 @@ async def get_metadata(
529525
metadata are dimensions and metrics applicable to any property
530526
such as ``country`` and ``totalUsers``.
531527
532-
533528
.. code-block:: python
534529
535530
from google.analytics import data_v1beta
@@ -637,7 +632,6 @@ async def run_realtime_report(
637632
property. These reports show events and usage from the
638633
last 30 minutes.
639634
640-
641635
.. code-block:: python
642636
643637
from google.analytics import data_v1beta
@@ -720,7 +714,6 @@ async def check_compatibility(
720714
compatibility rules. This method checks compatibility
721715
for Core reports.
722716
723-
724717
.. code-block:: python
725718
726719
from google.analytics import data_v1beta

packages/google-analytics-data/google/analytics/data_v1beta/services/beta_analytics_data/client.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import os
1818
import re
19-
from typing import Dict, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

2222
from google.api_core import client_options as client_options_lib
@@ -437,7 +437,6 @@ def run_report(
437437
Dimensions break down metrics across some common
438438
criteria, such as country or event name.
439439
440-
441440
.. code-block:: python
442441
443442
from google.analytics import data_v1beta
@@ -515,7 +514,6 @@ def run_pivot_report(
515514
in a pivot. Multiple pivots can be specified to further
516515
dissect your data.
517516
518-
519517
.. code-block:: python
520518
521519
from google.analytics import data_v1beta
@@ -590,7 +588,6 @@ def batch_run_reports(
590588
r"""Returns multiple reports in a batch. All reports must
591589
be for the same GA4 Property.
592590
593-
594591
.. code-block:: python
595592
596593
from google.analytics import data_v1beta
@@ -665,7 +662,6 @@ def batch_run_pivot_reports(
665662
r"""Returns multiple pivot reports in a batch. All
666663
reports must be for the same GA4 Property.
667664
668-
669665
.. code-block:: python
670666
671667
from google.analytics import data_v1beta
@@ -750,7 +746,6 @@ def get_metadata(
750746
metadata are dimensions and metrics applicable to any property
751747
such as ``country`` and ``totalUsers``.
752748
753-
754749
.. code-block:: python
755750
756751
from google.analytics import data_v1beta
@@ -858,7 +853,6 @@ def run_realtime_report(
858853
property. These reports show events and usage from the
859854
last 30 minutes.
860855
861-
862856
.. code-block:: python
863857
864858
from google.analytics import data_v1beta
@@ -942,7 +936,6 @@ def check_compatibility(
942936
compatibility rules. This method checks compatibility
943937
for Core reports.
944938
945-
946939
.. code-block:: python
947940
948941
from google.analytics import data_v1beta

packages/google-analytics-data/google/analytics/data_v1beta/services/beta_analytics_data/transports/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def __init__(
8383
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
8484
be used for service account credentials.
8585
"""
86+
8687
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
8788
if ":" not in host:
8889
host += ":443"
@@ -250,5 +251,9 @@ def check_compatibility(
250251
]:
251252
raise NotImplementedError()
252253

254+
@property
255+
def kind(self) -> str:
256+
raise NotImplementedError()
257+
253258

254259
__all__ = ("BetaAnalyticsDataTransport",)

packages/google-analytics-data/google/analytics/data_v1beta/services/beta_analytics_data/transports/grpc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,5 +467,9 @@ def check_compatibility(
467467
def close(self):
468468
self.grpc_channel.close()
469469

470+
@property
471+
def kind(self) -> str:
472+
return "grpc"
473+
470474

471475
__all__ = ("BetaAnalyticsDataGrpcTransport",)

packages/google-analytics-data/tests/unit/gapic/data_v1beta/test_beta_analytics_data.py

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,26 @@ def test__get_default_mtls_endpoint():
9090

9191

9292
@pytest.mark.parametrize(
93-
"client_class",
93+
"client_class,transport_name",
9494
[
95-
BetaAnalyticsDataClient,
96-
BetaAnalyticsDataAsyncClient,
95+
(BetaAnalyticsDataClient, "grpc"),
96+
(BetaAnalyticsDataAsyncClient, "grpc_asyncio"),
9797
],
9898
)
99-
def test_beta_analytics_data_client_from_service_account_info(client_class):
99+
def test_beta_analytics_data_client_from_service_account_info(
100+
client_class, transport_name
101+
):
100102
creds = ga_credentials.AnonymousCredentials()
101103
with mock.patch.object(
102104
service_account.Credentials, "from_service_account_info"
103105
) as factory:
104106
factory.return_value = creds
105107
info = {"valid": True}
106-
client = client_class.from_service_account_info(info)
108+
client = client_class.from_service_account_info(info, transport=transport_name)
107109
assert client.transport._credentials == creds
108110
assert isinstance(client, client_class)
109111

110-
assert client.transport._host == "analyticsdata.googleapis.com:443"
112+
assert client.transport._host == ("analyticsdata.googleapis.com:443")
111113

112114

113115
@pytest.mark.parametrize(
@@ -136,27 +138,33 @@ def test_beta_analytics_data_client_service_account_always_use_jwt(
136138

137139

138140
@pytest.mark.parametrize(
139-
"client_class",
141+
"client_class,transport_name",
140142
[
141-
BetaAnalyticsDataClient,
142-
BetaAnalyticsDataAsyncClient,
143+
(BetaAnalyticsDataClient, "grpc"),
144+
(BetaAnalyticsDataAsyncClient, "grpc_asyncio"),
143145
],
144146
)
145-
def test_beta_analytics_data_client_from_service_account_file(client_class):
147+
def test_beta_analytics_data_client_from_service_account_file(
148+
client_class, transport_name
149+
):
146150
creds = ga_credentials.AnonymousCredentials()
147151
with mock.patch.object(
148152
service_account.Credentials, "from_service_account_file"
149153
) as factory:
150154
factory.return_value = creds
151-
client = client_class.from_service_account_file("dummy/file/path.json")
155+
client = client_class.from_service_account_file(
156+
"dummy/file/path.json", transport=transport_name
157+
)
152158
assert client.transport._credentials == creds
153159
assert isinstance(client, client_class)
154160

155-
client = client_class.from_service_account_json("dummy/file/path.json")
161+
client = client_class.from_service_account_json(
162+
"dummy/file/path.json", transport=transport_name
163+
)
156164
assert client.transport._credentials == creds
157165
assert isinstance(client, client_class)
158166

159-
assert client.transport._host == "analyticsdata.googleapis.com:443"
167+
assert client.transport._host == ("analyticsdata.googleapis.com:443")
160168

161169

162170
def test_beta_analytics_data_client_get_transport_class():
@@ -1929,6 +1937,19 @@ def test_transport_adc(transport_class):
19291937
adc.assert_called_once()
19301938

19311939

1940+
@pytest.mark.parametrize(
1941+
"transport_name",
1942+
[
1943+
"grpc",
1944+
],
1945+
)
1946+
def test_transport_kind(transport_name):
1947+
transport = BetaAnalyticsDataClient.get_transport_class(transport_name)(
1948+
credentials=ga_credentials.AnonymousCredentials(),
1949+
)
1950+
assert transport.kind == transport_name
1951+
1952+
19321953
def test_transport_grpc_default():
19331954
# A client should use the gRPC transport by default.
19341955
client = BetaAnalyticsDataClient(
@@ -1977,6 +1998,14 @@ def test_beta_analytics_data_base_transport():
19771998
with pytest.raises(NotImplementedError):
19781999
transport.close()
19792000

2001+
# Catch all for all remaining methods and properties
2002+
remainder = [
2003+
"kind",
2004+
]
2005+
for r in remainder:
2006+
with pytest.raises(NotImplementedError):
2007+
getattr(transport, r)()
2008+
19802009

19812010
def test_beta_analytics_data_base_transport_with_credentials_file():
19822011
# Instantiate the base transport with a credentials file
@@ -2136,24 +2165,40 @@ def test_beta_analytics_data_grpc_transport_client_cert_source_for_mtls(
21362165
)
21372166

21382167

2139-
def test_beta_analytics_data_host_no_port():
2168+
@pytest.mark.parametrize(
2169+
"transport_name",
2170+
[
2171+
"grpc",
2172+
"grpc_asyncio",
2173+
],
2174+
)
2175+
def test_beta_analytics_data_host_no_port(transport_name):
21402176
client = BetaAnalyticsDataClient(
21412177
credentials=ga_credentials.AnonymousCredentials(),
21422178
client_options=client_options.ClientOptions(
21432179
api_endpoint="analyticsdata.googleapis.com"
21442180
),
2181+
transport=transport_name,
21452182
)
2146-
assert client.transport._host == "analyticsdata.googleapis.com:443"
2183+
assert client.transport._host == ("analyticsdata.googleapis.com:443")
21472184

21482185

2149-
def test_beta_analytics_data_host_with_port():
2186+
@pytest.mark.parametrize(
2187+
"transport_name",
2188+
[
2189+
"grpc",
2190+
"grpc_asyncio",
2191+
],
2192+
)
2193+
def test_beta_analytics_data_host_with_port(transport_name):
21502194
client = BetaAnalyticsDataClient(
21512195
credentials=ga_credentials.AnonymousCredentials(),
21522196
client_options=client_options.ClientOptions(
21532197
api_endpoint="analyticsdata.googleapis.com:8000"
21542198
),
2199+
transport=transport_name,
21552200
)
2156-
assert client.transport._host == "analyticsdata.googleapis.com:8000"
2201+
assert client.transport._host == ("analyticsdata.googleapis.com:8000")
21572202

21582203

21592204
def test_beta_analytics_data_grpc_transport_channel():

0 commit comments

Comments
 (0)