Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.

Commit 7230ad1

Browse files
chore: use gapic-generator-python 0.56.2 (#162)
* chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: googleapis/googleapis@2921f9f Source-Link: https://github.com/googleapis/googleapis-gen/commit/6598ca8cbbf5226733a099c4506518a5af6ff74c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot 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 6f9965c commit 7230ad1

File tree

7 files changed

+68
-23
lines changed

7 files changed

+68
-23
lines changed

google/analytics/data_v1beta/services/beta_analytics_data/async_client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@
1919
from typing import Dict, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

22-
from google.api_core.client_options import ClientOptions # type: ignore
23-
from google.api_core import exceptions as core_exceptions # type: ignore
24-
from google.api_core import gapic_v1 # type: ignore
25-
from google.api_core import retry as retries # type: ignore
22+
from google.api_core.client_options import ClientOptions
23+
from google.api_core import exceptions as core_exceptions
24+
from google.api_core import gapic_v1
25+
from google.api_core import retry as retries
2626
from google.auth import credentials as ga_credentials # type: ignore
2727
from google.oauth2 import service_account # type: ignore
2828

29-
OptionalRetry = Union[retries.Retry, object]
29+
try:
30+
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
31+
except AttributeError: # pragma: NO COVER
32+
OptionalRetry = Union[retries.Retry, object] # type: ignore
3033

3134
from google.analytics.data_v1beta.types import analytics_data_api
3235
from google.analytics.data_v1beta.types import data

google/analytics/data_v1beta/services/beta_analytics_data/client.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,25 @@
1414
# limitations under the License.
1515
#
1616
from collections import OrderedDict
17-
from distutils import util
1817
import os
1918
import re
2019
from typing import Dict, Optional, Sequence, Tuple, Type, Union
2120
import pkg_resources
2221

23-
from google.api_core import client_options as client_options_lib # type: ignore
24-
from google.api_core import exceptions as core_exceptions # type: ignore
25-
from google.api_core import gapic_v1 # type: ignore
26-
from google.api_core import retry as retries # type: ignore
22+
from google.api_core import client_options as client_options_lib
23+
from google.api_core import exceptions as core_exceptions
24+
from google.api_core import gapic_v1
25+
from google.api_core import retry as retries
2726
from google.auth import credentials as ga_credentials # type: ignore
2827
from google.auth.transport import mtls # type: ignore
2928
from google.auth.transport.grpc import SslCredentials # type: ignore
3029
from google.auth.exceptions import MutualTLSChannelError # type: ignore
3130
from google.oauth2 import service_account # type: ignore
3231

33-
OptionalRetry = Union[retries.Retry, object]
32+
try:
33+
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
34+
except AttributeError: # pragma: NO COVER
35+
OptionalRetry = Union[retries.Retry, object] # type: ignore
3436

3537
from google.analytics.data_v1beta.types import analytics_data_api
3638
from google.analytics.data_v1beta.types import data
@@ -280,8 +282,15 @@ def __init__(
280282
client_options = client_options_lib.ClientOptions()
281283

282284
# Create SSL credentials for mutual TLS if needed.
283-
use_client_cert = bool(
284-
util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"))
285+
if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in (
286+
"true",
287+
"false",
288+
):
289+
raise ValueError(
290+
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
291+
)
292+
use_client_cert = (
293+
os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true"
285294
)
286295

287296
client_cert_source_func = None

google/analytics/data_v1beta/services/beta_analytics_data/transports/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
import pkg_resources
1919

2020
import google.auth # type: ignore
21-
import google.api_core # type: ignore
22-
from google.api_core import exceptions as core_exceptions # type: ignore
23-
from google.api_core import gapic_v1 # type: ignore
24-
from google.api_core import retry as retries # type: ignore
21+
import google.api_core
22+
from google.api_core import exceptions as core_exceptions
23+
from google.api_core import gapic_v1
24+
from google.api_core import retry as retries
2525
from google.auth import credentials as ga_credentials # type: ignore
2626
from google.oauth2 import service_account # type: ignore
2727

google/analytics/data_v1beta/services/beta_analytics_data/transports/grpc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import warnings
1717
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
1818

19-
from google.api_core import grpc_helpers # type: ignore
20-
from google.api_core import gapic_v1 # type: ignore
19+
from google.api_core import grpc_helpers
20+
from google.api_core import gapic_v1
2121
import google.auth # type: ignore
2222
from google.auth import credentials as ga_credentials # type: ignore
2323
from google.auth.transport.grpc import SslCredentials # type: ignore

google/analytics/data_v1beta/services/beta_analytics_data/transports/grpc_asyncio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import warnings
1717
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1818

19-
from google.api_core import gapic_v1 # type: ignore
20-
from google.api_core import grpc_helpers_async # type: ignore
19+
from google.api_core import gapic_v1
20+
from google.api_core import grpc_helpers_async
2121
from google.auth import credentials as ga_credentials # type: ignore
2222
from google.auth.transport.grpc import SslCredentials # type: ignore
2323

google/analytics/data_v1beta/types/data.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class MinuteRange(proto.Message):
145145
minutes of event data (``startMinutesAgo <= 29``), and 360
146146
Analytics properties can request up to the last 60 minutes
147147
of event data (``startMinutesAgo <= 59``).
148+
148149
This field is a member of `oneof`_ ``_start_minutes_ago``.
149150
end_minutes_ago (int):
150151
The inclusive end minute for the query as a number of
@@ -157,6 +158,7 @@ class MinuteRange(proto.Message):
157158
last 30 minutes of event data (``endMinutesAgo <= 29``), and
158159
360 Analytics properties can request any minute in the last
159160
60 minutes of event data (``endMinutesAgo <= 59``).
161+
160162
This field is a member of `oneof`_ ``_end_minutes_ago``.
161163
name (str):
162164
Assigns a name to this minute range. The dimension
@@ -226,15 +228,18 @@ class DimensionExpression(proto.Message):
226228
lower_case (google.analytics.data_v1beta.types.DimensionExpression.CaseExpression):
227229
Used to convert a dimension value to lower
228230
case.
231+
229232
This field is a member of `oneof`_ ``one_expression``.
230233
upper_case (google.analytics.data_v1beta.types.DimensionExpression.CaseExpression):
231234
Used to convert a dimension value to upper
232235
case.
236+
233237
This field is a member of `oneof`_ ``one_expression``.
234238
concatenate (google.analytics.data_v1beta.types.DimensionExpression.ConcatenateExpression):
235239
Used to combine dimension values to a single
236240
dimension. For example, dimension "country,
237241
city": concatenate(country, ", ", city).
242+
238243
This field is a member of `oneof`_ ``one_expression``.
239244
"""
240245

@@ -333,17 +338,21 @@ class FilterExpression(proto.Message):
333338
Attributes:
334339
and_group (google.analytics.data_v1beta.types.FilterExpressionList):
335340
The FilterExpressions in and_group have an AND relationship.
341+
336342
This field is a member of `oneof`_ ``expr``.
337343
or_group (google.analytics.data_v1beta.types.FilterExpressionList):
338344
The FilterExpressions in or_group have an OR relationship.
345+
339346
This field is a member of `oneof`_ ``expr``.
340347
not_expression (google.analytics.data_v1beta.types.FilterExpression):
341348
The FilterExpression is NOT of not_expression.
349+
342350
This field is a member of `oneof`_ ``expr``.
343351
filter (google.analytics.data_v1beta.types.Filter):
344352
A primitive filter.
345353
All fields in filter in same FilterExpression
346354
needs to be either all dimensions or metrics.
355+
347356
This field is a member of `oneof`_ ``expr``.
348357
"""
349358

@@ -388,15 +397,19 @@ class Filter(proto.Message):
388397
name defined in dimensions or metrics.
389398
string_filter (google.analytics.data_v1beta.types.Filter.StringFilter):
390399
Strings related filter.
400+
391401
This field is a member of `oneof`_ ``one_filter``.
392402
in_list_filter (google.analytics.data_v1beta.types.Filter.InListFilter):
393403
A filter for in list values.
404+
394405
This field is a member of `oneof`_ ``one_filter``.
395406
numeric_filter (google.analytics.data_v1beta.types.Filter.NumericFilter):
396407
A filter for numeric or date values.
408+
397409
This field is a member of `oneof`_ ``one_filter``.
398410
between_filter (google.analytics.data_v1beta.types.Filter.BetweenFilter):
399411
A filter for two values.
412+
400413
This field is a member of `oneof`_ ``one_filter``.
401414
"""
402415

@@ -508,13 +521,16 @@ class OrderBy(proto.Message):
508521
Attributes:
509522
metric (google.analytics.data_v1beta.types.OrderBy.MetricOrderBy):
510523
Sorts results by a metric's values.
524+
511525
This field is a member of `oneof`_ ``one_order_by``.
512526
dimension (google.analytics.data_v1beta.types.OrderBy.DimensionOrderBy):
513527
Sorts results by a dimension's values.
528+
514529
This field is a member of `oneof`_ ``one_order_by``.
515530
pivot (google.analytics.data_v1beta.types.OrderBy.PivotOrderBy):
516531
Sorts results by a metric's values within a
517532
pivot column group.
533+
518534
This field is a member of `oneof`_ ``one_order_by``.
519535
desc (bool):
520536
If true, sorts by descending order.
@@ -836,6 +852,7 @@ class ResponseMetaData(proto.Message):
836852
creating this report. To learn more, see `Access and
837853
data-restriction
838854
management <https://support.google.com/analytics/answer/10851388>`__.
855+
839856
This field is a member of `oneof`_ ``_schema_restriction_response``.
840857
currency_code (str):
841858
The currency code used in this report. Intended to be used
@@ -850,17 +867,20 @@ class ResponseMetaData(proto.Message):
850867
(https://en.wikipedia.org/wiki/ISO_4217); for example "USD",
851868
"EUR", "JPY". To learn more, see
852869
https://support.google.com/analytics/answer/9796179.
870+
853871
This field is a member of `oneof`_ ``_currency_code``.
854872
time_zone (str):
855873
The property's current timezone. Intended to be used to
856874
interpret time-based dimensions like ``hour`` and
857875
``minute``. Formatted as strings from the IANA Time Zone
858876
database (https://www.iana.org/time-zones); for example
859877
"America/New_York" or "Asia/Tokyo".
878+
860879
This field is a member of `oneof`_ ``_time_zone``.
861880
empty_reason (str):
862881
If empty reason is specified, the report is
863882
empty for this reason.
883+
864884
This field is a member of `oneof`_ ``_empty_reason``.
865885
"""
866886

@@ -884,6 +904,7 @@ class ActiveMetricRestriction(proto.Message):
884904
Attributes:
885905
metric_name (str):
886906
The name of the restricted metric.
907+
887908
This field is a member of `oneof`_ ``_metric_name``.
888909
restricted_metric_types (Sequence[google.analytics.data_v1beta.types.RestrictedMetricType]):
889910
The reason for this metric's restriction.
@@ -1036,6 +1057,7 @@ class DimensionValue(proto.Message):
10361057
value (str):
10371058
Value as a string if the dimension type is a
10381059
string.
1060+
10391061
This field is a member of `oneof`_ ``one_value``.
10401062
"""
10411063

@@ -1050,6 +1072,7 @@ class MetricValue(proto.Message):
10501072
Attributes:
10511073
value (str):
10521074
Measurement value. See MetricHeader for type.
1075+
10531076
This field is a member of `oneof`_ ``one_value``.
10541077
"""
10551078

@@ -1069,9 +1092,11 @@ class NumericValue(proto.Message):
10691092
Attributes:
10701093
int64_value (int):
10711094
Integer value
1095+
10721096
This field is a member of `oneof`_ ``one_value``.
10731097
double_value (float):
10741098
Double value
1099+
10751100
This field is a member of `oneof`_ ``one_value``.
10761101
"""
10771102

@@ -1249,11 +1274,13 @@ class DimensionCompatibility(proto.Message):
12491274
for this compatibility information. The
12501275
dimension metadata also contains other helpful
12511276
information like the UI name and description.
1277+
12521278
This field is a member of `oneof`_ ``_dimension_metadata``.
12531279
compatibility (google.analytics.data_v1beta.types.Compatibility):
12541280
The compatibility of this dimension. If the
12551281
compatibility is COMPATIBLE, this dimension can
12561282
be successfully added to the report.
1283+
12571284
This field is a member of `oneof`_ ``_compatibility``.
12581285
"""
12591286

@@ -1274,11 +1301,13 @@ class MetricCompatibility(proto.Message):
12741301
this compatibility information. The metric
12751302
metadata also contains other helpful information
12761303
like the UI name and description.
1304+
12771305
This field is a member of `oneof`_ ``_metric_metadata``.
12781306
compatibility (google.analytics.data_v1beta.types.Compatibility):
12791307
The compatibility of this metric. If the
12801308
compatibility is COMPATIBLE, this metric can be
12811309
successfully added to the report.
1310+
12821311
This field is a member of `oneof`_ ``_compatibility``.
12831312
"""
12841313

tests/unit/gapic/data_v1beta/test_beta_analytics_data.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,9 @@ def test_get_metadata_flattened():
12101210
# request object values.
12111211
assert len(call.mock_calls) == 1
12121212
_, args, _ = call.mock_calls[0]
1213-
assert args[0].name == "name_value"
1213+
arg = args[0].name
1214+
mock_val = "name_value"
1215+
assert arg == mock_val
12141216

12151217

12161218
def test_get_metadata_flattened_error():
@@ -1246,7 +1248,9 @@ async def test_get_metadata_flattened_async():
12461248
# request object values.
12471249
assert len(call.mock_calls)
12481250
_, args, _ = call.mock_calls[0]
1249-
assert args[0].name == "name_value"
1251+
arg = args[0].name
1252+
mock_val = "name_value"
1253+
assert arg == mock_val
12501254

12511255

12521256
@pytest.mark.asyncio

0 commit comments

Comments
 (0)