utilities into separate files. * Added a log() function in ietf/utils. It uses syslog, but adds some information about where it was called from. - Legacy-Id: 130
14 lines
367 B
Python
14 lines
367 B
Python
import operator
|
|
|
|
def orl(list):
|
|
""" Return the "or" of every element in a list.
|
|
Used to generate "or" queries with a list of Q objects. """
|
|
return reduce(operator.__or__, list)
|
|
|
|
def flattenl(list):
|
|
""" Flatten a list one level, e.g., turn
|
|
[ ['a'], ['b'], ['c', 'd'] ] into
|
|
[ 'a', 'b', 'c', 'd' ]
|
|
"""
|
|
return reduce(operator.__concat__, list)
|