Removed unneeded iter() calls.

A few of these were unnecessarily added in 2b281cc35e.
This commit is contained in:
Sergey Fedoseev 2017-08-24 01:48:29 +05:00 committed by Tim Graham
parent dca67bb2c2
commit f2b93b509c
7 changed files with 8 additions and 9 deletions

View File

@ -169,7 +169,7 @@ class AdminSite:
"""
Get all the enabled actions as an iterable of (name, func).
"""
return iter(self._actions.items())
return self._actions.items()
@property
def empty_value_display(self):

View File

@ -34,7 +34,7 @@ class GeometryCollection(GEOSGeometry):
self._check_allowed(init_geoms)
# Creating the geometry pointer array.
collection = self._create_collection(len(init_geoms), iter(init_geoms))
collection = self._create_collection(len(init_geoms), init_geoms)
super().__init__(collection, **kwargs)
def __iter__(self):

View File

@ -252,14 +252,13 @@ class ListMixin:
def _set_slice(self, index, values):
"Assign values to a slice of the object"
try:
iter(values)
valueList = list(values)
except TypeError:
raise TypeError('can only assign an iterable to a slice')
self._check_allowed(values)
self._check_allowed(valueList)
origLen = len(self)
valueList = list(values)
start, stop, step = index.indices(origLen)
# CAREFUL: index.step and step are not the same!

View File

@ -51,7 +51,7 @@ def normalize_together(option_together):
return ()
if not isinstance(option_together, (tuple, list)):
raise TypeError
first_element = next(iter(option_together))
first_element = option_together[0]
if not isinstance(first_element, (tuple, list)):
option_together = (option_together,)
# Normalize everything to tuples

View File

@ -345,7 +345,7 @@ class HttpRequest:
yield from self
def readlines(self):
return list(iter(self))
return list(self)
class QueryDict(MultiValueDict):

View File

@ -320,7 +320,7 @@ class Token:
def split_contents(self):
split = []
bits = iter(smart_split(self.contents))
bits = smart_split(self.contents)
for bit in bits:
# Handle translation-marked template pieces
if bit.startswith(('_("', "_('")):

View File

@ -279,7 +279,7 @@ class JavaScriptCatalog(View):
trans_cat = self.translation._catalog
trans_fallback_cat = self.translation._fallback._catalog if self.translation._fallback else {}
seen_keys = set()
for key, value in itertools.chain(iter(trans_cat.items()), iter(trans_fallback_cat.items())):
for key, value in itertools.chain(trans_cat.items(), trans_fallback_cat.items()):
if key == '' or key in seen_keys:
continue
if isinstance(key, str):