Skip to content

Commit

Permalink
fix: Add async context manager return types (#167)
Browse files Browse the repository at this point in the history
* fix: Add async context manager return types

chore: Mock return_value should not populate oneof message fields

chore: Support snippet generation for services that only support REST transport

chore: Update gapic-generator-python to v1.11.0
PiperOrigin-RevId: 545430278

Source-Link: googleapis/googleapis@601b532

Source-Link: googleapis/googleapis-gen@b3f18d0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjNmMThkMGY2NTYwYTg1NTAyMmZkMDU4ODY1ZTc2MjA0NzlkN2FmOSJ9

* 🦉 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Jul 4, 2023
1 parent 5b9e321 commit 5666e7a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2567,7 +2567,7 @@ async def list_locations(
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "LivestreamServiceAsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2585,7 +2585,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"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-video-live-stream",
"version": "1.4.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1412,9 +1412,11 @@ async def test_list_channels_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_channels(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
Expand Down Expand Up @@ -3232,9 +3234,11 @@ async def test_list_inputs_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_inputs(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
Expand Down Expand Up @@ -3966,7 +3970,6 @@ def test_create_event(request_type, transport: str = "grpc"):
name="name_value",
execute_now=True,
state=resources.Event.State.SCHEDULED,
input_switch=resources.Event.InputSwitchTask(input_key="input_key_value"),
)
response = client.create_event(request)

Expand Down Expand Up @@ -4615,9 +4618,11 @@ async def test_list_events_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_events(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
Expand Down Expand Up @@ -4647,7 +4652,6 @@ def test_get_event(request_type, transport: str = "grpc"):
name="name_value",
execute_now=True,
state=resources.Event.State.SCHEDULED,
input_switch=resources.Event.InputSwitchTask(input_key="input_key_value"),
)
response = client.get_event(request)

Expand Down Expand Up @@ -9265,7 +9269,6 @@ def test_create_event_rest(request_type):
name="name_value",
execute_now=True,
state=resources.Event.State.SCHEDULED,
input_switch=resources.Event.InputSwitchTask(input_key="input_key_value"),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -9943,7 +9946,6 @@ def test_get_event_rest(request_type):
name="name_value",
execute_now=True,
state=resources.Event.State.SCHEDULED,
input_switch=resources.Event.InputSwitchTask(input_key="input_key_value"),
)

# Wrap the value into a proper Response obj
Expand Down

0 comments on commit 5666e7a

Please sign in to comment.