3535# Python 2.7 compatibility
3636except ImportError : # pragma: NO COVER
3737 from collections import Mapping
38- import io
3938import json
4039import os
4140import subprocess
@@ -58,14 +57,8 @@ def __init__(
5857 subject_token_type ,
5958 token_url ,
6059 credential_source ,
61- service_account_impersonation_url = None ,
62- service_account_impersonation_options = {},
63- client_id = None ,
64- client_secret = None ,
65- quota_project_id = None ,
66- scopes = None ,
67- default_scopes = None ,
68- workforce_pool_user_project = None ,
60+ * args ,
61+ ** kwargs
6962 ):
7063 """Instantiates an external account credentials object from a executables.
7164
@@ -86,21 +79,8 @@ def __init__(
8679 "output_file": "/path/to/generated/cached/credentials"
8780 }
8881 }
89-
90- service_account_impersonation_url (Optional[str]): The optional service account
91- impersonation getAccessToken URL.
92- client_id (Optional[str]): The optional client ID.
93- client_secret (Optional[str]): The optional client secret.
94- quota_project_id (Optional[str]): The optional quota project ID.
95- scopes (Optional[Sequence[str]]): Optional scopes to request during the
96- authorization grant.
97- default_scopes (Optional[Sequence[str]]): Default scopes passed by a
98- Google client library. Use 'scopes' for user-defined scopes.
99- workforce_pool_user_project (Optona[str]): The optional workforce pool user
100- project number when the credential corresponds to a workforce pool and not
101- a workload Pluggable. The underlying principal must still have
102- serviceusage.services.use IAM permission to use the project for
103- billing/quota.
82+ args (List): Optional positional arguments passed into the underlying :meth:`~external_account.Credentials.__init__` method.
83+ kwargs (Mapping): Optional keyword arguments passed into the underlying :meth:`~external_account.Credentials.__init__` method.
10484
10585 Raises:
10686 google.auth.exceptions.RefreshError: If an error is encountered during
@@ -117,13 +97,8 @@ def __init__(
11797 subject_token_type = subject_token_type ,
11898 token_url = token_url ,
11999 credential_source = credential_source ,
120- service_account_impersonation_url = service_account_impersonation_url ,
121- client_id = client_id ,
122- client_secret = client_secret ,
123- quota_project_id = quota_project_id ,
124- scopes = scopes ,
125- default_scopes = default_scopes ,
126- workforce_pool_user_project = workforce_pool_user_project ,
100+ * args ,
101+ ** kwargs
127102 )
128103 if not isinstance (credential_source , Mapping ):
129104 self ._credential_source_executable = None
@@ -250,24 +225,7 @@ def from_info(cls, info, **kwargs):
250225 Raises:
251226 ValueError: For invalid parameters.
252227 """
253- return cls (
254- audience = info .get ("audience" ),
255- subject_token_type = info .get ("subject_token_type" ),
256- token_url = info .get ("token_url" ),
257- service_account_impersonation_url = info .get (
258- "service_account_impersonation_url"
259- ),
260- service_account_impersonation_options = info .get (
261- "service_account_impersonation"
262- )
263- or {},
264- client_id = info .get ("client_id" ),
265- client_secret = info .get ("client_secret" ),
266- credential_source = info .get ("credential_source" ),
267- quota_project_id = info .get ("quota_project_id" ),
268- workforce_pool_user_project = info .get ("workforce_pool_user_project" ),
269- ** kwargs
270- )
228+ return super (Credentials , cls ).from_info (info , ** kwargs )
271229
272230 @classmethod
273231 def from_file (cls , filename , ** kwargs ):
@@ -281,9 +239,7 @@ def from_file(cls, filename, **kwargs):
281239 google.auth.pluggable.Credentials: The constructed
282240 credentials.
283241 """
284- with io .open (filename , "r" , encoding = "utf-8" ) as json_file :
285- data = json .load (json_file )
286- return cls .from_info (data , ** kwargs )
242+ return super (Credentials , cls ).from_file (filename , ** kwargs )
287243
288244 def _parse_subject_token (self , response ):
289245 if "version" not in response :
0 commit comments