Skip to content

Commit 4d2c35a

Browse files
fix: Add async context manager return types (#11448)
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 3885820 commit 4d2c35a

File tree

842 files changed

+91846
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

842 files changed

+91846
-347
lines changed

packages/google-cloud-migrationcenter/google/cloud/migrationcenter/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-migrationcenter/google/cloud/migrationcenter_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-migrationcenter/google/cloud/migrationcenter_v1/services/migration_center/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6158,7 +6158,7 @@ async def list_locations(
61586158
# Done; return the response.
61596159
return response
61606160

6161-
async def __aenter__(self):
6161+
async def __aenter__(self) -> "MigrationCenterAsyncClient":
61626162
return self
61636163

61646164
async def __aexit__(self, exc_type, exc, tb):

packages/google-cloud-migrationcenter/google/cloud/migrationcenter_v1/services/migration_center/transports/rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6870,7 +6870,7 @@ def __call__(
68706870
request_kwargs = json_format.MessageToDict(request)
68716871
transcoded_request = path_template.transcode(http_options, **request_kwargs)
68726872

6873-
body = json.loads(json.dumps(transcoded_request["body"]))
6873+
body = json.dumps(transcoded_request["body"])
68746874
uri = transcoded_request["uri"]
68756875
method = transcoded_request["method"]
68766876

packages/google-cloud-migrationcenter/google/cloud/migrationcenter_v1/types/migrationcenter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5467,7 +5467,7 @@ class Aggregation(proto.Message):
54675467
Count the number of matching objects.
54685468
54695469
This field is a member of `oneof`_ ``aggregation_function``.
5470-
sum_ (google.cloud.migrationcenter_v1.types.Aggregation.Sum):
5470+
sum (google.cloud.migrationcenter_v1.types.Aggregation.Sum):
54715471
Sum over a numeric field.
54725472
54735473
This field is a member of `oneof`_ ``aggregation_function``.
@@ -5521,7 +5521,7 @@ class Frequency(proto.Message):
55215521
oneof="aggregation_function",
55225522
message=Count,
55235523
)
5524-
sum_: Sum = proto.Field(
5524+
sum: Sum = proto.Field(
55255525
proto.MESSAGE,
55265526
number=3,
55275527
oneof="aggregation_function",
@@ -5557,7 +5557,7 @@ class AggregationResult(proto.Message):
55575557
count (google.cloud.migrationcenter_v1.types.AggregationResult.Count):
55585558
55595559
This field is a member of `oneof`_ ``result``.
5560-
sum_ (google.cloud.migrationcenter_v1.types.AggregationResult.Sum):
5560+
sum (google.cloud.migrationcenter_v1.types.AggregationResult.Sum):
55615561
55625562
This field is a member of `oneof`_ ``result``.
55635563
histogram (google.cloud.migrationcenter_v1.types.AggregationResult.Histogram):
@@ -5666,7 +5666,7 @@ class Frequency(proto.Message):
56665666
oneof="result",
56675667
message=Count,
56685668
)
5669-
sum_: Sum = proto.Field(
5669+
sum: Sum = proto.Field(
56705670
proto.MESSAGE,
56715671
number=3,
56725672
oneof="result",

packages/google-cloud-migrationcenter/noxfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,9 @@ def docfx(session):
305305

306306
session.install("-e", ".")
307307
session.install(
308-
"sphinx==4.0.1",
308+
"gcp-sphinx-docfx-yaml",
309309
"alabaster",
310310
"recommonmark",
311-
"gcp-sphinx-docfx-yaml",
312311
)
313312

314313
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)

packages/google-cloud-migrationcenter/tests/unit/gapic/migrationcenter_v1/test_migration_center.py

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,9 +1158,11 @@ async def test_list_assets_async_pages():
11581158
RuntimeError,
11591159
)
11601160
pages = []
1161-
async for page_ in (
1161+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1162+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1163+
async for page_ in ( # pragma: no branch
11621164
await client.list_assets(request={})
1163-
).pages: # pragma: no branch
1165+
).pages:
11641166
pages.append(page_)
11651167
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
11661168
assert page_.raw_page.next_page_token == token
@@ -1190,7 +1192,6 @@ def test_get_asset(request_type, transport: str = "grpc"):
11901192
name="name_value",
11911193
sources=["sources_value"],
11921194
assigned_groups=["assigned_groups_value"],
1193-
machine_details=migrationcenter.MachineDetails(uuid="uuid_value"),
11941195
)
11951196
response = client.get_asset(request)
11961197

@@ -1431,7 +1432,6 @@ def test_update_asset(request_type, transport: str = "grpc"):
14311432
name="name_value",
14321433
sources=["sources_value"],
14331434
assigned_groups=["assigned_groups_value"],
1434-
machine_details=migrationcenter.MachineDetails(uuid="uuid_value"),
14351435
)
14361436
response = client.update_asset(request)
14371437

@@ -3384,9 +3384,11 @@ async def test_list_import_jobs_async_pages():
33843384
RuntimeError,
33853385
)
33863386
pages = []
3387-
async for page_ in (
3387+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
3388+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
3389+
async for page_ in ( # pragma: no branch
33883390
await client.list_import_jobs(request={})
3389-
).pages: # pragma: no branch
3391+
).pages:
33903392
pages.append(page_)
33913393
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
33923394
assert page_.raw_page.next_page_token == token
@@ -3417,11 +3419,6 @@ def test_get_import_job(request_type, transport: str = "grpc"):
34173419
display_name="display_name_value",
34183420
state=migrationcenter.ImportJob.ImportJobState.IMPORT_JOB_STATE_PENDING,
34193421
asset_source="asset_source_value",
3420-
validation_report=migrationcenter.ValidationReport(
3421-
file_validations=[
3422-
migrationcenter.FileValidationReport(file_name="file_name_value")
3423-
]
3424-
),
34253422
)
34263423
response = client.get_import_job(request)
34273424

