diff --git a/docs/custom_extensions/requires_rfc.py b/docs/custom_extensions/requires_rfc.py index d7bb8a7d..7e677fee 100644 --- a/docs/custom_extensions/requires_rfc.py +++ b/docs/custom_extensions/requires_rfc.py @@ -8,7 +8,7 @@ def setup(app): app.add_role('requires-ext', RequiresExtRole(app)) -class RequiresExtRole(object): +class RequiresExtRole: def __init__(self, app): self.app = app diff --git a/docs/source/conf.py b/docs/source/conf.py index 8d99409a..16a0ff59 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Python-GSSAPI documentation build configuration file, created by # sphinx-quickstart on Tue Jul 2 19:01:09 2013. @@ -58,8 +57,8 @@ master_doc = 'index' # General information about the project. -project = u'Python-GSSAPI' -copyright = u'2014, The Python-GSSAPI team' +project = 'Python-GSSAPI' +copyright = '2014, The Python-GSSAPI team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -103,7 +102,7 @@ # The full version, including alpha/beta/rc tags. release = '' -with open(setup_py_path, mode='r') as fd: +with open(setup_py_path) as fd: for line in fd: version_match = version_pattern.match(line) if version_match: @@ -249,8 +248,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'Python-GSSAPI.tex', u'Python-GSSAPI Documentation', - u'The Python-GSSAPI team', 'manual'), + ('index', 'Python-GSSAPI.tex', 'Python-GSSAPI Documentation', + 'The Python-GSSAPI team', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -293,8 +292,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'Python-GSSAPI', u'Python-GSSAPI Documentation', - u'The Python-GSSAPI team', 'Python-GSSAPI', + ('index', 'Python-GSSAPI', 'Python-GSSAPI Documentation', + 'The Python-GSSAPI team', 'Python-GSSAPI', 'One line description of project.', 'Miscellaneous'), ] diff --git a/gssapi/_utils.py b/gssapi/_utils.py index 0a2d8132..f2d421e1 100644 --- a/gssapi/_utils.py +++ b/gssapi/_utils.py @@ -28,7 +28,7 @@ def import_gssapi_extension( """ try: - path = 'gssapi.raw.ext_{0}'.format(name) + path = f'gssapi.raw.ext_{name}' __import__(path) return sys.modules[path] except ImportError: @@ -192,4 +192,4 @@ def __new__( if attr_name[0] != '_': attrs[attr_name] = check_last_err(attr) - return super(CheckLastError, cls).__new__(cls, name, parents, attrs) + return super().__new__(cls, name, parents, attrs) diff --git a/gssapi/creds.py b/gssapi/creds.py index 4ea53bfd..9c2e9a3c 100644 --- a/gssapi/creds.py +++ b/gssapi/creds.py @@ -79,7 +79,7 @@ def __new__( base_creds = res.creds return t.cast("Credentials", - super(Credentials, cls).__new__(cls, base_creds)) + super().__new__(cls, base_creds)) @property def name(self) -> rnames.Name: diff --git a/gssapi/exceptions.py b/gssapi/exceptions.py index 4775bfe1..9f570aea 100644 --- a/gssapi/exceptions.py +++ b/gssapi/exceptions.py @@ -24,7 +24,7 @@ def __init__( ) -> None: maj_str = self.MAJOR_MESSAGE.format(**kwargs) err_str = self.FMT_STR.format(maj=maj_str, min=minor_message) - super(GeneralError, self).__init__(err_str) + super().__init__(err_str) class UnknownUsageError(GeneralError): @@ -42,6 +42,6 @@ def __init__( unwrapped_message: t.Optional[bytes] = None, **kwargs: str, ) -> None: - super(EncryptionNotUsed, self).__init__(minor_message, **kwargs) + super().__init__(minor_message, **kwargs) self.unwrapped_message = unwrapped_message diff --git a/gssapi/mechs.py b/gssapi/mechs.py index a6d7d18c..e9cd4bfc 100644 --- a/gssapi/mechs.py +++ b/gssapi/mechs.py @@ -27,7 +27,7 @@ def __new__( elements: t.Optional[bytes] = None, ) -> "Mechanism": return t.cast("Mechanism", - super(Mechanism, cls).__new__(cls, cpy, elements)) + super().__new__(cls, cpy, elements)) @property def name_types(self) -> t.Set[roids.OID]: @@ -73,7 +73,7 @@ def __repr__(self) -> str: """ base = "" % self.dotted_form if rfc5801 is not None: - base = "" % ( + base = "".format( self._saslname.mech_name.decode('UTF-8'), self.dotted_form ) @@ -203,11 +203,11 @@ def from_attrs( :requires-ext:`rfc5587` """ if isinstance(desired_attrs, roids.OID): - desired_attrs = set([desired_attrs]) + desired_attrs = {desired_attrs} if isinstance(except_attrs, roids.OID): - except_attrs = set([except_attrs]) + except_attrs = {except_attrs} if isinstance(critical_attrs, roids.OID): - critical_attrs = set([critical_attrs]) + critical_attrs = {critical_attrs} if rfc5587 is None: raise NotImplementedError("Your GSSAPI implementation does not " diff --git a/gssapi/names.py b/gssapi/names.py index c6fd972a..f0f16200 100644 --- a/gssapi/names.py +++ b/gssapi/names.py @@ -1,4 +1,3 @@ - import typing as t from gssapi.raw import names as rname @@ -79,7 +78,7 @@ def __new__( base, # type: ignore[arg-type] name_type) - return t.cast("Name", super(Name, cls).__new__(cls, base_name)) + return t.cast("Name", super().__new__(cls, base_name)) def __init__( self, diff --git a/gssapi/raw/__init__.py b/gssapi/raw/__init__.py index 0699c419..e1e0b0f1 100644 --- a/gssapi/raw/__init__.py +++ b/gssapi/raw/__init__.py @@ -42,7 +42,7 @@ # NB(directxman12): the enum extensions must be imported BEFORE ANYTHING ELSE! for modinf in pkgutil.iter_modules(_enum_extensions.__path__): name = modinf[1] - importlib.import_module('{0}._enum_extensions.{1}'.format(__name__, name)) + importlib.import_module(f'{__name__}._enum_extensions.{name}') del pkgutil del importlib diff --git a/gssapi/raw/_enum_extensions/__init__.py b/gssapi/raw/_enum_extensions/__init__.py index 96622e1f..5c297e67 100644 --- a/gssapi/raw/_enum_extensions/__init__.py +++ b/gssapi/raw/_enum_extensions/__init__.py @@ -33,7 +33,7 @@ def __new__( else: classdict[extra_name] = extra_val - return super(ExtendableEnum, metacl).__new__( + return super().__new__( metacl, name, bases, diff --git a/gssapi/sec_contexts.py b/gssapi/sec_contexts.py index adbbf301..24fe357a 100644 --- a/gssapi/sec_contexts.py +++ b/gssapi/sec_contexts.py @@ -46,7 +46,7 @@ def __new__( base = rsec_contexts.import_sec_context(token) return t.cast("SecurityContext", - super(SecurityContext, cls).__new__(cls, base)) + super().__new__(cls, base)) def __init__( self, diff --git a/gssapi/tests/test_high_level.py b/gssapi/tests/test_high_level.py index d7c43aaf..19173f3c 100644 --- a/gssapi/tests/test_high_level.py +++ b/gssapi/tests/test_high_level.py @@ -30,7 +30,7 @@ class _GSSAPIKerberosTestCase(kt.KerberosTestCase): @classmethod def setUpClass(cls): - super(_GSSAPIKerberosTestCase, cls).setUpClass() + super().setUpClass() svc_princ = SERVICE_PRINCIPAL.decode("UTF-8") cls.realm.kinit(svc_princ, flags=['-k']) @@ -58,7 +58,7 @@ def _restore_env(cls): @classmethod def tearDownClass(cls): - super(_GSSAPIKerberosTestCase, cls).tearDownClass() + super().tearDownClass() cls._restore_env() @@ -94,7 +94,7 @@ def exist_perms(**kwargs): perms = _perms_cycle(curr_elems.pop(), curr_elems, {}) res = [] for name_str, perm in perms: - args = dict([(k, v) for (k, v) in kwargs.items() if perm[k]]) + args = {k: v for (k, v) in kwargs.items() if perm[k]} res.append((name_str, args)) return parameterized.expand(res) @@ -114,7 +114,7 @@ def true_false_perms(*all_elems_tuple): # NB(directxman12): the above note used to be wonderfully sarcastic class CredsTestCase(_GSSAPIKerberosTestCase): def setUp(self): - super(CredsTestCase, self).setUp() + super().setUp() svc_princ = SERVICE_PRINCIPAL.decode("UTF-8") self.realm.kinit(svc_princ, flags=['-k']) @@ -182,8 +182,8 @@ def test_store_acquire(self): @ktu.gssapi_extension_test('cred_store', 'credentials store') def test_store_into_acquire_from(self): - CCACHE = 'FILE:{tmpdir}/other_ccache'.format(tmpdir=self.realm.tmpdir) - KT = '{tmpdir}/other_keytab'.format(tmpdir=self.realm.tmpdir) + CCACHE = f'FILE:{self.realm.tmpdir}/other_ccache' + KT = f'{self.realm.tmpdir}/other_keytab' store = {'ccache': CCACHE, 'keytab': KT} princ_name = 'service/cs@' + self.realm.realm @@ -281,8 +281,8 @@ def test_add(self): @ktu.gssapi_extension_test('cred_store', 'credentials store') def test_store_into_add_from(self): - CCACHE = 'FILE:{tmpdir}/other_ccache'.format(tmpdir=self.realm.tmpdir) - KT = '{tmpdir}/other_keytab'.format(tmpdir=self.realm.tmpdir) + CCACHE = f'FILE:{self.realm.tmpdir}/other_ccache' + KT = f'{self.realm.tmpdir}/other_keytab' store = {'ccache': CCACHE, 'keytab': KT} princ_name = 'service_add_from/cs@' + self.realm.realm @@ -536,7 +536,7 @@ def test_create_from_composite_token_with_attrs(self): self.assertIsNotNone(name2) ugg = name2.attributes["urn:greet:greeting"] - self.assertEqual(ugg.values, set([b"some val"])) + self.assertEqual(ugg.values, {b"some val"}) self.assertTrue(ugg.complete) self.assertFalse(ugg.authenticated) @@ -545,10 +545,7 @@ def test_to_str(self): name_str = str(name) - if sys.version_info[0] == 2: - target_val = SERVICE_PRINCIPAL - else: - target_val = SERVICE_PRINCIPAL.decode(gssutils._get_encoding()) + target_val = SERVICE_PRINCIPAL.decode(gssutils._get_encoding()) self.assertEqual(name_str, target_val) @@ -647,7 +644,7 @@ def test_basic_get_set_del_name_attribute_no_auth(self): canon_name.attributes['urn:greet:greeting'] = (b'some val', True) ugg = canon_name.attributes["urn:greet:greeting"] - self.assertEqual(ugg.values, set([b"some val"])) + self.assertEqual(ugg.values, {b"some val"}) self.assertTrue(ugg.complete) self.assertFalse(ugg.authenticated) @@ -662,7 +659,7 @@ def test_basic_get_set_del_name_attribute_no_auth(self): class SecurityContextTestCase(_GSSAPIKerberosTestCase): def setUp(self): - super(SecurityContextTestCase, self).setUp() + super().setUp() gssctx.SecurityContext.__DEFER_STEP_ERRORS__ = False self.client_name = gssnames.Name(self.USER_PRINC) self.client_creds = gsscreds.Credentials(name=None, diff --git a/gssapi/tests/test_raw.py b/gssapi/tests/test_raw.py index 1ab7ab3a..0dbd321c 100644 --- a/gssapi/tests/test_raw.py +++ b/gssapi/tests/test_raw.py @@ -27,7 +27,7 @@ class _GSSAPIKerberosTestCase(kt.KerberosTestCase): @classmethod def setUpClass(cls): - super(_GSSAPIKerberosTestCase, cls).setUpClass() + super().setUpClass() svc_princ = SERVICE_PRINCIPAL.decode("UTF-8") cls.realm.kinit(svc_princ, flags=['-k']) @@ -56,7 +56,7 @@ def _restore_env(cls): @classmethod def tearDownClass(cls): - super(_GSSAPIKerberosTestCase, cls).tearDownClass() + super().tearDownClass() cls._restore_env() @@ -449,8 +449,8 @@ def test_store_cred_acquire_cred(self): @ktu.gssapi_extension_test('cred_store', 'credentials store') def test_store_cred_into_acquire_cred(self): - CCACHE = 'FILE:{tmpdir}/other_ccache'.format(tmpdir=self.realm.tmpdir) - KT = '{tmpdir}/other_keytab'.format(tmpdir=self.realm.tmpdir) + CCACHE = f'FILE:{self.realm.tmpdir}/other_ccache' + KT = f'{self.realm.tmpdir}/other_keytab' store = {b'ccache': CCACHE.encode('UTF-8'), b'keytab': KT.encode('UTF-8')} @@ -660,7 +660,7 @@ def test_rfc5587(self): known_attrs_dict[mech_attr].add(mech) for attr, expected_mechs in attrs_dict.items(): - attrs = set([attr]) + attrs = {attr} mechs = gb.indicate_mechs_by_attrs(attrs, None, None) self.assertGreater(len(mechs), 0) @@ -673,7 +673,7 @@ def test_rfc5587(self): if self.realm.provider.lower() != 'heimdal': # Heimdal doesn't fully implement gss_indicate_mechs_by_attrs for attr, expected_mechs in known_attrs_dict.items(): - attrs = set([attr]) + attrs = {attr} mechs = gb.indicate_mechs_by_attrs(None, None, attrs) self.assertGreater(len(mechs), 0) diff --git a/setup.py b/setup.py index f348dc6b..1b0fd0e5 100755 --- a/setup.py +++ b/setup.py @@ -39,10 +39,10 @@ def get_output(*args, **kwargs): autodetect_kc = False print(f"Using {kc} from env") -link_args, compile_args = [ +link_args, compile_args = ( shlex.split(os.environ[e], posix=posix) if e in os.environ else None for e in ['GSSAPI_LINKER_ARGS', 'GSSAPI_COMPILER_ARGS'] -] +) osx_has_gss_framework = False if sys.platform == 'darwin': pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy