-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR migrates from autosynth to [owl bot](https://github.com/googleapis/repo-automation-bots/tree/master/packages/owl-bot). owl bot will save time for maintainers as it will automatically open PRs when there are updates in [googleapis-gen](https://github.com/googleapis/googleapis-gen/tree/master/google) without requiring maintainers to run `synthtool` to build the client from protos. Additionally, similar to autosynth, PRs will be automatically opened when there are template updates.
- Loading branch information
Showing
11 changed files
with
151 additions
and
391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
docker: | ||
digest: sha256:457583330eec64daa02aeb7a72a04d33e7be2428f646671ce4045dcbc0191b1e | ||
image: gcr.io/repo-automation-bots/owlbot-python:latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
docker: | ||
image: gcr.io/repo-automation-bots/owlbot-python:latest | ||
|
||
deep-remove-regex: | ||
- /owl-bot-staging | ||
|
||
deep-copy-regex: | ||
- source: /google/monitoring/(v.*)/.*-py/(.*) | ||
dest: /owl-bot-staging/$1/$2 | ||
|
||
begin-after-commit-hash: 9f1fe1408a1799948f1b17add7c3a15145057718 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,6 @@ repos: | |
hooks: | ||
- id: black | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.9.0 | ||
rev: 3.9.1 | ||
hooks: | ||
- id: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
div#python2-eol { | ||
border-color: red; | ||
border-width: medium; | ||
} | ||
} | ||
|
||
/* Ensure minimum width for 'Parameters' / 'Returns' column */ | ||
dl.field-list > dt { | ||
min-width: 100px | ||
} | ||
|
||
/* Insert space between methods for readability */ | ||
dl.method { | ||
padding-top: 10px; | ||
padding-bottom: 10px | ||
} | ||
|
||
/* Insert empty space between classes */ | ||
dl.class { | ||
padding-bottom: 50px | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Copyright 2018 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""This script is used to synthesize generated parts of this library.""" | ||
import re | ||
|
||
import synthtool as s | ||
import synthtool.gcp as gcp | ||
from synthtool.languages import python | ||
import logging | ||
|
||
AUTOSYNTH_MULTIPLE_COMMITS = True | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
common = gcp.CommonTemplates() | ||
|
||
default_version = "v3" | ||
|
||
for library in s.get_staging_dirs(default_version): | ||
# Synth hack due to googleapis and python-api-common-protos out of sync. | ||
for pattern in [ | ||
"monitored_resource_types=\['monitored_resource_types_value'\],", | ||
"assert response.monitored_resource_types == \['monitored_resource_types_value'\]", | ||
"launch_stage=launch_stage.LaunchStage.UNIMPLEMENTED,", | ||
"assert response.launch_stage == launch_stage.LaunchStage.UNIMPLEMENTED", | ||
]: | ||
s.replace(library / "tests/unit/gapic/monitoring_v3/test_*.py", | ||
pattern, | ||
"" | ||
) | ||
|
||
# Synth hack due to microgenerator uses "type_" while api-common-protos uses "type". | ||
for file in ["test_uptime_check_service.py", "test_metric_service.py"]: | ||
s.replace(library / f"tests/unit/gapic/monitoring_v3/{file}", | ||
"type_", | ||
"type" | ||
) | ||
|
||
# Comment out broken path helper 'metric_descriptor_path' | ||
# https://github.com/googleapis/gapic-generator-python/issues/701 | ||
s.replace( | ||
library / "google/cloud/**/metric_service/client.py", | ||
"(@staticmethod\n\s+def metric_descriptor_path.*?return m\.groupdict\(\) if m else \{\})", | ||
"""'''\g<1>'''""", | ||
re.MULTILINE| re.DOTALL | ||
) | ||
|
||
s.replace( | ||
library / "google/cloud/**/metric_service/async_client.py", | ||
"""(metric_descriptor_path =.*?parse_metric_descriptor_path = staticmethod\(.*?\))""", | ||
'''"""\g<1>"""''', | ||
re.MULTILINE| re.DOTALL | ||
) | ||
|
||
s.replace( | ||
library / "tests/**/test_metric_service.py", | ||
"(def test_metric_descriptor_path.*?def test_parse_metric_descriptor_path.*?)def", | ||
'''"""\g<1>"""\ndef''', | ||
re.MULTILINE| re.DOTALL | ||
) | ||
|
||
# don't copy nox.py, setup.py, README.rst, docs/index.rst | ||
excludes = ["nox.py", "setup.py", "README.rst", "docs/index.rst"] | ||
s.move(library, excludes=excludes) | ||
|
||
s.remove_staging_dirs() | ||
|
||
# ---------------------------------------------------------------------------- | ||
# Add templated files | ||
# ---------------------------------------------------------------------------- | ||
templated_files = common.py_library( | ||
samples=True, # set to True only if there are samples | ||
microgenerator=True, | ||
unit_test_extras=["pandas"], | ||
system_test_extras=["pandas"], | ||
cov_level=99 | ||
) | ||
s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file | ||
|
||
# Don't treat docs (sphinx) warnings as errors. | ||
s.replace("noxfile.py", '[\"\']-W[\"\']', '# "-W"') | ||
|
||
# ---------------------------------------------------------------------------- | ||
# Samples templates | ||
# ---------------------------------------------------------------------------- | ||
python.py_samples(skip_readmes=True) | ||
|
||
|
||
s.shell.run(["nox", "-s", "blacken"], hide_output=False) |
Oops, something went wrong.