예제 #1
0
def getargspec(object):  # pylint: disable=redefined-builtin
    """TFDecorator-aware replacement for inspect.getargspec.

  Args:
    object: A callable, possibly decorated.

  Returns:
    The `ArgSpec` that describes the signature of the outermost decorator that
    changes the callable's signature. If the callable is not decorated,
    `inspect.getargspec()` will be called directly on the callable.
  """
    decorators, target = tf_decorator.unwrap(object)
    return next((d.decorator_argspec
                 for d in decorators if d.decorator_argspec is not None),
                _inspect.getargspec(target))
예제 #2
0
def getfile(object):  # pylint: disable=redefined-builtin
    """TFDecorator-aware replacement for inspect.getfile."""
    return _inspect.getfile(tf_decorator.unwrap(object)[1])
예제 #3
0
def ismethod(object):  # pylint: disable=redefined-builtin
    """TFDecorator-aware replacement for inspect.ismethod."""
    return _inspect.ismethod(tf_decorator.unwrap(object)[1])