flake8
This commit is contained in:
parent
2077f10dc3
commit
0c2420b03a
5
glue.py
5
glue.py
@ -6,12 +6,14 @@ def glue(*args, **kwargs):
|
|||||||
Glue takes in any number of arguments, named or not, and any depth list
|
Glue takes in any number of arguments, named or not, and any depth list
|
||||||
It will flatten them all and return them joined with spaces.
|
It will flatten them all and return them joined with spaces.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _flatten(l):
|
def _flatten(l):
|
||||||
"""
|
"""
|
||||||
from: Cristian at http://stackoverflow.com/a/2158532
|
from: Cristian at http://stackoverflow.com/a/2158532
|
||||||
"""
|
"""
|
||||||
for el in l:
|
for el in l:
|
||||||
if isinstance(el, collections.Iterable) and not isinstance(el, basestring):
|
if isinstance(el, collections.Iterable)\
|
||||||
|
and not isinstance(el, basestring):
|
||||||
for sub in _flatten(el):
|
for sub in _flatten(el):
|
||||||
yield sub
|
yield sub
|
||||||
else:
|
else:
|
||||||
@ -21,7 +23,6 @@ def glue(*args, **kwargs):
|
|||||||
kwargs = collections.OrderedDict(
|
kwargs = collections.OrderedDict(
|
||||||
sorted(kwargs.items(), key=lambda t: t[0]))
|
sorted(kwargs.items(), key=lambda t: t[0]))
|
||||||
|
|
||||||
|
|
||||||
what_to_glue = list(args)
|
what_to_glue = list(args)
|
||||||
# Ignore all your keys, because you're doing this wrong anyway
|
# Ignore all your keys, because you're doing this wrong anyway
|
||||||
what_to_glue.extend([v for k, v in kwargs.iteritems()])
|
what_to_glue.extend([v for k, v in kwargs.iteritems()])
|
||||||
|
Loading…
Reference in New Issue
Block a user