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

Commit

Permalink
fix: remove SpeechHelpers from STT V2 client library (#452)
Browse files Browse the repository at this point in the history
* fix: remove SpeechHelpers from STT V2 client library

* chore: update post processing script

* chore: clean up post processing script

Co-authored-by: Nitsan Shai <nshai@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people committed Oct 5, 2022
1 parent 0fc37bc commit acfb24f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
7 changes: 0 additions & 7 deletions google/cloud/speech_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@
from .types.cloud_speech import UpdateRecognizerRequest
from .types.cloud_speech import WordInfo

from google.cloud.speech_v1.helpers import SpeechHelpers


class SpeechClient(SpeechHelpers, SpeechClient):
__doc__ = SpeechClient.__doc__


__all__ = (
"SpeechAsyncClient",
"AutoDetectDecodingConfig",
Expand Down
15 changes: 8 additions & 7 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,29 @@
default_version = "v1"

for library in s.get_staging_dirs(default_version):
# Add the manually written SpeechHelpers to v1 and v1p1beta1
# See google/cloud/speech_v1/helpers.py for details
count = s.replace(library / f"google/cloud/speech_{library.name}/__init__.py",
"""__all__ = \(""",
"""from google.cloud.speech_v1.helpers import SpeechHelpers
if "v1" in library.name:
# Add the manually written SpeechHelpers to v1 and v1p1beta1
# See google/cloud/speech_v1/helpers.py for details
count = s.replace(library / f"google/cloud/speech_{library.name}/__init__.py",
"""__all__ = \(""",
"""from google.cloud.speech_v1.helpers import SpeechHelpers
class SpeechClient(SpeechHelpers, SpeechClient):
__doc__ = SpeechClient.__doc__
__all__ = (
""",
)
assert count == 1

if library.name == "v1":
# Import from speech_v1 to get the client with SpeechHelpers
count = s.replace(library / "google/cloud/speech/__init__.py",
"""from google\.cloud\.speech_v1\.services\.speech\.client import SpeechClient""",
"""from google.cloud.speech_v1 import SpeechClient"""
)
assert count == 1

# Don't move over __init__.py, as we modify it to make the generated client
# use helpers.py.
s.move(library, excludes=["setup.py"])

s.remove_staging_dirs()
Expand Down

0 comments on commit acfb24f

Please sign in to comment.