Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

fix: Add async context manager return types #215

Merged
merged 2 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ async def sample_delete_attestor():
metadata=metadata,
)

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ async def sample_get_system_policy():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async def sample_validate_attestation_occurrence():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ async def sample_delete_attestor():
metadata=metadata,
)

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ async def sample_get_system_policy():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-binary-authorization",
"version": "1.6.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-binary-authorization",
"version": "1.6.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1265,9 +1265,6 @@ def test_create_attestor(request_type, transport: str = "grpc"):
call.return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_grafeas_note=resources.UserOwnedGrafeasNote(
note_reference="note_reference_value"
),
)
response = client.create_attestor(request)

Expand Down Expand Up @@ -1520,9 +1517,6 @@ def test_get_attestor(request_type, transport: str = "grpc"):
call.return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_grafeas_note=resources.UserOwnedGrafeasNote(
note_reference="note_reference_value"
),
)
response = client.get_attestor(request)

Expand Down Expand Up @@ -1755,9 +1749,6 @@ def test_update_attestor(request_type, transport: str = "grpc"):
call.return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_grafeas_note=resources.UserOwnedGrafeasNote(
note_reference="note_reference_value"
),
)
response = client.update_attestor(request)

Expand Down Expand Up @@ -2379,9 +2370,11 @@ async def test_list_attestors_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_attestors(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 @@ -3218,9 +3211,6 @@ def test_create_attestor_rest(request_type):
return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_grafeas_note=resources.UserOwnedGrafeasNote(
note_reference="note_reference_value"
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -3534,9 +3524,6 @@ def test_get_attestor_rest(request_type):
return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_grafeas_note=resources.UserOwnedGrafeasNote(
note_reference="note_reference_value"
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -3819,9 +3806,6 @@ def test_update_attestor_rest(request_type):
return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_grafeas_note=resources.UserOwnedGrafeasNote(
note_reference="note_reference_value"
),
)

# Wrap the value into a proper Response obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,9 +1277,6 @@ def test_create_attestor(request_type, transport: str = "grpc"):
call.return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_drydock_note=resources.UserOwnedDrydockNote(
note_reference="note_reference_value"
),
)
response = client.create_attestor(request)

Expand Down Expand Up @@ -1532,9 +1529,6 @@ def test_get_attestor(request_type, transport: str = "grpc"):
call.return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_drydock_note=resources.UserOwnedDrydockNote(
note_reference="note_reference_value"
),
)
response = client.get_attestor(request)

Expand Down Expand Up @@ -1767,9 +1761,6 @@ def test_update_attestor(request_type, transport: str = "grpc"):
call.return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_drydock_note=resources.UserOwnedDrydockNote(
note_reference="note_reference_value"
),
)
response = client.update_attestor(request)

Expand Down Expand Up @@ -2391,9 +2382,11 @@ async def test_list_attestors_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_attestors(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 @@ -3231,9 +3224,6 @@ def test_create_attestor_rest(request_type):
return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_drydock_note=resources.UserOwnedDrydockNote(
note_reference="note_reference_value"
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -3549,9 +3539,6 @@ def test_get_attestor_rest(request_type):
return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_drydock_note=resources.UserOwnedDrydockNote(
note_reference="note_reference_value"
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -3834,9 +3821,6 @@ def test_update_attestor_rest(request_type):
return_value = resources.Attestor(
name="name_value",
description="description_value",
user_owned_drydock_note=resources.UserOwnedDrydockNote(
note_reference="note_reference_value"
),
)

# Wrap the value into a proper Response obj
Expand Down