Skip to content

Commit

Permalink
Remove dependency on six
Browse files Browse the repository at this point in the history
  • Loading branch information
jleclanche committed Mar 15, 2017
1 parent 0be0f25 commit cf8401d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
13 changes: 6 additions & 7 deletions oauth2_provider/settings.py
Expand Up @@ -19,8 +19,6 @@

import importlib

import six

from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

Expand Down Expand Up @@ -81,11 +79,12 @@ def perform_import(val, setting_name):
If the given setting is a string import notation,
then perform the necessary import or imports.
"""
if isinstance(val, six.string_types):
return import_from_string(val, setting_name)
elif isinstance(val, (list, tuple)):
if isinstance(val, (list, tuple)):
return [import_from_string(item, setting_name) for item in val]
return val
elif "." in val:
return import_from_string(val, setting_name)
else:
raise ImproperlyConfigured("Bad value for %r: %r" % (setting_name, val))


def import_from_string(val, setting_name):
Expand Down Expand Up @@ -133,7 +132,7 @@ def __getattr__(self, attr):

# Overriding special settings
if attr == '_SCOPES':
val = list(six.iterkeys(self.SCOPES))
val = list(self.SCOPES.keys())
if attr == '_DEFAULT_SCOPES':
if '__all__' in self.DEFAULT_SCOPES:
# If DEFAULT_SCOPES is set to ['__all__'] the whole set of scopes is returned
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Expand Up @@ -30,7 +30,6 @@ zip_safe = False
install_requires =
django >= 1.8
oauthlib >= 2.0.1
six

[options.packages.find]
exclude = tests
Expand Down

0 comments on commit cf8401d

Please sign in to comment.