Skip to content

Commit

Permalink
added export
Browse files Browse the repository at this point in the history
  • Loading branch information
Istvan Bozso committed Feb 11, 2020
1 parent a8a090f commit 2b17866
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

__all__ = (
"Seq", "flat", "new_type", "str_t", "isiter", "all_same",
"make_object", "cat", "compose",
"fs", "load", "Enum", "namespace",
"make_object", "cat", "compose", "fs", "load", "Enum", "namespace",
"export",
)

py3 = sys.version_info[0] == 3
Expand All @@ -15,6 +15,13 @@
else:
str_t = basestring

def export(fn):
mod = sys.modules[fn.__module__]
if hasattr(mod, '__all__'):
mod.__all__.append(fn.__name__)
else:
mod.__all__ = [fn.__name__]
return fn

def flat(arg):
return tup(chain.from_iterable(map(tup, arg)))
Expand Down

0 comments on commit 2b17866

Please sign in to comment.