Skip to content

Commit 79ae711

Browse files
committed
Linter fixes
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 72e69e4 commit 79ae711

20 files changed

+295
-144
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ markers =
8787

8888

8989
[flake8]
90+
max-line-length = 120
9091
author-attribute = forbidden
9192
no-accept-encodings = True
9293
assertive-snakecase = True

src/saml2/attribute_converter.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from saml2 import saml, ExtensionElement, NAMESPACE
1212
from saml2 import extension_elements_to_elements
1313
from saml2 import SAMLError
14-
from saml2.saml import NAME_FORMAT_UNSPECIFIED, NAMEID_FORMAT_PERSISTENT, NameID
14+
from saml2.saml import NAME_FORMAT_UNSPECIFIED, NAMEID_FORMAT_PERSISTENT
1515

1616
import logging
1717
logger = logging.getLogger(__name__)
@@ -136,12 +136,13 @@ def list_to_local(acs, attrlist, allow_unknown_attributes=False):
136136
try:
137137
_func = acsd[attr.name_format].ava_from
138138
except KeyError:
139-
if attr.name_format == NAME_FORMAT_UNSPECIFIED or \
140-
allow_unknown_attributes:
139+
if (
140+
attr.name_format == NAME_FORMAT_UNSPECIFIED
141+
or allow_unknown_attributes
142+
):
141143
_func = acs[0].lcd_ava_from
142144
else:
143-
logger.info("Unsupported attribute name format: %s",
144-
attr.name_format)
145+
logger.info("Unsupported attribute name format: %s", attr.name_format)
145146
continue
146147

147148
try:
@@ -384,7 +385,7 @@ def to_format(self, attr):
384385
except KeyError:
385386
try:
386387
_attr = self._to[attr.lower()]
387-
except:
388+
except KeyError:
388389
_attr = ''
389390

390391
if _attr:

src/saml2/attribute_resolver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
#from saml2 import client
1111
from saml2 import BINDING_SOAP
1212

13+
1314
logger = logging.getLogger(__name__)
1415

1516
DEFAULT_BINDING = BINDING_SOAP
1617

17-
class AttributeResolver(object):
1818

19+
class AttributeResolver(object):
1920
def __init__(self, saml2client, metadata=None, config=None):
2021
self.metadata = metadata
21-
2222
self.saml2client = saml2client
2323
self.metadata = saml2client.config.metadata
2424

@@ -42,8 +42,8 @@ def extend(self, name_id, issuer, vo_members):
4242
continue
4343
# attribute query assumes SOAP binding
4444
session_info = self.saml2client.attribute_query(
45-
name_id, attr_serv.location, issuer_id=issuer,
46-
)
45+
name_id, attr_serv.location, issuer_id=issuer
46+
)
4747
if session_info:
4848
result.append(session_info)
4949
return result

src/saml2/authn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def verify(self, request, **kwargs):
159159
wants the user after authentication.
160160
"""
161161

162-
#logger.debug("verify(%s)" % request)
162+
# logger.debug("verify(%s)" % request)
163163
if isinstance(request, six.string_types):
164164
_dict = parse_qs(request)
165165
elif isinstance(request, dict):
@@ -236,6 +236,7 @@ def __call__(self, **kwargs):
236236
try:
237237
import ldap
238238

239+
239240
class LDAPAuthn(UsernamePasswordMako):
240241
def __init__(self, srv, ldapsrv, return_to,
241242
dn_pattern, mako_template, template_lookup):

src/saml2/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""Contains classes and functions that a SAML2.0 Service Provider (SP) may use
77
to conclude its tasks.
88
"""
9-
from saml2.request import LogoutRequest
109
import saml2
1110

1211
from saml2 import saml, SAMLError
@@ -140,7 +139,7 @@ def prepare_for_negotiated_authenticate(
140139
for binding in bindings_to_try:
141140
try:
142141
destination = self._sso_location(entityid, binding)
143-
except Exception as e:
142+
except Exception:
144143
unsupported_bindings.append(binding)
145144
else:
146145
binding_destinations.append((binding, destination))

src/saml2/client_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def create_authz_decision_query_using_assertion(
630630
consent=None,
631631
extensions=None,
632632
sign=None,
633-
sign_ag=None,
633+
sign_alg=None,
634634
digest_alg=None,
635635
nsprefix=None,
636636
):

src/saml2/config.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from logging.config import dictConfig as configure_logging_by_dict
99
from warnings import warn as _warn
1010

11-
import six
12-
1311
from saml2 import BINDING_HTTP_ARTIFACT
1412
from saml2 import BINDING_HTTP_POST
1513
from saml2 import BINDING_HTTP_REDIRECT
@@ -375,15 +373,16 @@ def load_metadata(self, metadata_conf):
375373

376374
try:
377375
ca_certs = self.ca_certs
378-
except:
376+
except Exception:
379377
ca_certs = None
380378
try:
381379
disable_validation = self.disable_ssl_certificate_validation
382-
except:
380+
except Exception:
383381
disable_validation = False
384382

385-
mds = MetadataStore(acs, self, ca_certs,
386-
disable_ssl_certificate_validation=disable_validation)
383+
mds = MetadataStore(
384+
acs, self, ca_certs, disable_ssl_certificate_validation=disable_validation
385+
)
387386

388387
mds.imp(metadata_conf)
389388

0 commit comments

Comments
 (0)