本文整理汇总了Python中synthtool.move函数的典型用法代码示例。如果您正苦于以下问题:Python move函数的具体用法?Python move怎么用?Python move使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了move函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
import synthtool.gcp as gcp
import logging
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
library = gapic.php_library(
service='clouderrorreporting',
version='v1beta1',
config_path='/google/devtools/clouderrorreporting/artman_errorreporting.yaml',
artman_output_name='google-cloud-error-reporting-v1beta1')
# copy all src including partial veneer classes
s.move(library / 'src')
# copy proto files to src also
s.move(library / 'proto/src/Google/Cloud/ErrorReporting', 'src/')
s.move(library / 'tests/')
# copy GPBMetadata file to metadata
s.move(library / 'proto/src/GPBMetadata/Google/Devtools/Clouderrorreporting', 'metadata/')
# fix year
s.replace(
'**/Gapic/*GapicClient.php',
r'Copyright \d{4}',
'Copyright 2017')
for client in ['ErrorGroupService', 'ErrorStatsService', 'ReportErrorsService']:
s.replace(
示例2:
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
# ----------------------------------------------------------------------------
# Generate bigtable and bigtable_admin GAPIC layer
# ----------------------------------------------------------------------------
library = gapic.py_library(
"bigtable",
"v2",
config_path="/google/bigtable/artman_bigtable.yaml",
artman_output_name="bigtable-v2",
include_protos=True,
)
s.move(library / "google/cloud/bigtable_v2")
s.move(library / "tests")
# Generate admin client
library = gapic.py_library(
"bigtable_admin",
"v2",
config_path="/google/bigtable/admin/artman_bigtableadmin.yaml",
artman_output_name="bigtable-admin-v2",
include_protos=True,
)
s.move(library / "google/cloud/bigtable_admin_v2")
s.move(library / "tests")
s.replace(
示例3:
from synthtool import gcp
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
versions = ["v1p1beta1", "v1"]
# ----------------------------------------------------------------------------
# Generate speech GAPIC layer
# ----------------------------------------------------------------------------
for version in versions:
library = gapic.py_library("speech", version)
# Don't move over __init__.py, as we modify it to make the generated client
# use helpers.py.
s.move(library / f"google/cloud/speech_{version}/types.py")
s.move(library / f"google/cloud/speech_{version}/gapic")
s.move(library / f"google/cloud/speech_{version}/proto")
s.move(library / f"tests/unit/gapic/{version}")
s.move(library / f"docs/gapic/{version}")
# Use the highest version library to generate documentation import alias.
s.move(library / "google/cloud/speech.py")
# Issues exist where python files should define the source encoding
# https://github.com/googleapis/gapic-generator/issues/2097
s.replace("**/proto/*_pb2.py", r"(^.*$\n)*", r"# -*- coding: utf-8 -*-\n\g<0>")
# Fix tests to use the direct gapic client instead of the wrapped helper
示例4: many
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
# ----------------------------------------------------------------------------
# Generate dlp GAPIC layer
# ----------------------------------------------------------------------------
library = gapic.py_library(
"irm",
"v1alpha2",
config_path="/google/cloud/irm/artman_irm_v1alpha2.yaml",
include_protos=True,
)
excludes = ["README.rst", "nox*.py", "setup.py", "docs/index.rst"]
s.move(library, excludes=excludes)
# Fix docstrings
s.replace("google/**/*.py", r"\\_", "_")
s.replace("google/**/incidents_service_pb2.py", r"""\\\*""", r"""*""")
s.replace("google/**/incident_service_client.py", r"""\\\*""", r"""*""")
s.replace(
"google/**/incident_service_client.py",
r""" This will fail if:
a\. there are too many \(50\) subscriptions in the incident already
b\. a subscription using the given channel already exists""",
r""" This will fail if:
a. there are too many (50) subscriptions in the incident already
b. a subscription using the given channel already exists""",
)
示例5:
# Restore updated example from PR #7025.
s.replace(
"google/cloud/tasks_v2beta3/gapic/cloud_tasks_client.py",
">>> # TODO: Initialize `queue`:",
">>> # Initialize `queue`:",
)
s.replace(
"google/cloud/tasks_v2beta3/gapic/cloud_tasks_client.py",
"^(\s+)>>> queue = {}\n",
"\g<1>>>> queue = {\n"
"\g<1>... # The fully qualified path to the queue\n"
"\g<1>... 'name': client.queue_path('[PROJECT]', '[LOCATION]', '[NAME]'),\n"
"\g<1>... 'app_engine_http_queue': {\n"
"\g<1>... 'app_engine_routing_override': {\n"
"\g<1>... # The App Engine service that will receive the tasks.\n"
"\g<1>... 'service': 'default',\n"
"\g<1>... },\n"
"\g<1>... },\n"
"\g<1>... }\n",
)
# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(unit_cov_level=97, cov_level=100)
s.move(templated_files)
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
示例6:
import synthtool as s
import synthtool.gcp as gcp
import logging
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
library = gapic.php_library(
service='dialogflow',
version='v2',
artman_output_name='google-cloud-dialogflow-v2')
# copy all src including partial veneer classes
s.move(library / 'src')
# copy proto files to src also
s.move(library / 'proto/src/Google/Cloud/Dialogflow', 'src/')
s.move(library / 'tests/')
# copy GPBMetadata file to metadata
s.move(library / 'proto/src/GPBMetadata/Google/Cloud/Dialogflow', 'metadata/')
# fix year
s.replace(
'**/Gapic/*GapicClient.php',
r'Copyright \d{4}',
'Copyright 2018')
for client in ['Agents', 'Contexts', 'EntityTypes', 'Intents', 'SessionEntityTypes', 'Sessions']:
s.replace(
示例7:
import re
import synthtool as s
from synthtool import gcp
gapic = gcp.GAPICGenerator()
version = 'v1'
library = gapic.py_library(
'pubsub', version, config_path='/google/pubsub/artman_pubsub.yaml')
s.move(
library,
excludes=[
'docs/**/*', 'nox.py', 'README.rst', 'setup.py',
'google/cloud/pubsub_v1/__init__.py', 'google/cloud/pubsub_v1/types.py'])
# Adjust tests to import the clients directly.
s.replace(
'tests/unit/gapic/v1/test_publisher_client_v1.py',
'from google.cloud import pubsub_v1',
'from google.cloud.pubsub_v1.gapic import publisher_client')
s.replace(
'tests/unit/gapic/v1/test_publisher_client_v1.py',
' pubsub_v1',
' publisher_client')
s.replace(