102102 AsyncBigtableMetricsInterceptor as MetricInterceptorType ,
103103 )
104104 from google .cloud .bigtable .data ._async ._swappable_channel import (
105- AsyncSwappableChannel ,
105+ AsyncSwappableChannel as SwappableChannelType ,
106+ )
107+ from google .cloud .bigtable .data ._async .metrics_interceptor import (
108+ AsyncBigtableMetricsInterceptor as MetricInterceptorType ,
106109 )
107110else :
108111 from typing import Iterable # noqa: F401
115118 BigtableMetricsInterceptor as MetricInterceptorType ,
116119 )
117120 from google .cloud .bigtable .data ._sync_autogen ._swappable_channel import ( # noqa: F401
118- SwappableChannel ,
121+ SwappableChannel as SwappableChannelType ,
122+ )
123+ from google .cloud .bigtable .data ._sync_autogen .metrics_interceptor import ( # noqa: F401
124+ BigtableMetricsInterceptor as MetricInterceptorType ,
119125 )
120-
121126
122127if TYPE_CHECKING :
123128 from google .cloud .bigtable .data ._helpers import RowKeySamples
@@ -266,12 +271,11 @@ def __init__(
266271 stacklevel = 2 ,
267272 )
268273
269- @CrossSync .convert (replace_symbols = {"AsyncSwappableChannel" : "SwappableChannel" })
270- def _build_grpc_channel (self , * args , ** kwargs ) -> AsyncSwappableChannel :
274+ def _build_grpc_channel (self , * args , ** kwargs ) -> SwappableChannelType :
271275 """
272276 This method is called by the gapic transport to create a grpc channel.
273277
274- The init arguments passed down are captured in a partial used by AsyncSwappableChannel
278+ The init arguments passed down are captured in a partial used by SwappableChannel
275279 to create new channel instances in the future, as part of the channel refresh logic
276280
277281 Emulators always use an inseucre channel
@@ -296,7 +300,7 @@ def create_channel_fn():
296300 self ._metrics_interceptor ,
297301 )
298302
299- new_channel = AsyncSwappableChannel (create_channel_fn )
303+ new_channel = SwappableChannelType (create_channel_fn )
300304 if CrossSync .is_async :
301305 # attach async interceptors
302306 new_channel ._unary_unary_interceptors .append (self ._metrics_interceptor )
@@ -423,7 +427,7 @@ def _invalidate_channel_stubs(self):
423427 self .transport ._stubs = {}
424428 self .transport ._prep_wrapped_messages (self .client_info )
425429
426- @CrossSync .convert ( replace_symbols = { "AsyncSwappableChannel" : "SwappableChannel" })
430+ @CrossSync .convert
427431 async def _manage_channel (
428432 self ,
429433 refresh_interval_min : float = 60 * 35 ,
@@ -448,10 +452,10 @@ async def _manage_channel(
448452 grace_period: time to allow previous channel to serve existing
449453 requests before closing, in seconds
450454 """
451- if not isinstance (self .transport .grpc_channel , AsyncSwappableChannel ):
455+ if not isinstance (self .transport .grpc_channel , SwappableChannelType ):
452456 warnings .warn ("Channel does not support auto-refresh." )
453457 return
454- super_channel : AsyncSwappableChannel = self .transport .grpc_channel
458+ super_channel : SwappableChannelType = self .transport .grpc_channel
455459 first_refresh = self ._channel_init_time + random .uniform (
456460 refresh_interval_min , refresh_interval_max
457461 )
0 commit comments