mirror of
https://github.com/django/django.git
synced 2025-10-28 16:16:12 +00:00
[1.8.x] Sorted imports with isort; refs #23860.
Backport of 0ed7d15563 from master
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user