Skip to content

Commit 5d775a8

Browse files
authored
Merge pull request #408 from akatsoulas/drop-py2
Cleanup references of Python2
2 parents 821de3d + 5f900ac commit 5d775a8

File tree

5 files changed

+11
-26
lines changed

5 files changed

+11
-26
lines changed

CONTRIBUTING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ Before you submit a pull request, check that it meets these guidelines:
106106
2. If the pull request adds functionality, the docs should be updated. Put
107107
your new functionality into a function with a docstring, and add the
108108
feature to the list in README.rst.
109-
3. The pull request should work for Python 2.7, and 3.4+, and for PyPy. Check
110-
`<https://travis-ci.org/mozilla/mozilla-django-oidc/pull_requests>`_
109+
3. The pull request should work for Python 3.6+ and for PyPy. Check
110+
`<https://github.com/mozilla/mozilla-django-oidc/actions>`_
111111
and make sure that the tests pass for all supported Python versions.
112112

113113
Tips

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ After installation, you'll need to do some things to get your site using
1717
Requirements
1818
------------
1919

20-
This library supports Python 2.7 and 3.3+ on OSX and Linux.
20+
This library supports Python 3.6+ on OSX and Linux.
2121

2222

2323
Acquire a client id and client secret

mozilla_django_oidc/auth.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import json
44
import logging
55
import requests
6-
import six
76
from requests.auth import HTTPBasicAuth
87

98
from django.contrib.auth import get_user_model
@@ -102,7 +101,7 @@ def get_username(self, claims):
102101
username_algo = self.get_settings('OIDC_USERNAME_ALGO', None)
103102

104103
if username_algo:
105-
if isinstance(username_algo, six.string_types):
104+
if isinstance(username_algo, str):
106105
username_algo = import_string(username_algo)
107106
return username_algo(claims.get('email'))
108107

@@ -127,7 +126,7 @@ def _verify_jws(self, payload, key):
127126
"OIDC_RP_SIGN_ALGO.".format(alg)
128127
raise SuspiciousOperation(msg)
129128

130-
if isinstance(key, six.string_types):
129+
if isinstance(key, str):
131130
# Use smart_bytes here since the key string comes from settings.
132131
jwk = JWK.load(smart_bytes(key))
133132
else:

setup.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@
3333
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
3434

3535
install_requirements = [
36-
'Django >= 1.11',
36+
'Django >= 2.2',
3737
'josepy',
3838
'requests',
3939
'cryptography',
40-
'six',
4140
]
4241

4342
setup(
@@ -57,23 +56,19 @@
5756
classifiers=[
5857
'Development Status :: 5 - Production/Stable',
5958
'Framework :: Django',
60-
'Framework :: Django :: 1.11',
61-
'Framework :: Django :: 2.0',
62-
'Framework :: Django :: 2.1',
6359
'Framework :: Django :: 2.2',
6460
'Framework :: Django :: 3.0',
61+
'Framework :: Django :: 3.1',
6562
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
6663
'Intended Audience :: Developers',
6764
'Operating System :: MacOS',
6865
'Operating System :: POSIX :: Linux',
6966
'Natural Language :: English',
70-
'Programming Language :: Python :: 2',
71-
'Programming Language :: Python :: 2.7',
7267
'Programming Language :: Python :: 3',
73-
'Programming Language :: Python :: 3.4',
74-
'Programming Language :: Python :: 3.5',
68+
'Programming Language :: Python :: 3 :: Only',
7569
'Programming Language :: Python :: 3.6',
7670
'Programming Language :: Python :: 3.7',
7771
'Programming Language :: Python :: 3.8',
72+
'Programming Language :: Python :: 3.9',
7873
],
7974
)

tests/test_auth.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import six
32
from mock import Mock, call, patch
43

54
from cryptography.hazmat.backends import default_backend
@@ -28,18 +27,10 @@ def run_test(self, data, expected):
2827
self.assertEqual(type(actual), type(expected))
2928

3029
def test_empty(self):
31-
if six.PY2:
32-
self.run_test('', u'2jmj7l5rSw0yVb_vlWAYkK_YBwk')
33-
self.run_test(u'', u'2jmj7l5rSw0yVb_vlWAYkK_YBwk')
34-
else:
35-
self.run_test('', '2jmj7l5rSw0yVb_vlWAYkK_YBwk')
30+
self.run_test('', '2jmj7l5rSw0yVb_vlWAYkK_YBwk')
3631

3732
def test_email(self):
38-
if six.PY2:
39-
self.run_test('[email protected]', u'VUCUpl08JVpFeAFKBYkAjLhsQ1c')
40-
self.run_test(u'[email protected]', u'VUCUpl08JVpFeAFKBYkAjLhsQ1c')
41-
else:
42-
self.run_test('[email protected]', 'VUCUpl08JVpFeAFKBYkAjLhsQ1c')
33+
self.run_test('[email protected]', 'VUCUpl08JVpFeAFKBYkAjLhsQ1c')
4334

4435

4536
class OIDCAuthenticationBackendTestCase(TestCase):

0 commit comments

Comments
 (0)