Skip to content

Commit d177eeb

Browse files
committed
apply reorder-python-imports
1 parent c30675f commit d177eeb

59 files changed

Lines changed: 460 additions & 283 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/basic/cycle.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from __future__ import print_function
2-
from jinja2 import Environment
32

3+
from jinja2 import Environment
44

55
env = Environment(line_statement_prefix="#", variable_start_string="${", variable_end_string="}")
6-
7-
86
print(env.from_string("""\
97
<ul>
108
# for item in range(10)

examples/basic/debugger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import print_function
2+
23
from jinja2 import Environment
34
from jinja2.loaders import FileSystemLoader
45

56
env = Environment(loader=FileSystemLoader('templates'))
6-
77
tmpl = env.get_template('broken.html')
88
print(tmpl.render(seq=[3, 2, 4, 5, 3, 2, 0, 2, 1]))

examples/basic/inheritance.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
from __future__ import print_function
2+
23
from jinja2 import Environment
34
from jinja2.loaders import DictLoader
45

5-
66
env = Environment(loader=DictLoader({
77
'a': '''[A[{% block body %}{% endblock %}]]''',
88
'b': '''{% extends 'a' %}{% block body %}[B]{% endblock %}''',
99
'c': '''{% extends 'b' %}{% block body %}###{{ super() }}###{% endblock %}'''
1010
}))
11-
12-
1311
print(env.get_template('c').render())

examples/basic/test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import print_function
2+
23
from jinja2 import Environment
34
from jinja2.loaders import DictLoader
45

@@ -22,7 +23,5 @@
2223
{% macro conspirate() %}23{% endmacro %}
2324
'''
2425
}))
25-
26-
2726
tmpl = env.get_template("child.html")
2827
print(tmpl.render())

examples/basic/test_filter_and_linestatements.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import print_function
2-
from jinja2 import Environment
32

3+
from jinja2 import Environment
44

55
env = Environment(line_statement_prefix='%', variable_start_string="${", variable_end_string="}")
66
tmpl = env.from_string("""\
@@ -22,5 +22,4 @@
2222
% endfor
2323
% endfilter
2424
""")
25-
2625
print(tmpl.render(seq=range(10)))

examples/basic/test_loop_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import print_function
2+
23
from jinja2 import Environment
34

45
tmpl = Environment().from_string("""\
@@ -9,5 +10,4 @@
910
</ul>
1011
if condition: {{ 1 if foo else 0 }}
1112
""")
12-
1313
print(tmpl.render(foo=True))

examples/basic/translate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import print_function
2+
23
from jinja2 import Environment
34

45
env = Environment(extensions=['jinja2.ext.i18n'])

examples/bench.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
that we get a picture of how fast Jinja is for a semi real world
44
template. If a template engine is not installed the test is skipped.\
55
"""
6-
import sys
76
import cgi
7+
import sys
88
from timeit import Timer
9+
910
from jinja2 import Environment as JinjaEnvironment
1011

1112
context = {

examples/rwbench/djangoext.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
# -*- coding: utf-8 -*-
2-
from rwbench import ROOT
32
from os.path import join
3+
4+
from django import template as django_template_module
45
from django.conf import settings
6+
from django.template import Context as DjangoContext
7+
from django.template import loader as django_loader
8+
from django.template import Node
9+
from django.template import TokenParser
10+
from django.template import Variable
11+
from rwbench import dateformat
12+
from rwbench import ROOT
13+
514
settings.configure(
615
TEMPLATE_DIRS=(join(ROOT, 'django'),),
716
TEMPLATE_LOADERS=(
@@ -10,19 +19,12 @@
1019
)),
1120
)
1221
)
13-
from django.template import loader as django_loader, Context as DjangoContext, \
14-
Node, NodeList, Variable, TokenParser
15-
from django import template as django_template_module
16-
from django.template import Library
17-
1822

1923
# for django extensions. We monkey patch our extensions in so that
2024
# we don't have to initialize a more complex django setup.
2125
django_extensions = django_template_module.Library()
2226
django_template_module.builtins.append(django_extensions)
2327

24-
25-
from rwbench import dateformat
2628
django_extensions.filter(dateformat)
2729

2830

examples/rwbench/rwbench.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,32 @@
1111
:license: BSD.
1212
"""
1313
from __future__ import print_function
14+
1415
import sys
15-
from os.path import join, dirname, abspath
16+
from datetime import datetime
17+
from os.path import abspath
18+
from os.path import dirname
19+
from os.path import join
20+
from pstats import Stats
21+
from random import choice
22+
from random import randrange
23+
from timeit import Timer
24+
25+
from djangoext import django_loader
26+
from djangoext import DjangoContext
27+
from genshi.template import TemplateLoader as GenshiTemplateLoader
28+
from mako.lookup import TemplateLookup
29+
30+
from jinja2 import Environment
31+
from jinja2 import FileSystemLoader
32+
from jinja2.utils import generate_lorem_ipsum
33+
1634
try:
1735
from cProfile import Profile
1836
except ImportError:
1937
from profile import Profile
20-
from pstats import Stats
21-
ROOT = abspath(dirname(__file__))
2238

23-
from random import choice, randrange
24-
from datetime import datetime
25-
from timeit import Timer
26-
from jinja2 import Environment, FileSystemLoader
27-
from jinja2.utils import generate_lorem_ipsum
28-
from mako.lookup import TemplateLookup
29-
from genshi.template import TemplateLoader as GenshiTemplateLoader
39+
ROOT = abspath(dirname(__file__))
3040

3141

3242
def dateformat(x):
@@ -38,6 +48,7 @@ def dateformat(x):
3848
mako_lookup = TemplateLookup(directories=[join(ROOT, 'mako')])
3949
genshi_loader = GenshiTemplateLoader([join(ROOT, 'genshi')])
4050

51+
4152
class Article(object):
4253

4354
def __init__(self, id):
@@ -70,7 +81,6 @@ def __init__(self, username):
7081

7182
context = dict(users=users, articles=articles, page_navigation=navigation)
7283

73-
7484
jinja_template = jinja_env.get_template('index.html')
7585
mako_template = mako_lookup.get_template('index.html')
7686
genshi_template = genshi_loader.load('index.html')
@@ -83,7 +93,6 @@ def test_mako():
8393
mako_template.render_unicode(**context)
8494

8595

86-
from djangoext import django_loader, DjangoContext
8796
def test_django():
8897
# not cached because django is not thread safe and does
8998
# not cache by itself so it would be unfair to cache it here.

0 commit comments

Comments
 (0)