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

Commit

Permalink
feat(vision): undeprecate resource name helpers, add 2.7 sunset warni…
Browse files Browse the repository at this point in the history
…ng (via synth) (#10052)
  • Loading branch information
yoshi-automation authored and busunkim96 committed Jan 8, 2020
1 parent ff44ece commit 2c86705
Show file tree
Hide file tree
Showing 9 changed files with 3,929 additions and 77 deletions.
11 changes: 11 additions & 0 deletions google/cloud/vision_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@

from google.cloud.vision_helpers.decorators import add_single_feature_methods
from google.cloud.vision_helpers import VisionHelpers
import sys
import warnings

from google.cloud.vision_v1 import types
from google.cloud.vision_v1.gapic import enums
from google.cloud.vision_v1.gapic import image_annotator_client as iac
from google.cloud.vision_v1.gapic import product_search_client


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


@add_single_feature_methods
class ImageAnnotatorClient(VisionHelpers, iac.ImageAnnotatorClient):
__doc__ = iac.ImageAnnotatorClient.__doc__
Expand Down
28 changes: 4 additions & 24 deletions google/cloud/vision_v1/gapic/product_search_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def location_path(cls, project, location):
"""DEPRECATED. Return a fully-qualified location string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified location string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
Expand All @@ -110,12 +105,7 @@ def location_path(cls, project, location):

@classmethod
def product_path(cls, project, location, product):
"""DEPRECATED. Return a fully-qualified product string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified product string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}",
project=project,
Expand All @@ -125,12 +115,7 @@ def product_path(cls, project, location, product):

@classmethod
def product_set_path(cls, project, location, product_set):
"""DEPRECATED. Return a fully-qualified product_set string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified product_set string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/productSets/{product_set}",
project=project,
Expand All @@ -140,12 +125,7 @@ def product_set_path(cls, project, location, product_set):

@classmethod
def reference_image_path(cls, project, location, product, reference_image):
"""DEPRECATED. Return a fully-qualified reference_image string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified reference_image string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}",
project=project,
Expand Down
11 changes: 11 additions & 0 deletions google/cloud/vision_v1p1beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@

from google.cloud.vision_helpers.decorators import add_single_feature_methods
from google.cloud.vision_helpers import VisionHelpers
import sys
import warnings

from google.cloud.vision_v1p1beta1 import types
from google.cloud.vision_v1p1beta1.gapic import enums
from google.cloud.vision_v1p1beta1.gapic import image_annotator_client as iac


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


@add_single_feature_methods
class ImageAnnotatorClient(VisionHelpers, iac.ImageAnnotatorClient):
__doc__ = iac.ImageAnnotatorClient.__doc__
Expand Down
11 changes: 11 additions & 0 deletions google/cloud/vision_v1p2beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@

from google.cloud.vision_helpers.decorators import add_single_feature_methods
from google.cloud.vision_helpers import VisionHelpers
import sys
import warnings

from google.cloud.vision_v1p2beta1 import types
from google.cloud.vision_v1p2beta1.gapic import enums
from google.cloud.vision_v1p2beta1.gapic import image_annotator_client as iac


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


@add_single_feature_methods
class ImageAnnotatorClient(VisionHelpers, iac.ImageAnnotatorClient):
__doc__ = iac.ImageAnnotatorClient.__doc__
Expand Down
11 changes: 11 additions & 0 deletions google/cloud/vision_v1p3beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@

from google.cloud.vision_helpers.decorators import add_single_feature_methods
from google.cloud.vision_helpers import VisionHelpers
import sys
import warnings

from google.cloud.vision_v1p3beta1 import types
from google.cloud.vision_v1p3beta1.gapic import enums
from google.cloud.vision_v1p3beta1.gapic import image_annotator_client as iac
from google.cloud.vision_v1p3beta1.gapic import product_search_client


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class ProductSearchClient(product_search_client.ProductSearchClient):
__doc__ = product_search_client.ProductSearchClient.__doc__
enums = enums
Expand Down
28 changes: 4 additions & 24 deletions google/cloud/vision_v1p3beta1/gapic/product_search_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def location_path(cls, project, location):
"""DEPRECATED. Return a fully-qualified location string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified location string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
Expand All @@ -107,12 +102,7 @@ def location_path(cls, project, location):

@classmethod
def product_path(cls, project, location, product):
"""DEPRECATED. Return a fully-qualified product string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified product string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}",
project=project,
Expand All @@ -122,12 +112,7 @@ def product_path(cls, project, location, product):

@classmethod
def product_set_path(cls, project, location, product_set):
"""DEPRECATED. Return a fully-qualified product_set string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified product_set string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/productSets/{product_set}",
project=project,
Expand All @@ -137,12 +122,7 @@ def product_set_path(cls, project, location, product_set):

@classmethod
def reference_image_path(cls, project, location, product, reference_image):
"""DEPRECATED. Return a fully-qualified reference_image string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified reference_image string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}",
project=project,
Expand Down
11 changes: 11 additions & 0 deletions google/cloud/vision_v1p4beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@

from google.cloud.vision_helpers.decorators import add_single_feature_methods
from google.cloud.vision_helpers import VisionHelpers
import sys
import warnings

from google.cloud.vision_v1p4beta1 import types
from google.cloud.vision_v1p4beta1.gapic import enums
from google.cloud.vision_v1p4beta1.gapic import image_annotator_client as iac
from google.cloud.vision_v1p4beta1.gapic import product_search_client


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class ProductSearchClient(product_search_client.ProductSearchClient):
__doc__ = product_search_client.ProductSearchClient.__doc__
enums = enums
Expand Down
28 changes: 4 additions & 24 deletions google/cloud/vision_v1p4beta1/gapic/product_search_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def location_path(cls, project, location):
"""DEPRECATED. Return a fully-qualified location string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified location string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
Expand All @@ -108,12 +103,7 @@ def location_path(cls, project, location):

@classmethod
def product_path(cls, project, location, product):
"""DEPRECATED. Return a fully-qualified product string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified product string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}",
project=project,
Expand All @@ -123,12 +113,7 @@ def product_path(cls, project, location, product):

@classmethod
def product_set_path(cls, project, location, product_set):
"""DEPRECATED. Return a fully-qualified product_set string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified product_set string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/productSets/{product_set}",
project=project,
Expand All @@ -138,12 +123,7 @@ def product_set_path(cls, project, location, product_set):

@classmethod
def reference_image_path(cls, project, location, product, reference_image):
"""DEPRECATED. Return a fully-qualified reference_image string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified reference_image string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}",
project=project,
Expand Down
Loading

0 comments on commit 2c86705

Please sign in to comment.