mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #20989 -- Removed useless explicit list comprehensions.
This commit is contained in:
		| @@ -88,8 +88,8 @@ class VariableDoesNotExist(Exception): | ||||
|         self.params = params | ||||
|  | ||||
|     def __str__(self): | ||||
|         return self.msg % tuple([force_text(p, errors='replace') | ||||
|                                  for p in self.params]) | ||||
|         return self.msg % tuple(force_text(p, errors='replace') | ||||
|                                  for p in self.params) | ||||
|  | ||||
| class InvalidTemplateLibrary(Exception): | ||||
|     pass | ||||
| @@ -1012,7 +1012,7 @@ def parse_bits(parser, bits, params, varargs, varkw, defaults, | ||||
|         # Some positional arguments were not supplied | ||||
|         raise TemplateSyntaxError( | ||||
|             "'%s' did not receive value(s) for the argument(s): %s" % | ||||
|             (name, ", ".join(["'%s'" % p for p in unhandled_params]))) | ||||
|             (name, ", ".join("'%s'" % p for p in unhandled_params))) | ||||
|     return args, kwargs | ||||
|  | ||||
| def generic_tag_compiler(parser, token, params, varargs, varkw, defaults, | ||||
|   | ||||
| @@ -205,7 +205,7 @@ class ForNode(Node): | ||||
|                     # don't want to leave any vars from the previous loop on the | ||||
|                     # context. | ||||
|                     context.pop() | ||||
|         return mark_safe(''.join([force_text(n) for n in nodelist])) | ||||
|         return mark_safe(''.join(force_text(n) for n in nodelist)) | ||||
|  | ||||
| class IfChangedNode(Node): | ||||
|     child_nodelists = ('nodelist_true', 'nodelist_false') | ||||
| @@ -410,8 +410,8 @@ class URLNode(Node): | ||||
|     def render(self, context): | ||||
|         from django.core.urlresolvers import reverse, NoReverseMatch | ||||
|         args = [arg.resolve(context) for arg in self.args] | ||||
|         kwargs = dict([(smart_text(k, 'ascii'), v.resolve(context)) | ||||
|                        for k, v in self.kwargs.items()]) | ||||
|         kwargs = dict((smart_text(k, 'ascii'), v.resolve(context)) | ||||
|                        for k, v in self.kwargs.items()) | ||||
|  | ||||
|         view_name = self.view_name.resolve(context) | ||||
|  | ||||
| @@ -502,8 +502,8 @@ class WithNode(Node): | ||||
|         return "<WithNode>" | ||||
|  | ||||
|     def render(self, context): | ||||
|         values = dict([(key, val.resolve(context)) for key, val in | ||||
|                        six.iteritems(self.extra_context)]) | ||||
|         values = dict((key, val.resolve(context)) for key, val in | ||||
|                        six.iteritems(self.extra_context)) | ||||
|         with context.push(**values): | ||||
|             return self.nodelist.render(context) | ||||
|  | ||||
|   | ||||
| @@ -112,8 +112,8 @@ class ExtendsNode(Node): | ||||
|             # The ExtendsNode has to be the first non-text node. | ||||
|             if not isinstance(node, TextNode): | ||||
|                 if not isinstance(node, ExtendsNode): | ||||
|                     blocks = dict([(n.name, n) for n in | ||||
|                                    compiled_parent.nodelist.get_nodes_by_type(BlockNode)]) | ||||
|                     blocks = dict((n.name, n) for n in | ||||
|                                    compiled_parent.nodelist.get_nodes_by_type(BlockNode)) | ||||
|                     block_context.add_blocks(blocks) | ||||
|                 break | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user