Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

fix: Add async context manager return types #539

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -720,7 +720,7 @@ async def sample_async_batch_annotate_files():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -2743,7 +2743,7 @@ async def sample_purge_products():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -324,7 +324,7 @@ async def sample_batch_annotate_images():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -457,7 +457,7 @@ async def sample_async_batch_annotate_files():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -458,7 +458,7 @@ async def sample_async_batch_annotate_files():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -2592,7 +2592,7 @@ async def sample_import_product_sets():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -708,7 +708,7 @@ async def sample_async_batch_annotate_files():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -2728,7 +2728,7 @@ async def sample_purge_products():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.3"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.3"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.3"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.3"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-vision",
"version": "3.4.3"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
24 changes: 16 additions & 8 deletions tests/unit/gapic/vision_v1/test_product_search.py
Expand Up @@ -1424,9 +1424,11 @@ async def test_list_product_sets_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_product_sets(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 @@ -2843,9 +2845,11 @@ async def test_list_products_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_products(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 @@ -4521,9 +4525,11 @@ async def test_list_reference_images_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_reference_images(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 @@ -5705,9 +5711,11 @@ async def test_list_products_in_product_set_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_products_in_product_set(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
24 changes: 16 additions & 8 deletions tests/unit/gapic/vision_v1p3beta1/test_product_search.py
Expand Up @@ -1425,9 +1425,11 @@ async def test_list_product_sets_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_product_sets(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 @@ -2844,9 +2846,11 @@ async def test_list_products_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_products(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 @@ -4522,9 +4526,11 @@ async def test_list_reference_images_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_reference_images(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 @@ -5706,9 +5712,11 @@ async def test_list_products_in_product_set_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_products_in_product_set(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
24 changes: 16 additions & 8 deletions tests/unit/gapic/vision_v1p4beta1/test_product_search.py
Expand Up @@ -1426,9 +1426,11 @@ async def test_list_product_sets_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_product_sets(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 @@ -2845,9 +2847,11 @@ async def test_list_products_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_products(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 @@ -4523,9 +4527,11 @@ async def test_list_reference_images_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_reference_images(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 @@ -5707,9 +5713,11 @@ async def test_list_products_in_product_set_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_products_in_product_set(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