Skip to content
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
11 changes: 11 additions & 0 deletions automl/google/cloud/automl_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,24 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.automl_v1 import types
from google.cloud.automl_v1.gapic import auto_ml_client
from google.cloud.automl_v1.gapic import enums
from google.cloud.automl_v1.gapic import prediction_service_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 AutoMlClient(auto_ml_client.AutoMlClient):
__doc__ = auto_ml_client.AutoMlClient.__doc__
enums = enums
Expand Down
35 changes: 5 additions & 30 deletions automl/google/cloud/automl_v1/gapic/auto_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

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

@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 @@ -146,12 +131,7 @@ def location_path(cls, project, location):

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

@classmethod
def model_evaluation_path(cls, project, location, model, model_evaluation):
"""DEPRECATED. Return a fully-qualified model_evaluation string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified model_evaluation string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}",
project=project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def model_path(cls, project, location, model):
"""DEPRECATED. Return a fully-qualified model string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified model string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}",
project=project,
Expand Down
11 changes: 11 additions & 0 deletions automl/google/cloud/automl_v1beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.automl_v1beta1 import types
from google.cloud.automl_v1beta1.gapic import auto_ml_client
Expand All @@ -33,6 +35,15 @@ class GcsClient(gcs_client.GcsClient):
__doc__ = gcs_client.GcsClient.__doc__


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 AutoMlClient(auto_ml_client.AutoMlClient):
__doc__ = auto_ml_client.AutoMlClient.__doc__
enums = enums
Expand Down
49 changes: 7 additions & 42 deletions automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

@classmethod
def column_spec_path(cls, project, location, dataset, table_spec, column_spec):
"""DEPRECATED. Return a fully-qualified column_spec string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified column_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}/columnSpecs/{column_spec}",
project=project,
Expand All @@ -136,12 +126,7 @@ def column_spec_path(cls, project, location, dataset, table_spec, column_spec):

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

@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 @@ -165,12 +145,7 @@ def location_path(cls, project, location):

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

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

@classmethod
def table_spec_path(cls, project, location, dataset, table_spec):
"""DEPRECATED. Return a fully-qualified table_spec string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified table_spec string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}",
project=project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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