Skip to content

Commit ca5c082

Browse files
committed
Py3.7 & flake8 is a superset of pep8 and pyflakes
1 parent f026d9b commit ca5c082

File tree

13 files changed

+29
-25
lines changed

13 files changed

+29
-25
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ python:
55
- '3.5'
66
- '3.6'
77

8+
matrix:
9+
include:
10+
- python: '3.7'
11+
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
12+
813
install:
914
- sudo apt-get update -qq
1015
- sudo apt-get install -qq swig python-dev libxml2-dev libxmlsec1-dev
@@ -15,7 +20,6 @@ script:
1520
- 'coverage run --source=src/onelogin/saml2 --rcfile=tests/coverage.rc setup.py test'
1621
- 'coverage report -m --rcfile=tests/coverage.rc'
1722
# - 'pylint src/onelogin/saml2 --rcfile=tests/pylint.rc'
18-
- 'pep8 tests/src/OneLogin/saml2_tests/*.py demo-flask/*.py demo-django/*.py src/onelogin/saml2/*.py --config=tests/pep8.rc'
19-
- 'pyflakes src/onelogin/saml2 demo-django demo-flask tests/src/OneLogin/saml2_tests'
23+
- 'flake8 .'
2024

2125
after_success: 'coveralls'

demo-django/demo/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@
8080
TEMPLATES = [
8181
{
8282
'BACKEND': 'django.template.backends.django.DjangoTemplates',
83-
'DIRS': [os.path.join(BASE_DIR, 'templates')]
84-
,
83+
'DIRS': [os.path.join(BASE_DIR, 'templates')],
8584
'APP_DIRS': True,
8685
'OPTIONS': {
8786
'debug': True,

demo-django/demo/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def index(request):
8383
attributes = request.session['samlUserdata'].items()
8484

8585
return render(request, 'index.html', {'errors': errors, 'error_reason': error_reason, 'not_auth_warn': not_auth_warn, 'success_slo': success_slo,
86-
'attributes': attributes, 'paint_logout': paint_logout})
86+
'attributes': attributes, 'paint_logout': paint_logout})
8787

8888

8989
def attrs(request):

demo-django/demo/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
import os
1111
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings")
1212

13-
from django.core.wsgi import get_wsgi_application
13+
from django.core.wsgi import get_wsgi_application # noqa: E402
1414
application = get_wsgi_application()

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
[flake8]
2+
ignore = E731,W504
3+
max-complexity = 48
4+
max-line-length = 1900
5+
16
[wheel]
27
python-tag = py27

setup.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@
4242
dependency_links=['http://github.com/mehcode/python-xmlsec/tarball/master'],
4343
extras_require={
4444
'test': (
45-
'coverage>=3.6',
46-
'freezegun==0.3.5',
47-
'pylint==1.9.1',
48-
'pep8==1.5.7',
49-
'pyflakes==0.8.1',
50-
'coveralls==1.1',
45+
'coverage>=4.5.2',
46+
'freezegun==0.3.11',
47+
'pylint==1.9.4',
48+
'flake8==3.6.0',
49+
'coveralls==1.5.1',
5150
),
5251
},
5352
keywords='saml saml2 xmlsec django flask pyramid python3',

src/onelogin/saml2/idp_metadata_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_metadata(url, validate_cert=True):
5555
idp_descriptor_nodes = OneLogin_Saml2_XML.query(dom, '//md:IDPSSODescriptor')
5656
if idp_descriptor_nodes:
5757
valid = True
58-
except:
58+
except Exception:
5959
pass
6060

6161
if not valid:

src/onelogin/saml2/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def generate_unique_id():
391391

392392
@staticmethod
393393
def parse_time_to_SAML(time):
394-
"""
394+
r"""
395395
Converts a UNIX timestamp to SAML2 timestamp on the form
396396
yyyy-mm-ddThh:mm:ss(\.s+)?Z.
397397
@@ -406,7 +406,7 @@ def parse_time_to_SAML(time):
406406

407407
@staticmethod
408408
def parse_SAML_to_time(timestr):
409-
"""
409+
r"""
410410
Converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(\.s+)?Z
411411
to a UNIX timestamp. The sub-second part is ignored.
412412

tests/pep8.rc

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/src/OneLogin/saml2_tests/authn_request_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def testCreateDeflatedSAMLRequestURLParameter(self):
267267
'SAMLRequest': authn_request.get_request()
268268
}
269269
auth_url = OneLogin_Saml2_Utils.redirect('http://idp.example.com/SSOService.php', parameters, True)
270-
self.assertRegex(auth_url, '^http://idp\.example\.com\/SSOService\.php\?SAMLRequest=')
270+
self.assertRegex(auth_url, r'^http://idp\.example\.com\/SSOService\.php\?SAMLRequest=')
271271
exploded = urlparse(auth_url)
272272
exploded = parse_qs(exploded[4])
273273
payload = exploded['SAMLRequest'][0]
@@ -295,7 +295,7 @@ def testCreateEncSAMLRequest(self):
295295
'SAMLRequest': authn_request.get_request()
296296
}
297297
auth_url = OneLogin_Saml2_Utils.redirect('http://idp.example.com/SSOService.php', parameters, True)
298-
self.assertRegex(auth_url, '^http://idp\.example\.com\/SSOService\.php\?SAMLRequest=')
298+
self.assertRegex(auth_url, r'^http://idp\.example\.com\/SSOService\.php\?SAMLRequest=')
299299
exploded = urlparse(auth_url)
300300
exploded = parse_qs(exploded[4])
301301
payload = exploded['SAMLRequest'][0]

0 commit comments

Comments
 (0)