@@ -158,9 +158,12 @@ def __init__(self, credentials=None, _http=None, client_options=None):
158158
159159 if credentials and client_options .credentials_file :
160160 raise google .api_core .exceptions .DuplicateCredentialArgs (
161- "'credentials' and 'client_options.credentials_file' are mutually exclusive." )
161+ "'credentials' and 'client_options.credentials_file' are mutually exclusive."
162+ )
162163
163- if credentials and not isinstance (credentials , google .auth .credentials .Credentials ):
164+ if credentials and not isinstance (
165+ credentials , google .auth .credentials .Credentials
166+ ):
164167 raise ValueError (_GOOGLE_AUTH_CREDENTIALS_HELP )
165168
166169 scopes = client_options .scopes or self .SCOPE
@@ -169,15 +172,19 @@ def __init__(self, credentials=None, _http=None, client_options=None):
169172 if not _http and credentials is None :
170173 if client_options .credentials_file :
171174 credentials , _ = google .auth .load_credentials_from_file (
172- client_options .credentials_file , scopes = scopes )
175+ client_options .credentials_file , scopes = scopes
176+ )
173177 else :
174178 credentials , _ = google .auth .default (scopes = scopes )
175179
176180 self ._credentials = google .auth .credentials .with_scopes_if_required (
177- credentials , scopes = scopes )
181+ credentials , scopes = scopes
182+ )
178183
179184 if client_options .quota_project_id :
180- self ._credentials = self ._credentials .with_quota_project (client_options .quota_project_id )
185+ self ._credentials = self ._credentials .with_quota_project (
186+ client_options .quota_project_id
187+ )
181188
182189 self ._http_internal = _http
183190 self ._client_cert_source = client_options .client_cert_source
@@ -202,8 +209,7 @@ def _http(self):
202209 """
203210 if self ._http_internal is None :
204211 self ._http_internal = google .auth .transport .requests .AuthorizedSession (
205- self ._credentials ,
206- refresh_timeout = _CREDENTIALS_REFRESH_TIMEOUT ,
212+ self ._credentials , refresh_timeout = _CREDENTIALS_REFRESH_TIMEOUT ,
207213 )
208214 self ._http_internal .configure_mtls_channel (self ._client_cert_source )
209215 return self ._http_internal
@@ -233,8 +239,7 @@ def __init__(self, project=None, credentials=None):
233239 # https://github.com/googleapis/python-cloud-core/issues/27
234240 if project is None :
235241 project = os .getenv (
236- environment_vars .PROJECT ,
237- os .getenv (environment_vars .LEGACY_PROJECT ),
242+ environment_vars .PROJECT , os .getenv (environment_vars .LEGACY_PROJECT ),
238243 )
239244
240245 # Project set on explicit credentials overrides discovery from
@@ -296,4 +301,6 @@ class ClientWithProject(Client, _ClientProjectMixin):
296301
297302 def __init__ (self , project = None , credentials = None , client_options = None , _http = None ):
298303 _ClientProjectMixin .__init__ (self , project = project , credentials = credentials )
299- Client .__init__ (self , credentials = credentials , client_options = client_options , _http = _http )
304+ Client .__init__ (
305+ self , credentials = credentials , client_options = client_options , _http = _http
306+ )
0 commit comments