Repository: googleapis/google-cloud-python

Issue:
Synthesis failed for recommender
Hello! Autosynth couldn't regenerate recommender. :broken_heart:

Here's the output from running `synth.py`:

```
Cloning into 'working_repo'...
Switched to branch 'autosynth-recommender'
Running synthtool
['/tmpfs/src/git/autosynth/env/bin/python3', '-m', 'synthtool', 'synth.py', '--']
synthtool > Executing /tmpfs/src/git/autosynth/working_repo/recommender/synth.py.
synthtool > Ensuring dependencies.
synthtool > Cloning googleapis.
synthtool > Generating code for: google/cloud/recommender/v1beta1.
synthtool > Generated code into /tmpfs/tmp/tmpzcw7c9x0.
synthtool > Generating code for: google/cloud/recommender/v1.
synthtool > Generated code into /tmpfs/tmp/tmp582105as.
synthtool > Replaced '(/\\^.*\\$/)' in google/cloud/recommender_v1beta1/gapic/recommender_client.py.
synthtool > Replaced ':math:`(/)' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced ':math:`(/)' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '`/\\.' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced '`/\\.' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '(regex\\s+)(/.*?/)\\.' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced '(regex\\s+)(/.*?/)\\.' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '( -  Example: )(\\{.*?\\})' in google/cloud/recommender_v1beta1/proto/recommendation_pb2.py.
synthtool > Replaced '( -  Example: )(\\{.*?\\})' in google/cloud/recommender_v1/proto/recommendation_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1beta1/proto/recommendation_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1/proto/recommendation_pb2.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py.
.coveragerc
.flake8
MANIFEST.in
docs/_static/custom.css
docs/_templates/layout.html
noxfile.py.j2
setup.cfg
synthtool > Replaced '\\["2\\.7", ' in noxfile.py.
Running session blacken
Creating virtual environment (virtualenv) using python3.6 in .nox/blacken
pip install black==19.3b0
black docs google tests noxfile.py setup.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/enums.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/recommender_client_config.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/docs/conf.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/types.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/enums.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/recommender_client.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/recommender_client_config.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommender_service_pb2.py: Cannot parse: 435:10:   __doc__ = """Request for the ``ListRecommendations`` method.
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/recommender_client.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommendation_pb2.py: Cannot parse: 681:10:   __doc__ = """A recommendation along with a suggested action. E.g., a
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/types.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/noxfile.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py: Cannot parse: 435:10:   __doc__ = """Request for the ``ListRecommendations`` method.
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/tests/unit/gapic/v1/test_recommender_client_v1.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py: Cannot parse: 681:10:   __doc__ = """A recommendation along with a suggested action. E.g., a
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/tests/unit/gapic/v1beta1/test_recommender_client_v1beta1.py
All done! 💥 💔 💥
23 files reformatted, 7 files left unchanged, 4 files failed to reformat.
Command black docs google tests noxfile.py setup.py failed with exit code 123
Session blacken failed.
synthtool > Failed executing nox -s blacken:

None
synthtool > Wrote metadata to synth.metadata.
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 99, in <module>
    main()
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 91, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/tmpfs/src/git/autosynth/working_repo/recommender/synth.py", line 62, in <module>
    s.shell.run(["nox", "-s", "blacken"], hide_output=False)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['nox', '-s', 'blacken']' returned non-zero exit status 1.

Synthesis failed

```

