Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Typos and minor code cleanup #61

Merged
merged 4 commits into from

2 participants

@yole

I've spent some time studying Jinja2 source code in PyCharm, which happens to be pretty good at highlighting typos. The attached commits fix a few of them.

@mitsuhiko
Owner

It also seems to be pretty good at trashing newlines. Have to check what the actual changes are :)

@yole
@yole

Untrashed newlines.

@mitsuhiko mitsuhiko merged commit 2caef64 into from
@mitsuhiko
Owner

Appreciated :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 26, 2011
  1. @yole

    couple of typos in comments

    yole authored
  2. @yole

    fix typo in test name

    yole authored
  3. @yole
  4. @yole

    unused code

    yole authored
This page is out of date. Refresh to see the latest.
View
10 jinja2/environment.py
@@ -67,7 +67,7 @@ def copy_cache(cache):
def load_extensions(environment, extensions):
"""Load the extensions from the list and bind it to the environment.
- Returns a dict of instanciated environments.
+ Returns a dict of instantiated environments.
"""
result = {}
for extension in extensions:
@@ -239,7 +239,7 @@ def __init__(self,
# passed by keyword rather than position. However it's important to
# not change the order of arguments because it's used at least
# internally in those cases:
- # - spontaneus environments (i18n extension and Template)
+ # - spontaneous environments (i18n extension and Template)
# - unittests
# If parameter changes are required only add parameters at the end
# and don't change the arguments (or the defaults!) of the arguments
@@ -435,7 +435,7 @@ def _tokenize(self, source, name, filename=None, state=None):
return stream
def _generate(self, source, name, filename, defer_init=False):
- """Internal hook that can be overriden to hook a different generate
+ """Internal hook that can be overridden to hook a different generate
method in.
.. versionadded:: 2.5
@@ -443,7 +443,7 @@ def _generate(self, source, name, filename, defer_init=False):
return generate(source, self, name, filename, defer_init=defer_init)
def _compile(self, source, filename):
- """Internal hook that can be overriden to hook a different compile
+ """Internal hook that can be overridden to hook a different compile
method in.
.. versionadded:: 2.5
@@ -1053,7 +1053,7 @@ def __init__(self, gen):
def dump(self, fp, encoding=None, errors='strict'):
"""Dump the complete stream into a file or file-like object.
Per default unicode strings are written, if you want to encode
- before writing specifiy an `encoding`.
+ before writing specify an `encoding`.
Example usage::
View
8 jinja2/lexer.py
@@ -414,7 +414,7 @@ def __init__(self, environment):
(operator_re, TOKEN_OPERATOR, None)
]
- # assamble the root lexing rule. because "|" is ungreedy
+ # assemble the root lexing rule. because "|" is ungreedy
# we have to sort by length so that the lexer continues working
# as expected when we have parsing rules like <% for block and
# <%= for variables. (if someone wants asp like syntax)
@@ -491,7 +491,7 @@ def __init__(self, environment):
}
def _normalize_newlines(self, value):
- """Called for strings and template data to normlize it to unicode."""
+ """Called for strings and template data to normalize it to unicode."""
return newline_re.sub(self.newline_sequence, value)
def tokenize(self, source, name=None, filename=None, state=None):
@@ -571,7 +571,7 @@ def tokeniter(self, source, name, filename=None, state=None):
if m is None:
continue
- # we only match blocks and variables if brances / parentheses
+ # we only match blocks and variables if braces / parentheses
# are balanced. continue parsing with the lower rule which
# is the operator rule. do this only if the end tags look
# like operators
@@ -669,7 +669,7 @@ def tokeniter(self, source, name, filename=None, state=None):
# publish new function and start again
pos = pos2
break
- # if loop terminated without break we havn't found a single match
+ # if loop terminated without break we haven't found a single match
# either we are at the end of the file or we have a problem
else:
# end of text
View
3  jinja2/parser.py
@@ -223,7 +223,7 @@ def parse_block(self):
# raise a nicer error message in that case.
if self.stream.current.type == 'sub':
self.fail('Block names in Jinja have to be valid Python '
- 'identifiers and may not contain hypens, use an '
+ 'identifiers and may not contain hyphens, use an '
'underscore instead.')
node.body = self.parse_statements(('name:endblock',), drop_needle=True)
@@ -698,7 +698,6 @@ def parse_subscript(self, node):
arg = nodes.Const(attr_token.value, lineno=attr_token.lineno)
return nodes.Getitem(node, arg, 'load', lineno=token.lineno)
if token.type == 'lbracket':
- priority_on_attribute = False
args = []
while self.stream.current.type != 'rbracket':
if args:
View
8 jinja2/testsuite/lexnparse.py
@@ -169,7 +169,7 @@ def assert_error(code, expected):
except TemplateSyntaxError, e:
assert str(e) == expected, 'unexpected error message'
else:
- assert False, 'that was suposed to be an error'
+ assert False, 'that was supposed to be an error'
assert_error('{% for item in seq %}...{% endif %}',
"Encountered unknown tag 'endif'. Jinja was looking "
@@ -189,7 +189,7 @@ def assert_error(code, expected):
"that needs to be closed is 'for'.")
assert_error('{% block foo-bar-baz %}',
"Block names in Jinja have to be valid Python identifiers "
- "and may not contain hypens, use an underscore instead.")
+ "and may not contain hyphens, use an underscore instead.")
assert_error('{% unknown_tag %}',
"Encountered unknown tag 'unknown_tag'.")
@@ -317,7 +317,7 @@ def test_block_end_name(self):
self.assert_raises(TemplateSyntaxError, env.from_string,
'{% block x %}{% endblock y %}')
- def test_contant_casing(self):
+ def test_constant_casing(self):
for const in True, False, None:
tmpl = env.from_string('{{ %s }}|{{ %s }}|{{ %s }}' % (
str(const), str(const).lower(), str(const).upper()
@@ -327,7 +327,7 @@ def test_contant_casing(self):
def test_test_chaining(self):
self.assert_raises(TemplateSyntaxError, env.from_string,
'{{ foo is string is sequence }}')
- env.from_string('{{ 42 is string or 42 is number }}'
+ assert env.from_string('{{ 42 is string or 42 is number }}'
).render() == 'True'
def test_string_concatenation(self):
Something went wrong with that request. Please try again.