diff options
Diffstat (limited to 'django/urls')
| -rw-r--r-- | django/urls/base.py | 5 | ||||
| -rw-r--r-- | django/urls/resolvers.py | 9 | ||||
| -rw-r--r-- | django/urls/utils.py | 4 |
3 files changed, 8 insertions, 10 deletions
diff --git a/django/urls/base.py b/django/urls/base.py index 8e30acb860..c09eeed8f6 100644 --- a/django/urls/base.py +++ b/django/urls/base.py @@ -1,6 +1,5 @@ from threading import local -from django.utils import six from django.utils.encoding import force_text, iri_to_uri from django.utils.functional import lazy from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit @@ -34,7 +33,7 @@ def reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None): prefix = get_script_prefix() - if not isinstance(viewname, six.string_types): + if not isinstance(viewname, str): view = viewname else: parts = viewname.split(':') @@ -89,7 +88,7 @@ def reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None): return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))) -reverse_lazy = lazy(reverse, six.text_type) +reverse_lazy = lazy(reverse, str) def clear_url_caches(): diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py index 4e8bded3db..cf2fe0ecec 100644 --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -14,7 +14,7 @@ from django.conf import settings from django.core.checks import Warning from django.core.checks.urls import check_resolver from django.core.exceptions import ImproperlyConfigured -from django.utils import lru_cache, six +from django.utils import lru_cache from django.utils.datastructures import MultiValueDict from django.utils.encoding import force_str, force_text from django.utils.functional import cached_property @@ -87,7 +87,7 @@ class LocaleRegexDescriptor(object): # As a performance optimization, if the given regex string is a regular # string (not a lazily-translated string proxy), compile it once and # avoid per-language compilation. - if isinstance(instance._regex, six.string_types): + if isinstance(instance._regex, str): instance.__dict__['regex'] = self._compile(instance._regex) return instance.__dict__['regex'] language_code = get_language() @@ -103,8 +103,7 @@ class LocaleRegexDescriptor(object): return re.compile(regex, re.UNICODE) except re.error as e: raise ImproperlyConfigured( - '"%s" is not a valid regular expression: %s' % - (regex, six.text_type(e)) + '"%s" is not a valid regular expression: %s' % (regex, e) ) @@ -388,7 +387,7 @@ class RegexURLResolver(LocaleRegexProvider): @cached_property def urlconf_module(self): - if isinstance(self.urlconf_name, six.string_types): + if isinstance(self.urlconf_name, str): return import_module(self.urlconf_name) else: return self.urlconf_name diff --git a/django/urls/utils.py b/django/urls/utils.py index 8558b82bba..3cf5439e77 100644 --- a/django/urls/utils.py +++ b/django/urls/utils.py @@ -1,7 +1,7 @@ from importlib import import_module from django.core.exceptions import ViewDoesNotExist -from django.utils import lru_cache, six +from django.utils import lru_cache from django.utils.module_loading import module_has_submodule @@ -17,7 +17,7 @@ def get_callable(lookup_view): if callable(lookup_view): return lookup_view - if not isinstance(lookup_view, six.string_types): + if not isinstance(lookup_view, str): raise ViewDoesNotExist("'%s' is not a callable or a dot-notation path" % lookup_view) mod_name, func_name = get_mod_func(lookup_view) |
