本文整理汇总了Python中synthtool.copy函数的典型用法代码示例。如果您正苦于以下问题:Python copy函数的具体用法?Python copy怎么用?Python copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
import synthtool as s
import synthtool.gcp as gcp
import logging
import re
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
v1_library = gapic.ruby_library(
'trace', 'v1',
config_path='/google/devtools/cloudtrace/artman_cloudtrace_v1.yaml',
artman_output_name='google-cloud-ruby/google-cloud-trace'
)
s.copy(v1_library / 'lib/google/cloud/trace/v1')
s.copy(v1_library / 'lib/google/devtools/cloudtrace/v1')
v2_library = gapic.ruby_library(
'trace', 'v2',
config_path='/google/devtools/cloudtrace/artman_cloudtrace_v2.yaml',
artman_output_name='google-cloud-ruby/google-cloud-trace'
)
s.copy(v2_library / 'lib/google/cloud/trace/v2')
s.copy(v2_library / 'lib/google/devtools/cloudtrace/v2')
# Omitting lib/google/cloud/trace/v{1,2}.rb for now because we are not exposing
# the low-level API.
# https://github.com/googleapis/gapic-generator/issues/2124
s.replace(
示例2:
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re
from textwrap import dedent
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
v1_library = gapic.ruby_library(
'language', 'v1',
artman_output_name='google-cloud-ruby/google-cloud-language'
)
s.copy(v1_library / 'acceptance')
s.copy(v1_library / 'lib/google/cloud/language/v1')
s.copy(v1_library / 'lib/google/cloud/language/v1.rb')
s.copy(v1_library / 'lib/google/cloud/language/v1')
s.copy(v1_library / 'lib/google/cloud/language.rb')
s.copy(v1_library / 'test/google/cloud/language/v1')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-language.gemspec', merge=ruby.merge_gemspec)
v1beta2_library = gapic.ruby_library(
'language', 'v1beta2',
artman_output_name='google-cloud-ruby/google-cloud-language'
)
示例3:
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java
gapic = gcp.GAPICGenerator()
data_library = gapic.java_library(
service='bigtable',
version='v2',
config_path='/google/bigtable/artman_bigtable.yaml',
artman_output_name='')
s.copy(data_library / 'gapic-google-cloud-bigtable-v2/src', 'src')
s.copy(data_library / 'grpc-google-cloud-bigtable-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-v2/src')
s.copy(data_library / 'proto-google-cloud-bigtable-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-v2/src')
java.format_code('../../google-api-grpc/grpc-google-cloud-bigtable-v2/src')
java.format_code('../../google-api-grpc/proto-google-cloud-bigtable-v2/src')
admin_library = gapic.java_library(
service='bigtable-admin',
version='v2',
config_path='/google/bigtable/admin/artman_bigtableadmin.yaml',
artman_output_name='')
s.copy(admin_library / 'gapic-google-cloud-bigtable-admin-v2/src', 'src')
示例4:
import synthtool as s
import synthtool.gcp as gcp
import logging
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
v1_library = gapic.php_library(
service='kms',
version='v1',
config_path='artman_cloudkms.yaml',
artman_output_name='google-cloud-kms-v1')
s.copy(v1_library / f'src/')
s.copy(v1_library / f'proto/src/GPBMetadata/Google/Cloud/Kms', f'metadata')
s.copy(v1_library / f'proto/src/Google/Cloud/Kms', f'src')
s.copy(v1_library / f'tests')
# fix copyright year
s.replace(
'src/V1/**/*Client.php',
r'Copyright \d{4}',
r'Copyright 2018')
s.replace(
'tests/**/V1/*Test.php',
r'Copyright \d{4}',
r'Copyright 2018')
# Use new namespace in the doc sample. See
示例5:
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
import re
from subprocess import call
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
v1_library = gapic.ruby_library(
'kms', 'v1', artman_output_name='google-cloud-ruby/google-cloud-kms',
config_path='artman_cloudkms.yaml'
)
s.copy(v1_library / 'lib')
s.copy(v1_library / 'test')
s.copy(v1_library / 'README.md')
s.copy(v1_library / 'LICENSE')
s.copy(v1_library / '.gitignore')
s.copy(v1_library / '.yardopts')
s.copy(v1_library / 'google-cloud-kms.gemspec', merge=ruby.merge_gemspec)
# PERMANENT: API name for cloudkms
s.replace(
[
'README.md',
'lib/google/cloud/kms.rb',
'lib/google/cloud/kms/v1.rb'
],
'/kms\\.googleapis\\.com', '/cloudkms.googleapis.com')
示例6:
# 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.
import synthtool as s
import synthtool.gcp as gcp
import logging
logging.basicConfig(level=logging.DEBUG)
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates, excludes=["LICENSE"])
示例7:
import synthtool as s
import synthtool.gcp as gcp
import logging
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
v3_library = gapic.py_library(
'monitoring', 'v3',
config_path='/google/monitoring/artman_monitoring.yaml',
artman_output_name='monitoring-v3')
# don't copy setup.py, README.rst, docs/index.rst
s.copy(v3_library, excludes=['setup.py', 'README.rst', 'docs/index.rst'])
# Correct calls to routing_header
# https://github.com/googleapis/gapic-generator/issues/2016
s.replace(
"google/cloud/*/gapic/*_client.py",
"routing_header\(",
"routing_header.to_grpc_metadata(")
# metadata in tests in none but should be empty list.
# https://github.com/googleapis/gapic-generator/issues/2014
s.replace(
"google/cloud/*/gapic/*_client.py",
'def .*\(([^\)]+)\n.*metadata=None\):\n\s+"""(.*\n)*?\s+"""\n',
'\g<0>'
' if metadata is None:\n'
示例8: escape_braces
import synthtool as s
import synthtool.gcp as gcp
import logging
import re
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
v1beta1_library = gapic.ruby_library(
'errorreporting', 'v1beta1',
config_path='/google/devtools/clouderrorreporting/artman_errorreporting.yaml',
artman_output_name='google-cloud-ruby/google-cloud-error_reporting'
)
s.copy(v1beta1_library / 'lib/google/cloud/error_reporting/v1beta1')
s.copy(v1beta1_library / 'lib/google/devtools/clouderrorreporting/v1beta1')
# Omitting lib/google/cloud/error_reporting/v1beta1.rb for now because we are
# not exposing the low-level API.
# https://github.com/googleapis/gapic-generator/issues/2242
def escape_braces(match):
expr = re.compile('^([^`]*(`[^`]*`[^`]*)*)([^`#\\$\\\\])\\{([\\w,]+)\\}')
content = match.group(0)
while True:
content, count = expr.subn('\\1\\3\\\\\\\\{\\4}', content)
if count == 0:
return content
s.replace(
'lib/google/cloud/error_reporting/v1beta1/**/*.rb',
示例9:
import logging
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICGenerator()
common_templates = gcp.CommonTemplates()
# tasks has two product names, and a poorly named artman yaml
v1beta1_library = gapic._generate_code(
'asset', 'v1beta1', 'php',
config_path='artman_cloudasset_v1beta1.yaml',
artman_output_name='google-cloud-asset-v1beta1')
templates = common_templates.php_library()
s.copy(v1beta1_library / f'src/')
s.copy(v1beta1_library / f'proto/src/GPBMetadata/Google/Cloud/Asset', f'metadata')
s.copy(v1beta1_library / f'proto/src/Google/Cloud/Asset', f'src')
s.copy(v1beta1_library / f'tests')
s.copy(templates)
# fix year
s.replace(
'src/V1beta1/*Client.php',
r'Copyright \d{4}',
r'Copyright 2018')
s.replace(
'**/Gapic/*GapicClient.php',
r'Copyright \d{4}',
r'Copyright 2018')
示例10:
# 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.
import synthtool as s
import synthtool.gcp as gcp
import logging
logging.basicConfig(level=logging.DEBUG)
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates)
示例11: Anonymous
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
excludes = ["README.rst", "setup.py", "nox*.py", "docs/index.rst"]
# ----------------------------------------------------------------------------
# Generate tasks GAPIC layer
# ----------------------------------------------------------------------------
for version in ["v2beta2", "v2beta3", "v2"]:
library = gapic.py_library(
"tasks",
version,
config_path=f"artman_cloudtasks_{version}.yaml",
include_protos=True,
)
s.copy(library, excludes=excludes)
s.replace(
f"google/cloud/tasks_{version}/gapic/cloud_tasks_client.py",
"(Google IAM .*?_) ",
"\g<1>_ ",
)
# Issues with Anonymous ('__') links. Change to named.
s.replace(f"google/cloud/tasks_{version}/proto/*.py", ">`__", ">`_")
# Wrapped link fails due to space in link (v2beta2)
s.replace(
"google/cloud/tasks_v2beta2/proto/queue_pb2.py",
"(in queue.yaml/xml) <\n\s+",
"\g<1>\n <",
示例12:
import re
import synthtool as s
from synthtool import gcp
gapic = gcp.GAPICGenerator()
common = gcp.CommonTemplates()
versions = ["v1beta1"]
# ----------------------------------------------------------------------------
# Generate webrisk GAPIC layer
# ----------------------------------------------------------------------------
for version in versions:
library = gapic.py_library("webrisk", version, include_protos=True)
s.copy(library, excludes=["docs/index.rst", "nox.py", "README.rst", "setup.py"])
# Fix docstring issue for classes with no summary line
s.replace(
"google/cloud/**/proto/webrisk_pb2.py",
'''__doc__ = """Attributes:''',
'''__doc__ = """
Attributes:''',
)
# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(unit_cov_level=97, cov_level=100)
示例13:
# 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 synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java
gapic = gcp.GAPICGenerator()
common_templates = gcp.CommonTemplates()
versions = ['{{version}}']
service = '{{service}}'
for version in versions:
library = gapic.java_library(
service=service,
version=version,
config_path=f'{{config_path}}',
artman_output_name='')
s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src')
s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')
java.format_code('./src')
java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')