| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| """This script is used to synthesize generated parts of this library.""" |
| from pathlib import Path |
| import textwrap |
|
|
| import synthtool as s |
| from synthtool import gcp |
| from synthtool.languages import python |
|
|
| REPO_ROOT = Path(__file__).parent.absolute() |
|
|
| default_version = "v2" |
|
|
| for library in s.get_staging_dirs(default_version): |
| |
| |
| s.replace( |
| library / f"google/cloud/bigquery_{library.name}/types/standard_sql.py", |
| r"type_ ", |
| "type ", |
| ) |
| |
| s.replace( |
| library / f"google/cloud/bigquery_{library.name}/types/model.py", |
| r"""\"predicted_\"""", |
| """`predicted_`""", |
| ) |
| s.move(library / f"google/cloud/bigquery_{library.name}/types") |
| s.remove_staging_dirs() |
|
|
| common = gcp.CommonTemplates() |
|
|
| |
| |
| |
| templated_files = common.py_library( |
| cov_level=100, |
| samples=True, |
| microgenerator=True, |
| split_system_tests=True, |
| intersphinx_dependencies={ |
| "dateutil": "https://dateutil.readthedocs.io/en/latest/", |
| "geopandas": "https://geopandas.org/", |
| "pandas": "https://pandas.pydata.org/pandas-docs/stable/", |
| }, |
| ) |
|
|
| |
| s.move( |
| templated_files, |
| excludes=[ |
| "noxfile.py", |
| "docs/multiprocessing.rst", |
| "docs/index.rst", |
| ".coveragerc", |
| ".github/CODEOWNERS", |
| |
| |
| ".kokoro/presubmit/presubmit.cfg", |
| ".kokoro/continuous/prerelease-deps.cfg", |
| ".github/workflows", |
| "README.rst", |
| ], |
| ) |
|
|
| python.configure_previous_major_version_branches() |
| |
| |
| |
|
|
| python.py_samples() |
|
|
| s.replace( |
| "docs/conf.py", |
| r'\{"members": True\}', |
| '{"members": True, "inherited-members": True}', |
| ) |
| s.replace( |
| "docs/conf.py", |
| r"exclude_patterns = \[", |
| '\\g<0>\n "google/cloud/bigquery_v2/**", # Legacy proto-based types.', |
| ) |
|
|
| |
| |
| |
|
|
| |
| s.replace(".gitignore", r"\.pytest_cache", "\\g<0>\n.pytype") |
|
|
| s.shell.run(["nox", "-s", "blacken"], hide_output=False) |
| for noxfile in REPO_ROOT.glob("samples/**/noxfile.py"): |
| s.shell.run(["nox", "-s", "blacken"], cwd=noxfile.parent, hide_output=False) |
|
|