1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00

Fix usage of super()

This commit is contained in:
Daniel Mach 2022-08-29 09:19:07 +02:00
parent 1b9ed6bdbb
commit a5b8729f2f
2 changed files with 6 additions and 6 deletions

View File

@ -705,7 +705,7 @@ def _get_credentials_manager(url, cp):
class APIHostOptionsEntry(dict): class APIHostOptionsEntry(dict):
def __getitem__(self, key, *args, **kwargs): def __getitem__(self, key, *args, **kwargs):
value = super(self.__class__, self).__getitem__(key, *args, **kwargs) value = super().__getitem__(key, *args, **kwargs)
if key == 'pass' and callable(value): if key == 'pass' and callable(value):
print('Warning: use of a deprecated credentials manager API.', print('Warning: use of a deprecated credentials manager API.',
file=sys.stderr) file=sys.stderr)

View File

@ -137,17 +137,17 @@ class ObfuscatedConfigFileCredentialsManager(PlaintextConfigFileCredentialsManag
if self._cp.has_option(url, 'passx', proper=True): if self._cp.has_option(url, 'passx', proper=True):
passwd = self._cp.get(url, 'passx', raw=True) passwd = self._cp.get(url, 'passx', raw=True)
else: else:
passwd = super(self.__class__, self).get_password(url, user, apiurl=apiurl) passwd = super().get_password(url, user, apiurl=apiurl)
return self.decode_password(passwd) return self.decode_password(passwd)
def set_password(self, url, user, password): def set_password(self, url, user, password):
compressed_pw = bz2.compress(password.encode('ascii')) compressed_pw = bz2.compress(password.encode('ascii'))
password = base64.b64encode(compressed_pw).decode("ascii") password = base64.b64encode(compressed_pw).decode("ascii")
super(self.__class__, self).set_password(url, user, password) super().set_password(url, user, password)
def delete_password(self, url, user): def delete_password(self, url, user):
self._cp.remove_option(url, 'passx') self._cp.remove_option(url, 'passx')
super(self.__class__, self).delete_password(url, user) super().delete_password(url, user)
@classmethod @classmethod
def decode_password(cls, password): def decode_password(cls, password):
@ -174,7 +174,7 @@ class ObfuscatedConfigFileDescriptor(AbstractCredentialsManagerDescriptor):
class TransientCredentialsManager(AbstractCredentialsManager): class TransientCredentialsManager(AbstractCredentialsManager):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(self.__class__, self).__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self._password = None self._password = None
def _process_options(self, options): def _process_options(self, options):
@ -232,7 +232,7 @@ class KeyringCredentialsManager(AbstractCredentialsManager):
def create(cls, cp, options): def create(cls, cp, options):
if not has_keyring_support(): if not has_keyring_support():
return None return None
return super(cls, cls).create(cp, options) return super().create(cp, options)
def _get_password(self, url, user, apiurl=None): def _get_password(self, url, user, apiurl=None):
self._load_backend() self._load_backend()