landscape code quality
This commit is contained in:
@ -1,7 +1,17 @@
|
|||||||
def force_iterator(x):
|
""" Iterator utilities """
|
||||||
if isinstance(x, str):
|
|
||||||
return [x]
|
|
||||||
|
def force_iterator(mixed):
|
||||||
|
"""Sudo make me an iterator.
|
||||||
|
|
||||||
|
Deprecated.
|
||||||
|
|
||||||
|
:param mixed:
|
||||||
|
:return: Iterator, baby.
|
||||||
|
"""
|
||||||
|
if isinstance(mixed, str):
|
||||||
|
return [mixed]
|
||||||
try:
|
try:
|
||||||
return iter(x)
|
return iter(mixed)
|
||||||
except Exception as e:
|
except TypeError:
|
||||||
return [x] if x else []
|
return [mixed] if mixed else []
|
||||||
|
|||||||
Reference in New Issue
Block a user