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

Commit

Permalink
chore: fix synth.py (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 committed Aug 12, 2020
1 parent 89d071c commit edfa928
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions synth.py
Expand Up @@ -17,13 +17,18 @@
import synthtool as s
from synthtool import gcp

gapic = gcp.GAPICGenerator()
gapic = gcp.GAPICBazel()

versions = ["v2beta1", "v2"]


for version in versions:
library = gapic.py_library("dialogflow", version, config_path=version + '/artman_dialogflow_' + version + '.yaml', include_protos=True)
library = gapic.py_library(
"dialogflow",
version,
bazel_target=f"//google/cloud/dialogflow/{version}:dialogflow-{version}-py",
include_protos=True,
)

s.move(
library,
Expand Down Expand Up @@ -95,29 +100,26 @@
)

# Docstring has '-----' which is interpreted as RST section title
s.replace(
"dialogflow_v2beta1/proto/intent_pb2.py",
"\s+-----------",
""
)
s.replace("dialogflow_v2beta1/proto/intent_pb2.py", "\s+-----------", "")

s.replace(
"dialogflow_*/proto/session_pb2.py",
"============================================================================",
""
"",
)


# Replace bad hyperlink references
s.replace(
"dialogflow_*/proto/audio_config_pb2.py",
"\s*\<\>`__",
"`"
)
s.replace("dialogflow_*/proto/audio_config_pb2.py", "\s*\<\>`__", "`")


s.replace('dialogflow_v2/proto/agent_pb2.py', ':math:', '')
s.replace('dialogflow_v2/proto/agent_pb2.py', ':raw-latex:', '')
s.replace("dialogflow_v2/proto/agent_pb2.py", ":math:", "")
s.replace("dialogflow_v2/proto/agent_pb2.py", ":raw-latex:", "")

s.shell.run(["nox", "-s", "blacken"], hide_output=False)
# ignore sphinx warnings
# TODO: remove with microgenerator transition
s.replace("noxfile.py",
"""['"]-W['"], # warnings as errors""",
"")

s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 comments on commit edfa928

Please sign in to comment.