Skip to content

Commit

Permalink
allow unwrap_all to work without the target argument (unwrapping the …
Browse files Browse the repository at this point in the history
…calling module)
  • Loading branch information
mahmoud committed May 26, 2016
1 parent da334eb commit 41391ee
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lithoxyl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ def unwrap(target, attr_name):
return


def unwrap_all(target):
def unwrap_all(target=None):
if target is None or isinstance(target, int):
target = target or 1
try:
target_module_name = sys._getframe(target).f_globals.__name__
calling_module = sys.modules[target_module_name]
except Exception:
raise ValueError('unable to wrap all with target: %r' % target)
target = calling_module

for attr_name in dir(target):
try:
unwrap(target, attr_name)
Expand Down

0 comments on commit 41391ee

Please sign in to comment.