@@ -4631,9 +4628,6 @@ def test_get_import_data_file(request_type, transport: str = "grpc"):
46314628
display_name="display_name_value",
46324629
format_=migrationcenter.ImportJobFormat.IMPORT_JOB_FORMAT_RVTOOLS_XLSX,
46334630
state=migrationcenter.ImportDataFile.State.CREATING,
4634-
upload_file_info=migrationcenter.UploadFileInfo(
4635-
signed_uri="signed_uri_value"
4636-
),
46374631
)
46384632
response = client.get_import_data_file(request)
46394633

@@ -5311,9 +5305,11 @@ async def test_list_import_data_files_async_pages():
53115305
RuntimeError,
53125306
)
53135307
pages = []
5314-
async for page_ in (
5308+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
5309+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
5310+
async for page_ in ( # pragma: no branch
53155311
await client.list_import_data_files(request={})
5316-
).pages: # pragma: no branch
5312+
).pages:
53175313
pages.append(page_)
53185314
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
53195315
assert page_.raw_page.next_page_token == token
@@ -6237,9 +6233,11 @@ async def test_list_groups_async_pages():
62376233
RuntimeError,
62386234
)
62396235
pages = []
6240-
async for page_ in (
6236+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
6237+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
6238+
async for page_ in ( # pragma: no branch
62416239
await client.list_groups(request={})
6242-
).pages: # pragma: no branch
6240+
).pages:
62436241
pages.append(page_)
62446242
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
62456243
assert page_.raw_page.next_page_token == token
@@ -8113,9 +8111,11 @@ async def test_list_error_frames_async_pages():
81138111
RuntimeError,
81148112
)
81158113
pages = []
8116-
async for page_ in (
8114+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
8115+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
8116+
async for page_ in ( # pragma: no branch
81178117
await client.list_error_frames(request={})
8118-
).pages: # pragma: no branch
8118+
).pages:
81198119
pages.append(page_)
81208120
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
81218121
assert page_.raw_page.next_page_token == token
@@ -8769,9 +8769,11 @@ async def test_list_sources_async_pages():
87698769
RuntimeError,
87708770
)
87718771
pages = []
8772-
async for page_ in (
8772+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
8773+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
8774+
async for page_ in ( # pragma: no branch
87738775
await client.list_sources(request={})
8774-
).pages: # pragma: no branch
8776+
).pages:
87758777
pages.append(page_)
87768778
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
87778779
assert page_.raw_page.next_page_token == token
@@ -10188,9 +10190,11 @@ async def test_list_preference_sets_async_pages():
1018810190
RuntimeError,
1018910191
)
1019010192
pages = []
10191-
async for page_ in (
10193+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
10194+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
10195+
async for page_ in ( # pragma: no branch
1019210196
await client.list_preference_sets(request={})
10193-
).pages: # pragma: no branch
10197+
).pages:
1019410198
pages.append(page_)
1019510199
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
1019610200
assert page_.raw_page.next_page_token == token
@@ -12630,9 +12634,11 @@ async def test_list_report_configs_async_pages():
1263012634
RuntimeError,
1263112635
)
1263212636
pages = []
12633-
async for page_ in (
12637+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
12638+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
12639+
async for page_ in ( # pragma: no branch
1263412640
await client.list_report_configs(request={})
12635-
).pages: # pragma: no branch
12641+
).pages:
1263612642
pages.append(page_)
1263712643
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
1263812644
assert page_.raw_page.next_page_token == token
@@ -13789,9 +13795,11 @@ async def test_list_reports_async_pages():
1378913795
RuntimeError,
1379013796
)
1379113797
pages = []
13792-
async for page_ in (
13798+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
13799+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
13800+
async for page_ in ( # pragma: no branch
1379313801
await client.list_reports(request={})
13794-
).pages: # pragma: no branch
13802+
).pages:
1379513803
pages.append(page_)
1379613804
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
1379713805
assert page_.raw_page.next_page_token == token
@@ -14394,7 +14402,6 @@ def test_get_asset_rest(request_type):
1439414402
name="name_value",
1439514403
sources=["sources_value"],
1439614404
assigned_groups=["assigned_groups_value"],
14397-
machine_details=migrationcenter.MachineDetails(uuid="uuid_value"),
1439814405
)
1439914406

