summaryrefslogtreecommitdiff
path: root/django/template
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-02-09 13:19:34 -0500
committerTim Graham <timograham@gmail.com>2015-02-09 14:24:06 -0500
commita8b70d251d238b4e6cfc7bb4296da15494f8dff3 (patch)
tree94ef5bc53e59131906aecfcf792eeac86242aa62 /django/template
parenteb406aa686ff1809903366ef6896037af2f1f69b (diff)
[1.8.x] Sorted imports with isort; refs #23860.
Backport of 0ed7d155635da9f79d4dd67e4889087d3673c6da from master
Diffstat (limited to 'django/template')
-rw-r--r--django/template/backends/base.py3
-rw-r--r--django/template/backends/django.py3
-rw-r--r--django/template/backends/jinja2.py4
-rw-r--r--django/template/base.py30
-rw-r--r--django/template/context.py3
-rw-r--r--django/template/debug.py8
-rw-r--r--django/template/defaultfilters.py25
-rw-r--r--django/template/defaulttags.py29
-rw-r--r--django/template/engine.py4
-rw-r--r--django/template/loader.py8
-rw-r--r--django/template/loader_tags.py7
-rw-r--r--django/template/loaders/cached.py1
-rw-r--r--django/template/loaders/eggs.py10
-rw-r--r--django/template/response.py2
-rw-r--r--django/template/utils.py5
15 files changed, 72 insertions, 70 deletions
diff --git a/django/template/backends/base.py b/django/template/backends/base.py
index 25a7dd2a15..00b5fc4b2b 100644
--- a/django/template/backends/base.py
+++ b/django/template/backends/base.py
@@ -2,7 +2,8 @@
from __future__ import absolute_import
from django.core.exceptions import (
- ImproperlyConfigured, SuspiciousFileOperation)
+ ImproperlyConfigured, SuspiciousFileOperation,
+)
from django.template.utils import get_app_template_dirs
from django.utils._os import safe_join
from django.utils.functional import cached_property
diff --git a/django/template/backends/django.py b/django/template/backends/django.py
index 2fe3227237..942445d367 100644
--- a/django/template/backends/django.py
+++ b/django/template/backends/django.py
@@ -5,10 +5,9 @@ import warnings
from django.conf import settings
from django.template.context import Context, RequestContext
-from django.template.engine import _dirs_undefined, Engine
+from django.template.engine import Engine, _dirs_undefined
from django.utils.deprecation import RemovedInDjango20Warning
-
from .base import BaseEngine
diff --git a/django/template/backends/jinja2.py b/django/template/backends/jinja2.py
index cc99a745cf..b26cb391f2 100644
--- a/django/template/backends/jinja2.py
+++ b/django/template/backends/jinja2.py
@@ -3,13 +3,13 @@ from __future__ import absolute_import
import sys
+import jinja2
+
from django.conf import settings
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.utils import six
from django.utils.module_loading import import_string
-import jinja2
-
from .base import BaseEngine
from .utils import csrf_input_lazy, csrf_token_lazy
diff --git a/django/template/base.py b/django/template/base.py
index 6594af1e1a..b9fd47625b 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -52,30 +52,32 @@ u'<html></html>'
from __future__ import unicode_literals
import re
+import warnings
from functools import partial
from importlib import import_module
from inspect import getargspec, getcallargs
-import warnings
from django.apps import apps
-from django.template.context import (BaseContext, Context, RequestContext, # NOQA: imported for backwards compatibility
- ContextPopException)
-from django.utils import lru_cache
+from django.template.context import ( # NOQA: imported for backwards compatibility
+ BaseContext, Context, ContextPopException, RequestContext,
+)
+from django.utils import lru_cache, six
from django.utils.deprecation import RemovedInDjango20Warning
-from django.utils.itercompat import is_iterable
-from django.utils.text import (smart_split, unescape_string_literal,
- get_text_list)
-from django.utils.encoding import force_str, force_text
-from django.utils.translation import ugettext_lazy, pgettext_lazy
-from django.utils.safestring import (SafeData, EscapeData, mark_safe,
- mark_for_escaping)
+from django.utils.encoding import (
+ force_str, force_text, python_2_unicode_compatible,
+)
from django.utils.formats import localize
from django.utils.html import conditional_escape
+from django.utils.itercompat import is_iterable
from django.utils.module_loading import module_has_submodule
-from django.utils import six
+from django.utils.safestring import (
+ EscapeData, SafeData, mark_for_escaping, mark_safe,
+)
+from django.utils.text import (
+ get_text_list, smart_split, unescape_string_literal,
+)
from django.utils.timezone import template_localtime
-from django.utils.encoding import python_2_unicode_compatible
-
+from django.utils.translation import pgettext_lazy, ugettext_lazy
TOKEN_TEXT = 0
TOKEN_VAR = 1
diff --git a/django/template/context.py b/django/template/context.py
index 9543931cec..aff8aa2e1c 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -1,9 +1,8 @@
-from copy import copy
import warnings
+from copy import copy
from django.utils.deprecation import RemovedInDjango20Warning
-
# Hard-coded processor for easier use of CSRF protection.
_builtin_context_processors = ('django.template.context_processors.csrf',)
diff --git a/django/template/debug.py b/django/template/debug.py
index 465d7ff926..7f2cbc585a 100644
--- a/django/template/debug.py
+++ b/django/template/debug.py
@@ -1,8 +1,10 @@
-from django.template.base import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError
+from django.template.base import (
+ Lexer, NodeList, Parser, TemplateSyntaxError, VariableNode, tag_re,
+)
from django.utils.encoding import force_text
-from django.utils.html import conditional_escape
-from django.utils.safestring import SafeData, EscapeData
from django.utils.formats import localize
+from django.utils.html import conditional_escape
+from django.utils.safestring import EscapeData, SafeData
from django.utils.timezone import template_localtime
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index 16a3d4d6e9..57a4a7f1f9 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -1,29 +1,30 @@
"""Default variable filters."""
from __future__ import unicode_literals
-import re
import random as random_module
-from decimal import Decimal, InvalidOperation, Context, ROUND_HALF_UP
+import re
+import warnings
+from decimal import ROUND_HALF_UP, Context, Decimal, InvalidOperation
from functools import wraps
from pprint import pformat
-import warnings
-from django.template.base import Variable, Library, VariableDoesNotExist
from django.conf import settings
-from django.utils import formats
+from django.template.base import Library, Variable, VariableDoesNotExist
+from django.utils import formats, six
from django.utils.dateformat import format, time_format
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text, iri_to_uri
-from django.utils.html import (conditional_escape, escapejs,
- escape, urlize as _urlize, linebreaks, strip_tags, avoid_wrapping,
- remove_tags)
+from django.utils.html import (
+ avoid_wrapping, conditional_escape, escape, escapejs, linebreaks,
+ remove_tags, strip_tags, urlize as _urlize,
+)
from django.utils.http import urlquote
-from django.utils.text import Truncator, wrap, phone2numeric
-from django.utils.safestring import mark_safe, SafeData, mark_for_escaping
-from django.utils import six
+from django.utils.safestring import SafeData, mark_for_escaping, mark_safe
+from django.utils.text import (
+ Truncator, normalize_newlines, phone2numeric, slugify as _slugify, wrap,
+)
from django.utils.timesince import timesince, timeuntil
from django.utils.translation import ugettext, ungettext
-from django.utils.text import normalize_newlines, slugify as _slugify
register = Library()
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index b65bed7bf8..a75248332c 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -2,28 +2,29 @@
from __future__ import unicode_literals
import os
-import sys
import re
-from datetime import datetime
-from itertools import groupby, cycle as itertools_cycle
+import sys
import warnings
+from datetime import datetime
+from itertools import cycle as itertools_cycle, groupby
from django.conf import settings
-from django.template.base import (Node, NodeList, Template, Context, Library,
- TemplateSyntaxError, VariableDoesNotExist, InvalidTemplateLibrary,
- BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END,
- SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END,
- VARIABLE_ATTRIBUTE_SEPARATOR, get_library, token_kwargs, kwarg_re,
- render_value_in_context)
-from django.template.smartif import IfParser, Literal
+from django.template.base import (
+ BLOCK_TAG_END, BLOCK_TAG_START, COMMENT_TAG_END, COMMENT_TAG_START,
+ SINGLE_BRACE_END, SINGLE_BRACE_START, VARIABLE_ATTRIBUTE_SEPARATOR,
+ VARIABLE_TAG_END, VARIABLE_TAG_START, Context, InvalidTemplateLibrary,
+ Library, Node, NodeList, Template, TemplateSyntaxError,
+ VariableDoesNotExist, get_library, kwarg_re, render_value_in_context,
+ token_kwargs,
+)
from django.template.defaultfilters import date
+from django.template.smartif import IfParser, Literal
+from django.utils import six, timezone
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text, smart_text
-from django.utils.lorem_ipsum import words, paragraphs
-from django.utils.safestring import mark_safe
from django.utils.html import format_html
-from django.utils import six
-from django.utils import timezone
+from django.utils.lorem_ipsum import paragraphs, words
+from django.utils.safestring import mark_safe
register = Library()
diff --git a/django/template/engine.py b/django/template/engine.py
index edd731a46c..6856dd960f 100644
--- a/django/template/engine.py
+++ b/django/template/engine.py
@@ -1,8 +1,7 @@
import warnings
from django.core.exceptions import ImproperlyConfigured
-from django.utils import lru_cache
-from django.utils import six
+from django.utils import lru_cache, six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
@@ -10,7 +9,6 @@ from django.utils.module_loading import import_string
from .base import Context, Lexer, Parser, Template, TemplateDoesNotExist
from .context import _builtin_context_processors
-
_context_instance_undefined = object()
_dictionary_undefined = object()
_dirs_undefined = object()
diff --git a/django/template/loader.py b/django/template/loader.py
index c03690fbd1..c8fb16bf92 100644
--- a/django/template/loader.py
+++ b/django/template/loader.py
@@ -6,7 +6,9 @@ from . import engines
from .backends.django import DjangoTemplates
from .base import Origin, TemplateDoesNotExist
from .engine import (
- _context_instance_undefined, _dictionary_undefined, _dirs_undefined)
+ _context_instance_undefined, _dictionary_undefined, _dirs_undefined,
+)
+from .loaders import base
class LoaderOrigin(Origin):
@@ -142,10 +144,6 @@ def _engine_list(using=None):
return engines.all() if using is None else [engines[using]]
-# This line must remain at the bottom to avoid import loops.
-from .loaders import base
-
-
class BaseLoader(base.Loader):
_accepts_engine_in_init = False
diff --git a/django/template/loader_tags.py b/django/template/loader_tags.py
index b41b1ea4c3..f1c08ee955 100644
--- a/django/template/loader_tags.py
+++ b/django/template/loader_tags.py
@@ -1,9 +1,10 @@
from collections import defaultdict
-from django.template.base import TemplateSyntaxError, Library, Node, TextNode,\
- token_kwargs, Variable
-from django.utils.safestring import mark_safe
+from django.template.base import (
+ Library, Node, TemplateSyntaxError, TextNode, Variable, token_kwargs,
+)
from django.utils import six
+from django.utils.safestring import mark_safe
register = Library()
diff --git a/django/template/loaders/cached.py b/django/template/loaders/cached.py
index aead14490a..6736fbef9e 100644
--- a/django/template/loaders/cached.py
+++ b/django/template/loaders/cached.py
@@ -4,6 +4,7 @@ to load templates from them in order, caching the result.
"""
import hashlib
+
from django.template.base import Template, TemplateDoesNotExist
from django.utils.encoding import force_bytes
diff --git a/django/template/loaders/eggs.py b/django/template/loaders/eggs.py
index 42b43bab2d..e4bea4d5d1 100644
--- a/django/template/loaders/eggs.py
+++ b/django/template/loaders/eggs.py
@@ -1,17 +1,17 @@
# Wrapper for loading templates from eggs via pkg_resources.resource_string.
from __future__ import unicode_literals
-try:
- from pkg_resources import resource_string
-except ImportError:
- resource_string = None
-
from django.apps import apps
from django.template.base import TemplateDoesNotExist
from django.utils import six
from .base import Loader as BaseLoader
+try:
+ from pkg_resources import resource_string
+except ImportError:
+ resource_string = None
+
class Loader(BaseLoader):
is_usable = resource_string is not None
diff --git a/django/template/response.py b/django/template/response.py
index 48295c5e05..094907ed97 100644
--- a/django/template/response.py
+++ b/django/template/response.py
@@ -1,7 +1,7 @@
import warnings
from django.http import HttpResponse
-from django.template import loader, Context, RequestContext, Template
+from django.template import Context, RequestContext, Template, loader
from django.template.backends.django import Template as BackendTemplate
from django.template.context import _current_app_undefined
from django.utils import six
diff --git a/django/template/utils.py b/django/template/utils.py
index be2166810c..f9b322fea9 100644
--- a/django/template/utils.py
+++ b/django/template/utils.py
@@ -1,13 +1,12 @@
-from collections import Counter, OrderedDict
import os
import sys
import warnings
+from collections import Counter, OrderedDict
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
-from django.utils import lru_cache
-from django.utils import six
+from django.utils import lru_cache, six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.functional import cached_property
from django.utils.module_loading import import_string