Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
fix(datalabeling): deprecate resource name helper methods (via synth)…
Browse files Browse the repository at this point in the history
… (#9832)
  • Loading branch information
yoshi-automation authored and busunkim96 committed Nov 19, 2019
1 parent 4d8a20e commit e5f9021
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

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

@classmethod
def data_item_path(cls, project, dataset, data_item):
"""Return a fully-qualified data_item string."""
"""DEPRECATED. Return a fully-qualified data_item string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/datasets/{dataset}/dataItems/{data_item}",
project=project,
Expand All @@ -119,14 +134,24 @@ def data_item_path(cls, project, dataset, data_item):

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

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

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

@classmethod
def example_path(cls, project, dataset, annotated_dataset, example):
"""Return a fully-qualified example string."""
"""DEPRECATED. Return a fully-qualified example string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/datasets/{dataset}/annotatedDatasets/{annotated_dataset}/examples/{example}",
project=project,
Expand All @@ -156,7 +191,12 @@ def example_path(cls, project, dataset, annotated_dataset, example):

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

@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
"""DEPRECATED. Return a fully-qualified project string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}", project=project
)
Expand Down
10 changes: 5 additions & 5 deletions synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-11-16T13:18:46.021984Z",
"updateTime": "2019-11-19T13:20:27.854150Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.41.1",
"dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e"
"version": "0.42.1",
"dockerImage": "googleapis/artman@sha256:c773192618c608a7a0415dd95282f841f8e6bcdef7dd760a988c93b77a64bd57"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "c89394342a9ef70acaf73a6959e04b943fbc817b",
"internalRef": "280761373"
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
"internalRef": "281088257"
}
},
{
Expand Down

0 comments on commit e5f9021

Please sign in to comment.