1440014407
# Wrap the value into a proper Response obj
@@ -14925,7 +14932,6 @@ def test_update_asset_rest(request_type):
1492514932
name="name_value",
1492614933
sources=["sources_value"],
1492714934
assigned_groups=["assigned_groups_value"],
14928-
machine_details=migrationcenter.MachineDetails(uuid="uuid_value"),
1492914935
)
1493014936

1493114937
# Wrap the value into a proper Response obj
@@ -17915,11 +17921,6 @@ def test_get_import_job_rest(request_type):
1791517921
display_name="display_name_value",
1791617922
state=migrationcenter.ImportJob.ImportJobState.IMPORT_JOB_STATE_PENDING,
1791717923
asset_source="asset_source_value",
17918-
validation_report=migrationcenter.ValidationReport(
17919-
file_validations=[
17920-
migrationcenter.FileValidationReport(file_name="file_name_value")
17921-
]
17922-
),
1792317924
)
1792417925

1792517926
# Wrap the value into a proper Response obj
@@ -19372,9 +19373,6 @@ def test_get_import_data_file_rest(request_type):
1937219373
display_name="display_name_value",
1937319374
format_=migrationcenter.ImportJobFormat.IMPORT_JOB_FORMAT_RVTOOLS_XLSX,
1937419375
state=migrationcenter.ImportDataFile.State.CREATING,
19375-
upload_file_info=migrationcenter.UploadFileInfo(
19376-
signed_uri="signed_uri_value"
19377-
),
1937819376
)
1937919377

1938019378
# Wrap the value into a proper Response obj

packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.4.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.4.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-monitoring-metrics-scopes/google/cloud/monitoring_metrics_scope_v1/services/metrics_scopes/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ async def sample_delete_monitored_project():
677677
# Done; return the response.
678678
return response
679679

680-
async def __aenter__(self):
680+
async def __aenter__(self) -> "MetricsScopesAsyncClient":
681681
return self
682682

683683
async def __aexit__(self, exc_type, exc, tb):

0 commit comments

Comments
 (0)