diff --git a/google/cloud/run_v2/services/executions/async_client.py b/google/cloud/run_v2/services/executions/async_client.py index 70a195d..2c25ce9 100644 --- a/google/cloud/run_v2/services/executions/async_client.py +++ b/google/cloud/run_v2/services/executions/async_client.py @@ -796,7 +796,7 @@ async def wait_operation( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "ExecutionsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/run_v2/services/executions/transports/rest.py b/google/cloud/run_v2/services/executions/transports/rest.py index 28ac50a..0e3f29e 100644 --- a/google/cloud/run_v2/services/executions/transports/rest.py +++ b/google/cloud/run_v2/services/executions/transports/rest.py @@ -944,7 +944,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/run_v2/services/jobs/async_client.py b/google/cloud/run_v2/services/jobs/async_client.py index f23fea8..6d200cc 100644 --- a/google/cloud/run_v2/services/jobs/async_client.py +++ b/google/cloud/run_v2/services/jobs/async_client.py @@ -1542,7 +1542,7 @@ async def wait_operation( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "JobsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/run_v2/services/jobs/transports/rest.py b/google/cloud/run_v2/services/jobs/transports/rest.py index e8a9ad1..19dca75 100644 --- a/google/cloud/run_v2/services/jobs/transports/rest.py +++ b/google/cloud/run_v2/services/jobs/transports/rest.py @@ -1873,7 +1873,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/run_v2/services/revisions/async_client.py b/google/cloud/run_v2/services/revisions/async_client.py index 38f18db..736c7db 100644 --- a/google/cloud/run_v2/services/revisions/async_client.py +++ b/google/cloud/run_v2/services/revisions/async_client.py @@ -795,7 +795,7 @@ async def wait_operation( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "RevisionsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/run_v2/services/revisions/transports/rest.py b/google/cloud/run_v2/services/revisions/transports/rest.py index 5c97257..b2c9495 100644 --- a/google/cloud/run_v2/services/revisions/transports/rest.py +++ b/google/cloud/run_v2/services/revisions/transports/rest.py @@ -943,7 +943,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/run_v2/services/services/async_client.py b/google/cloud/run_v2/services/services/async_client.py index afcf381..7778f75 100644 --- a/google/cloud/run_v2/services/services/async_client.py +++ b/google/cloud/run_v2/services/services/async_client.py @@ -1469,7 +1469,7 @@ async def wait_operation( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "ServicesAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/run_v2/services/services/transports/rest.py b/google/cloud/run_v2/services/services/transports/rest.py index 010fb15..179ba06 100644 --- a/google/cloud/run_v2/services/services/transports/rest.py +++ b/google/cloud/run_v2/services/services/transports/rest.py @@ -1759,7 +1759,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/run_v2/services/tasks/async_client.py b/google/cloud/run_v2/services/tasks/async_client.py index 45540fd..40f56da 100644 --- a/google/cloud/run_v2/services/tasks/async_client.py +++ b/google/cloud/run_v2/services/tasks/async_client.py @@ -667,7 +667,7 @@ async def wait_operation( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "TasksAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/run_v2/services/tasks/transports/rest.py b/google/cloud/run_v2/services/tasks/transports/rest.py index 502c926..919deba 100644 --- a/google/cloud/run_v2/services/tasks/transports/rest.py +++ b/google/cloud/run_v2/services/tasks/transports/rest.py @@ -742,7 +742,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json b/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json index 5815e3e..da84c85 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.run.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-run", - "version": "0.8.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/run_v2/test_executions.py b/tests/unit/gapic/run_v2/test_executions.py index 5f13fba..c395781 100644 --- a/tests/unit/gapic/run_v2/test_executions.py +++ b/tests/unit/gapic/run_v2/test_executions.py @@ -1396,9 +1396,11 @@ async def test_list_executions_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_executions(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/run_v2/test_jobs.py b/tests/unit/gapic/run_v2/test_jobs.py index bfe0dfe..c0b6b12 100644 --- a/tests/unit/gapic/run_v2/test_jobs.py +++ b/tests/unit/gapic/run_v2/test_jobs.py @@ -1595,9 +1595,11 @@ async def test_list_jobs_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_jobs(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/run_v2/test_revisions.py b/tests/unit/gapic/run_v2/test_revisions.py index 520f8d5..e88a598 100644 --- a/tests/unit/gapic/run_v2/test_revisions.py +++ b/tests/unit/gapic/run_v2/test_revisions.py @@ -1330,9 +1330,11 @@ async def test_list_revisions_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_revisions(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/run_v2/test_services.py b/tests/unit/gapic/run_v2/test_services.py index bc9f90c..a0c0e36 100644 --- a/tests/unit/gapic/run_v2/test_services.py +++ b/tests/unit/gapic/run_v2/test_services.py @@ -1533,9 +1533,11 @@ async def test_list_services_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_services(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/run_v2/test_tasks.py b/tests/unit/gapic/run_v2/test_tasks.py index dd3cd57..021380b 100644 --- a/tests/unit/gapic/run_v2/test_tasks.py +++ b/tests/unit/gapic/run_v2/test_tasks.py @@ -1368,9 +1368,11 @@ async def test_list_tasks_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_tasks(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token