def source(self): handler = self.current_handler() # `getsourcefile` can return None and raise TypeError. try: source = inspect.getsourcefile(unwrap(handler)) except TypeError: source = None return normpath(source) if source else self.library.source
def lineno(self): handler = self.current_handler() try: lines, start_lineno = inspect.getsourcelines(unwrap(handler)) except (TypeError, OSError, IOError): return -1 for increment, line in enumerate(lines): if line.strip().startswith('def '): return start_lineno + increment return start_lineno
def _get_arg_spec(self, handler): handler = unwrap(handler) try: args, varargs, kws, defaults, kwo, kwo_defaults, annotations \ = getfullargspec(handler) except TypeError: # Can occur w/ C functions (incl. many builtins). return [], 'args', None, None, [], None, {} if ismethod(handler) or handler.__name__ == '__init__': args = args[1:] # Drop 'self'. return args, varargs, kws, defaults, kwo, kwo_defaults, annotations
def source(self): handler = self.current_handler() try: return normpath(inspect.getsourcefile(unwrap(handler))) except TypeError: return self.library.source
def _get_arg_spec(self, handler): handler = unwrap(handler) try: return getfullargspec(handler) except TypeError: # Can occur w/ C functions (incl. many builtins). return [], 'args', None, None, [], None, {}