Google internal developers can see the full log [here](https://sponge/1e052f84-6f46-4191-b7b9-e4a59f7048aa).



Discussion:
Autosynth is still having trouble generating recommender. :sob:

Here's the output from running `synth.py`:

```
Cloning into 'working_repo'...
Switched to branch 'autosynth-recommender'
Running synthtool
['/tmpfs/src/git/autosynth/env/bin/python3', '-m', 'synthtool', 'synth.py', '--']
synthtool > Executing /tmpfs/src/git/autosynth/working_repo/recommender/synth.py.
synthtool > Ensuring dependencies.
synthtool > Cloning googleapis.
synthtool > Generating code for: google/cloud/recommender/v1beta1.
synthtool > Generated code into /tmpfs/tmp/tmpfdo9z7ha.
synthtool > Generating code for: google/cloud/recommender/v1.
synthtool > Generated code into /tmpfs/tmp/tmp35xhc2pe.
synthtool > Replaced '(/\\^.*\\$/)' in google/cloud/recommender_v1beta1/gapic/recommender_client.py.
synthtool > Replaced ':math:`(/)' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced ':math:`(/)' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '`/\\.' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced '`/\\.' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '(regex\\s+)(/.*?/)\\.' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced '(regex\\s+)(/.*?/)\\.' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '( -  Example: )(\\{.*?\\})' in google/cloud/recommender_v1beta1/proto/recommendation_pb2.py.
synthtool > Replaced '( -  Example: )(\\{.*?\\})' in google/cloud/recommender_v1/proto/recommendation_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1beta1/proto/recommendation_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1/proto/recommender_service_pb2.py.
synthtool > Replaced '(\\# -\\*- coding: utf-8 -\\*-\\n)(\\# Generated by the protocol buffer compiler\\.  DO NOT EDIT!.*?import sys)' in google/cloud/recommender_v1/proto/recommendation_pb2.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py.
synthtool > Replaced '(\\# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!)\n(import grpc)' in google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py.
.coveragerc
.flake8
MANIFEST.in
docs/_static/custom.css
docs/_templates/layout.html
noxfile.py.j2
setup.cfg
synthtool > Replaced '\\["2\\.7", ' in noxfile.py.
Running session blacken
Creating virtual environment (virtualenv) using python3.6 in .nox/blacken
pip install black==19.3b0
black docs google tests noxfile.py setup.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/enums.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/recommender_client_config.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/docs/conf.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/types.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/__init__.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/enums.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/gapic/recommender_client.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/recommender_client_config.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommender_service_pb2.py: Cannot parse: 435:10:   __doc__ = """Request for the ``ListRecommendations`` method.
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/gapic/recommender_client.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1/proto/recommendation_pb2.py: Cannot parse: 681:10:   __doc__ = """A recommendation along with a suggested action. E.g., a
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/types.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/noxfile.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py: Cannot parse: 435:10:   __doc__ = """Request for the ``ListRecommendations`` method.
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/tests/unit/gapic/v1beta1/test_recommender_client_v1beta1.py
error: cannot format /tmpfs/src/git/autosynth/working_repo/recommender/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py: Cannot parse: 681:10:   __doc__ = """A recommendation along with a suggested action. E.g., a
reformatted /tmpfs/src/git/autosynth/working_repo/recommender/tests/unit/gapic/v1/test_recommender_client_v1.py
All done! 💥 💔 💥
23 files reformatted, 7 files left unchanged, 4 files failed to reformat.
Command black docs google tests noxfile.py setup.py failed with exit code 123
Session blacken failed.
synthtool > Failed executing nox -s blacken:

None
synthtool > Wrote metadata to synth.metadata.
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 99, in <module>
    main()
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 91, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/tmpfs/src/git/autosynth/working_repo/recommender/synth.py", line 62, in <module>
    s.shell.run(["nox", "-s", "blacken"], hide_output=False)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['nox', '-s', 'blacken']' returned non-zero exit status 1.

Synthesis failed

```

Google internal developers can see the full log [here](https://sponge/32d0880b-ca4d-4377-a663-8b51a8d5abbc).


Resolving patch:
diff --git a/recommender/synth.py b/recommender/synth.py
--- a/recommender/synth.py
+++ b/recommender/synth.py
@@ -19,7 +19,7 @@
 from synthtool import gcp
 from synthtool.languages import python
 
-gapic = gcp.GAPICBazel()
+gapic = gcp.GAPICGenerator()
 versions = ["v1beta1", "v1"]
 common = gcp.CommonTemplates()
 
@@ -28,7 +28,11 @@
 # Generate Cloud Recommender
 # ----------------------------------------------------------------------------
 for version in versions:
-    library = gapic.py_library("recommender", version)
+    library = gapic.py_library(
+        "recommender",
+        version,
+        config_path=f"/google/cloud/recommender/{version}/artman_recommender_{version}.yaml",
+    )
     s.move(library, excludes=["nox.py", "docs/index.rst", "README.rst", "setup.py"])
 
 # Fix docstring with regex pattern that breaks docgen
@@ -37,7 +41,12 @@
 # Fix more regex in docstrings
 s.replace("google/**/*_pb2.py", ":math:`(/)", "\g<1>")
 s.replace("google/**/*_pb2.py", "`/\.", "/.")
-s.replace("google/**/*_pb2.py", "(regex\s+)(/.*?/)\.", "\g<1>``\g<2>``.", flags=re.MULTILINE | re.DOTALL,)
+s.replace(
+    "google/**/*_pb2.py",
+    "(regex\s+)(/.*?/)\.",
+    "\g<1>``\g<2>``.",
+    flags=re.MULTILINE | re.DOTALL,
+)
 
 # Fix docstring with JSON example by wrapping with backticks
 s.replace(


Test patch: