Removed unneeded iter() calls.
A few of these were unnecessarily added in 2b281cc35e
.
This commit is contained in:
parent
dca67bb2c2
commit
f2b93b509c
|
@ -169,7 +169,7 @@ class AdminSite:
|
||||||
"""
|
"""
|
||||||
Get all the enabled actions as an iterable of (name, func).
|
Get all the enabled actions as an iterable of (name, func).
|
||||||
"""
|
"""
|
||||||
return iter(self._actions.items())
|
return self._actions.items()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def empty_value_display(self):
|
def empty_value_display(self):
|
||||||
|
|
|
@ -34,7 +34,7 @@ class GeometryCollection(GEOSGeometry):
|
||||||
self._check_allowed(init_geoms)
|
self._check_allowed(init_geoms)
|
||||||
|
|
||||||
# Creating the geometry pointer array.
|
# 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)
|
super().__init__(collection, **kwargs)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
|
|
|
@ -252,14 +252,13 @@ class ListMixin:
|
||||||
def _set_slice(self, index, values):
|
def _set_slice(self, index, values):
|
||||||
"Assign values to a slice of the object"
|
"Assign values to a slice of the object"
|
||||||
try:
|
try:
|
||||||
iter(values)
|
valueList = list(values)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise TypeError('can only assign an iterable to a slice')
|
raise TypeError('can only assign an iterable to a slice')
|
||||||
|
|
||||||
self._check_allowed(values)
|
self._check_allowed(valueList)
|
||||||
|
|
||||||
origLen = len(self)
|
origLen = len(self)
|
||||||
valueList = list(values)
|
|
||||||
start, stop, step = index.indices(origLen)
|
start, stop, step = index.indices(origLen)
|
||||||
|
|
||||||
# CAREFUL: index.step and step are not the same!
|
# CAREFUL: index.step and step are not the same!
|
||||||
|
|
|
@ -51,7 +51,7 @@ def normalize_together(option_together):
|
||||||
return ()
|
return ()
|
||||||
if not isinstance(option_together, (tuple, list)):
|
if not isinstance(option_together, (tuple, list)):
|
||||||
raise TypeError
|
raise TypeError
|
||||||
first_element = next(iter(option_together))
|
first_element = option_together[0]
|
||||||
if not isinstance(first_element, (tuple, list)):
|
if not isinstance(first_element, (tuple, list)):
|
||||||
option_together = (option_together,)
|
option_together = (option_together,)
|
||||||
# Normalize everything to tuples
|
# Normalize everything to tuples
|
||||||
|
|
|
@ -345,7 +345,7 @@ class HttpRequest:
|
||||||
yield from self
|
yield from self
|
||||||
|
|
||||||
def readlines(self):
|
def readlines(self):
|
||||||
return list(iter(self))
|
return list(self)
|
||||||
|
|
||||||
|
|
||||||
class QueryDict(MultiValueDict):
|
class QueryDict(MultiValueDict):
|
||||||
|
|
|
@ -320,7 +320,7 @@ class Token:
|
||||||
|
|
||||||
def split_contents(self):
|
def split_contents(self):
|
||||||
split = []
|
split = []
|
||||||
bits = iter(smart_split(self.contents))
|
bits = smart_split(self.contents)
|
||||||
for bit in bits:
|
for bit in bits:
|
||||||
# Handle translation-marked template pieces
|
# Handle translation-marked template pieces
|
||||||
if bit.startswith(('_("', "_('")):
|
if bit.startswith(('_("', "_('")):
|
||||||
|
|
|
@ -279,7 +279,7 @@ class JavaScriptCatalog(View):
|
||||||
trans_cat = self.translation._catalog
|
trans_cat = self.translation._catalog
|
||||||
trans_fallback_cat = self.translation._fallback._catalog if self.translation._fallback else {}
|
trans_fallback_cat = self.translation._fallback._catalog if self.translation._fallback else {}
|
||||||
seen_keys = set()
|
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:
|
if key == '' or key in seen_keys:
|
||||||
continue
|
continue
|
||||||
if isinstance(key, str):
|
if isinstance(key, str):
|
||||||
|
|
Loading…
Reference in New Issue