@@ -65,10 +65,6 @@ def close(self) -> None:
6565 c .close ()
6666 self ._client_pool .clear ()
6767
68- def _into_client_pool (self , client : CLIENT_T ) -> CLIENT_T :
69- self ._client_pool .add (client )
70- return client
71-
7268 def add_requirement (self , rs_name : str , scopes : t .Sequence [Scope ]) -> None :
7369 self ._nonstatic_requirements [rs_name ] = list (scopes )
7470
@@ -385,35 +381,41 @@ def get_transfer_client(self) -> CustomTransferClient:
385381 from ..services .transfer import CustomTransferClient
386382
387383 authorizer = self ._get_client_authorizer (TransferScopes .resource_server )
388- return self . _into_client_pool (
389- CustomTransferClient ( authorizer = authorizer , app_name = version . app_name )
390- )
384+ client = CustomTransferClient ( authorizer = authorizer , app_name = version . app_name )
385+ self . _client_pool . add ( client )
386+ return client
391387
392388 def get_auth_client (self ) -> CustomAuthClient :
393389 from ..services .auth import CustomAuthClient
394390
395391 authorizer = self ._get_client_authorizer (AuthScopes .resource_server )
396- return self . _into_client_pool (
397- CustomAuthClient ( authorizer = authorizer , app_name = version . app_name )
398- )
392+ client = CustomAuthClient ( authorizer = authorizer , app_name = version . app_name )
393+ self . _client_pool . add ( client )
394+ return client
399395
400396 def get_groups_client (self ) -> globus_sdk .GroupsClient :
401397 authorizer = self ._get_client_authorizer (GroupsScopes .resource_server )
402- return self . _into_client_pool (
403- globus_sdk . GroupsClient ( authorizer = authorizer , app_name = version .app_name )
398+ client = globus_sdk . GroupsClient (
399+ authorizer = authorizer , app_name = version .app_name
404400 )
401+ self ._client_pool .add (client )
402+ return client
405403
406404 def get_flows_client (self ) -> globus_sdk .FlowsClient :
407405 authorizer = self ._get_client_authorizer (FlowsScopes .resource_server )
408- return self . _into_client_pool (
409- globus_sdk . FlowsClient ( authorizer = authorizer , app_name = version .app_name )
406+ client = globus_sdk . FlowsClient (
407+ authorizer = authorizer , app_name = version .app_name
410408 )
409+ self ._client_pool .add (client )
410+ return client
411411
412412 def get_search_client (self ) -> globus_sdk .SearchClient :
413413 authorizer = self ._get_client_authorizer (SearchScopes .resource_server )
414- return self . _into_client_pool (
415- globus_sdk . SearchClient ( authorizer = authorizer , app_name = version .app_name )
414+ client = globus_sdk . SearchClient (
415+ authorizer = authorizer , app_name = version .app_name
416416 )
417+ self ._client_pool .add (client )
418+ return client
417419
418420 def get_timer_client (
419421 self , * , flow_id : uuid .UUID | None = None
@@ -426,9 +428,11 @@ def get_timer_client(
426428 self ._assert_requester_has_timer_flow_consent (flow_id )
427429
428430 authorizer = self ._get_client_authorizer (TimersScopes .resource_server )
429- return self . _into_client_pool (
430- globus_sdk . TimersClient ( authorizer = authorizer , app_name = version .app_name )
431+ client = globus_sdk . TimersClient (
432+ authorizer = authorizer , app_name = version .app_name
431433 )
434+ self ._client_pool .add (client )
435+ return client
432436
433437 def _assert_requester_has_timer_flow_consent (self , flow_id : uuid .UUID ) -> None :
434438 flow_scope = SpecificFlowScopes (flow_id ).user
@@ -469,9 +473,8 @@ def get_specific_flow_client(
469473 ) -> globus_sdk .SpecificFlowClient :
470474 # Create a SpecificFlowClient without an authorizer
471475 # to take advantage of its scope creation code.
472- client = self ._into_client_pool (
473- globus_sdk .SpecificFlowClient (flow_id , app_name = version .app_name )
474- )
476+ client = globus_sdk .SpecificFlowClient (flow_id , app_name = version .app_name )
477+ self ._client_pool .add (client )
475478 assert client .scopes is not None
476479 self .add_requirement (client .scopes .resource_server , [client .scopes .user ])
477480
@@ -557,14 +560,14 @@ def get_gcs_client(
557560 f"Please run:\n \n { login_context .login_command } \n "
558561 ),
559562 )
560- return self ._into_client_pool (
561- CustomGCSClient (
562- epish .get_gcs_address (),
563- source_epish = epish ,
564- authorizer = authorizer ,
565- app_name = version .app_name ,
566- )
563+ client = CustomGCSClient (
564+ epish .get_gcs_address (),
565+ source_epish = epish ,
566+ authorizer = authorizer ,
567+ app_name = version .app_name ,
567568 )
569+ self ._client_pool .add (client )
570+ return client
568571
569572 def get_current_identity_id (self ) -> str :
570573 """
0 commit comments