@@ -89,7 +89,6 @@ def inner(
8989 @functools .wraps (func )
9090 def wrapper (cfg : "Config" ) -> Optional [CredentialsProvider ]:
9191 for attr in require :
92- getattr (cfg , attr )
9392 if not getattr (cfg , attr ):
9493 return None
9594 return func (cfg )
@@ -1054,11 +1053,11 @@ def model_serving_auth(cfg: "Config") -> Optional[CredentialsProvider]:
10541053
10551054
10561055class DefaultCredentials :
1057- """Select the first applicable credential provider from the chain"""
1056+ """Select the first applicable credential strategy from the chain"""
10581057
10591058 def __init__ (self ) -> None :
10601059 self ._auth_type = "default"
1061- self ._auth_providers = [
1060+ self ._auth_strategies = [
10621061 pat_auth ,
10631062 basic_auth ,
10641063 metadata_service ,
@@ -1082,26 +1081,26 @@ def auth_type(self) -> str:
10821081 return self ._auth_type
10831082
10841083 def oauth_token (self , cfg : "Config" ) -> oauth .Token :
1085- for provider in self ._auth_providers :
1086- auth_type = provider .auth_type ()
1084+ for strategy in self ._auth_strategies :
1085+ auth_type = strategy .auth_type ()
10871086 if auth_type != self ._auth_type :
10881087 # ignore other auth types if they don't match the selected one
10891088 continue
1090- return provider .oauth_token (cfg )
1089+ return strategy .oauth_token (cfg )
10911090
10921091 def __call__ (self , cfg : "Config" ) -> CredentialsProvider :
1093- for provider in self ._auth_providers :
1094- auth_type = provider .auth_type ()
1092+ for strategy in self ._auth_strategies :
1093+ auth_type = strategy .auth_type ()
10951094 if cfg .auth_type and auth_type != cfg .auth_type :
10961095 # ignore other auth types if one is explicitly enforced
10971096 logger .debug (f"Ignoring { auth_type } auth, because { cfg .auth_type } is preferred" )
10981097 continue
10991098 logger .debug (f"Attempting to configure auth: { auth_type } " )
11001099 try :
1101- # The header factory might be None if the provider cannot be
1100+ # The header factory might be None if the strategy cannot be
11021101 # configured for the current environment. For example, if the
1103- # provider requires some missing environment variables.
1104- header_factory = provider (cfg )
1102+ # strategy requires some missing environment variables.
1103+ header_factory = strategy (cfg )
11051104 if not header_factory :
11061105 continue
11071106
0 commit comments