Skip to content

Commit

Permalink
new get arg spec in legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Sep 22, 2015
1 parent e72377f commit 7949e33
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/netius/base/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@
import inspect
import functools
import itertools
import collections

import urllib #@UnusedImport

ArgSpec = collections.namedtuple(
"ArgSpec",
["args", "varargs", "keywords", "defaults"]
)

root = sys.path.pop(0)
try: import urllib2
except ImportError: urllib2 = None
Expand Down Expand Up @@ -259,6 +265,11 @@ def walk(path, visit, arg):
exists = dir in names
not exists and dirs.remove(dir)

def getargspec(func):
has_full = hasattr(inspect, "getfullargspec")
if has_full: return ArgSpec(*inspect.getfullargspec(func)[:4])
else: return inspect.getargspec(func)

def reduce(*args, **kwargs):
if PYTHON_3: return functools.reduce(*args, **kwargs)
return _reduce(*args, **kwargs)
Expand Down

0 comments on commit 7949e33

Please sign in to comment.