Skip to content

Commit

Permalink
fixed insert paths
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Mar 18, 2024
1 parent 5f9d013 commit c9cdc21
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,13 @@ def lint_setup_py(session):
# ----------------------------------------------------------------------------
# Customize gapics to include PooledBigtableGrpcAsyncIOTransport
# ----------------------------------------------------------------------------
def insert(file, before_line, insert_line, after_line):
s.replace(
file,
before_line + "\n" + after_line,
before_line + "\n" + insert_line + "\n" + after_line
)
def insert(file, before_line, insert_line, after_line, escape=None):
target = before_line + "\n" + after_line
if escape:
for c in escape:
target = target.replace(c, '\\' + c)
replacement = before_line + "\n" + insert_line + "\n" + after_line
s.replace(file, target, replacement)

insert(
"google/cloud/bigtable_v2/services/bigtable/client.py",
Expand All @@ -240,22 +241,24 @@ def insert(file, before_line, insert_line, after_line):
'_transport_registry["grpc_asyncio"] = BigtableGrpcAsyncIOTransport',
'_transport_registry["pooled_grpc_asyncio"] = PooledBigtableGrpcAsyncIOTransport',
'_transport_registry["rest"] = BigtableRestTransport'
escape="[]"
)

insert(
"google/cloud/bigtable_v2/services/bigtable/__init__.py",
"google/cloud/bigtable_v2/services/bigtable/transports/__init__.py",
"from .grpc_asyncio import BigtableGrpcAsyncIOTransport",
"from .pooled_grpc_asyncio import PooledBigtableGrpcAsyncIOTransport",
"from .rest import BigtableRestTransport"
)
insert(
"google/cloud/bigtable_v2/services/bigtable/__init__.py",
"google/cloud/bigtable_v2/services/bigtable/transports/__init__.py",
'_transport_registry["grpc_asyncio"] = BigtableGrpcAsyncIOTransport',
'_transport_registry["pooled_grpc_asyncio"] = PooledBigtableGrpcAsyncIOTransport',
'_transport_registry["rest"] = BigtableRestTransport'
escape='[]"'
)
insert(
"google/cloud/bigtable_v2/services/bigtable/__init__.py",
"google/cloud/bigtable_v2/services/bigtable/transports/__init__.py",
'"BigtableGrpcAsyncIOTransport",',
'"PooledBigtableGrpcAsyncIOTransport",',
'"BigtableRestTransport",'
Expand Down

0 comments on commit c9cdc21

Please sign in to comment.