Skip to content

Commit

Permalink
docs(grafeas): add 2.7 deprecation warning (via synth) (#10042)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and busunkim96 committed Jan 8, 2020
1 parent 55944f6 commit fa33be7
Show file tree
Hide file tree
Showing 3 changed files with 3,696 additions and 23 deletions.
11 changes: 11 additions & 0 deletions grafeas/grafeas/grafeas_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,23 @@


from __future__ import absolute_import
import sys
import warnings

from grafeas.grafeas_v1 import types
from grafeas.grafeas_v1.gapic import enums
from grafeas.grafeas_v1.gapic import grafeas_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 GrafeasClient(grafeas_client.GrafeasClient):
__doc__ = grafeas_client.GrafeasClient.__doc__
enums = enums
Expand Down
21 changes: 3 additions & 18 deletions grafeas/grafeas/grafeas_v1/gapic/grafeas_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,14 @@ class GrafeasClient(object):

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

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

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

0 comments on commit fa33be7

Please sign in to comment.