Skip to content
Draft
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
10 changes: 9 additions & 1 deletion .generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

INPUT_DIR = "input"
LIBRARIAN_DIR = "librarian"
OUTPUT_DIR = "output"
OUTPUT_DIR = "/usr/local/google/home/omairn/git/googleapis/google-cloud-python/output"
REPO_DIR = "repo"
SOURCE_DIR = "source"
_GITHUB_BASE = "https://github.com"
Expand Down Expand Up @@ -343,7 +343,9 @@ def _run_post_processor(output: str, library_id: str, is_mono_repo: bool):
# If this file exists, run those customizations instead of `owlbot_main`
if Path(f"{output}/librarian.py").exists():
subprocess.run(["python3.14", f"{output}/librarian.py"])
print("subproces for python 3.14 main")
else:
print("owl_bot main")
python.owlbot_main()
else:
raise SYNTHTOOL_IMPORT_ERROR # pragma: NO COVER
Expand Down Expand Up @@ -713,13 +715,19 @@ def handle_generate(
_generate_api(
api_path, library_id, source, output, version, is_mono_repo
)
print("copy files")
_copy_files_needed_for_post_processing(output, input, library_id, is_mono_repo)
print("_generate_repo_metadata_file")
_generate_repo_metadata_file(
output, library_id, source, apis_to_generate, is_mono_repo
)
print("_run_post_processor")
_run_post_processor(output, library_id, is_mono_repo)
print("_copy_readme_to_docs")
_copy_readme_to_docs(output, library_id, is_mono_repo)
print("_clean_up_files_after_post_processing")
_clean_up_files_after_post_processing(output, library_id, is_mono_repo)
print("cleaned")
except Exception as e:
raise ValueError("Generation failed.") from e
logger.info("'generate' command executed.")
Expand Down
40 changes: 40 additions & 0 deletions .librarian/generate-request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"id": "google-cloud-vision",
"version": "3.12.0",
"apis": [
{
"path": "google/cloud/vision/v1p3beta1",
"service_config": "vision_v1p3beta1.yaml"
},
{
"path": "google/cloud/vision/v1",
"service_config": "vision_v1.yaml"
},
{
"path": "google/cloud/vision/v1p1beta1",
"service_config": "vision_v1p1beta1.yaml"
},
{
"path": "google/cloud/vision/v1p2beta1",
"service_config": "vision_v1p2beta1.yaml"
},
{
"path": "google/cloud/vision/v1p4beta1",
"service_config": "vision_v1p4beta1.yaml"
}
],
Comment on lines +4 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and easier maintenance, consider sorting the API versions in the apis array. For example, v1, v1p1beta1, v1p2beta1, etc.

"source_roots": [
"packages/google-cloud-vision"
],
"preserve_regex": [
"packages/google-cloud-vision/CHANGELOG.md",
"docs/CHANGELOG.md",
"samples/README.txt",
"samples/snippets/README.rst",
"tests/system"
],
"remove_regex": [
"packages/google-cloud-vision/"
],
"tag_format": "{id}-v{version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ def __init__(
be used for service account credentials.
"""

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
Expand All @@ -102,11 +100,16 @@ def __init__(

if credentials_file is not None:
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
credentials_file,
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
scopes=scopes,
quota_project_id=quota_project_id,
default_scopes=self.AUTH_SCOPES,
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,21 @@ class ProductSearchAsyncClient:
"""Manages Products and ProductSets of reference images for use in
product search. It uses the following resource model:

- The API has a collection of
[ProductSet][google.cloud.vision.v1.ProductSet] resources, named
``projects/*/locations/*/productSets/*``, which acts as a way to
put different products into groups to limit identification.
- The API has a collection of
[ProductSet][google.cloud.vision.v1.ProductSet] resources, named
``projects/*/locations/*/productSets/*``, which acts as a way to
put different products into groups to limit identification.

In parallel,

- The API has a collection of
[Product][google.cloud.vision.v1.Product] resources, named
``projects/*/locations/*/products/*``
- The API has a collection of
[Product][google.cloud.vision.v1.Product] resources, named
``projects/*/locations/*/products/*``

- Each [Product][google.cloud.vision.v1.Product] has a collection of
[ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources,
named ``projects/*/locations/*/products/*/referenceImages/*``
- Each [Product][google.cloud.vision.v1.Product] has a collection
of [ReferenceImage][google.cloud.vision.v1.ReferenceImage]
resources, named
``projects/*/locations/*/products/*/referenceImages/*``
"""

_client: ProductSearchClient
Expand Down Expand Up @@ -335,8 +336,8 @@ async def create_product_set(

Possible errors:

- Returns INVALID_ARGUMENT if display_name is missing, or is
longer than 4096 characters.
- Returns INVALID_ARGUMENT if display_name is missing, or is
longer than 4096 characters.

.. code-block:: python

Expand Down Expand Up @@ -476,8 +477,8 @@ async def list_product_sets(

Possible errors:

- Returns INVALID_ARGUMENT if page_size is greater than 100, or
less than 1.
- Returns INVALID_ARGUMENT if page_size is greater than 100, or
less than 1.

.. code-block:: python

Expand Down Expand Up @@ -609,7 +610,7 @@ async def get_product_set(

Possible errors:

- Returns NOT_FOUND if the ProductSet does not exist.
- Returns NOT_FOUND if the ProductSet does not exist.

.. code-block:: python

Expand Down Expand Up @@ -732,10 +733,10 @@ async def update_product_set(

Possible errors:

- Returns NOT_FOUND if the ProductSet does not exist.
- Returns INVALID_ARGUMENT if display_name is present in
update_mask but missing from the request or longer than 4096
characters.
- Returns NOT_FOUND if the ProductSet does not exist.
- Returns INVALID_ARGUMENT if display_name is present in
update_mask but missing from the request or longer than 4096
characters.

.. code-block:: python

Expand Down Expand Up @@ -974,12 +975,12 @@ async def create_product(

Possible errors:

- Returns INVALID_ARGUMENT if display_name is missing or longer
than 4096 characters.
- Returns INVALID_ARGUMENT if description is longer than 4096
characters.
- Returns INVALID_ARGUMENT if product_category is missing or
invalid.
- Returns INVALID_ARGUMENT if display_name is missing or longer
than 4096 characters.
- Returns INVALID_ARGUMENT if description is longer than 4096
characters.
- Returns INVALID_ARGUMENT if product_category is missing or
invalid.

.. code-block:: python

Expand Down Expand Up @@ -1114,8 +1115,8 @@ async def list_products(

Possible errors:

- Returns INVALID_ARGUMENT if page_size is greater than 100 or
less than 1.
- Returns INVALID_ARGUMENT if page_size is greater than 100 or
less than 1.

.. code-block:: python

Expand Down Expand Up @@ -1245,7 +1246,7 @@ async def get_product(

Possible errors:

- Returns NOT_FOUND if the Product does not exist.
- Returns NOT_FOUND if the Product does not exist.

.. code-block:: python

Expand Down Expand Up @@ -1366,14 +1367,14 @@ async def update_product(

Possible errors:

- Returns NOT_FOUND if the Product does not exist.
- Returns INVALID_ARGUMENT if display_name is present in
update_mask but is missing from the request or longer than
4096 characters.
- Returns INVALID_ARGUMENT if description is present in
update_mask but is longer than 4096 characters.
- Returns INVALID_ARGUMENT if product_category is present in
update_mask.
- Returns NOT_FOUND if the Product does not exist.
- Returns INVALID_ARGUMENT if display_name is present in
update_mask but is missing from the request or longer than
4096 characters.
- Returns INVALID_ARGUMENT if description is present in
update_mask but is longer than 4096 characters.
- Returns INVALID_ARGUMENT if product_category is present in
update_mask.

.. code-block:: python

Expand Down Expand Up @@ -1620,14 +1621,14 @@ async def create_reference_image(

Possible errors:

- Returns INVALID_ARGUMENT if the image_uri is missing or longer
than 4096 characters.
- Returns INVALID_ARGUMENT if the product does not exist.
- Returns INVALID_ARGUMENT if bounding_poly is not provided, and
nothing compatible with the parent product's product_category
is detected.
- Returns INVALID_ARGUMENT if bounding_poly contains more than
10 polygons.
- Returns INVALID_ARGUMENT if the image_uri is missing or
longer than 4096 characters.
- Returns INVALID_ARGUMENT if the product does not exist.
- Returns INVALID_ARGUMENT if bounding_poly is not provided,
and nothing compatible with the parent product's
product_category is detected.
- Returns INVALID_ARGUMENT if bounding_poly contains more than
10 polygons.

.. code-block:: python

Expand Down Expand Up @@ -1882,9 +1883,9 @@ async def list_reference_images(

Possible errors:

- Returns NOT_FOUND if the parent product does not exist.
- Returns INVALID_ARGUMENT if the page_size is greater than 100,
or less than 1.
- Returns NOT_FOUND if the parent product does not exist.
- Returns INVALID_ARGUMENT if the page_size is greater than
100, or less than 1.

.. code-block:: python

Expand Down Expand Up @@ -2017,7 +2018,7 @@ async def get_reference_image(

Possible errors:

- Returns NOT_FOUND if the specified image does not exist.
- Returns NOT_FOUND if the specified image does not exist.

.. code-block:: python

Expand Down Expand Up @@ -2140,8 +2141,8 @@ async def add_product_to_product_set(

Possible errors:

- Returns NOT_FOUND if the Product or the ProductSet doesn't
exist.
- Returns NOT_FOUND if the Product or the ProductSet doesn't
exist.

.. code-block:: python

Expand Down Expand Up @@ -2386,8 +2387,8 @@ async def list_products_in_product_set(

Possible errors:

- Returns INVALID_ARGUMENT if page_size is greater than 100 or
less than 1.
- Returns INVALID_ARGUMENT if page_size is greater than 100 or
less than 1.

.. code-block:: python

Expand Down
Loading
Loading