add doc for inspect.getargspec

This commit is contained in:
Prodesire 2017-11-14 08:27:36 +08:00
parent 23d8773c2d
commit bb6b045a61
2 changed files with 37 additions and 0 deletions

View File

@ -25,6 +25,7 @@ Content
compat
console
dict
inspect
misc
request
set

36
docs/inspect.rst Normal file
View File

@ -0,0 +1,36 @@
Inspect
-------
.. py:function:: pydu.inspect.getargspec(func)
Get the names and default values of a function's arguments.
A tuple of four things is returned: (args, varargs, varkw, defaults).
``args`` is a list of the argument names (it may contain nested lists).
``varargs`` and ``varkw`` are the names of the * and ** arguments or None.
``defaults`` is an n-tuple of the default values of the last n arguments.
>>> from pydu.inspect import getargspec
>>> def f(a, b=1, *c, **d):
... pass
>>> getargspect(f)
ArgSpec(args=['a', 'b'], varargs='c', keywords='d', defaults=(1,))
.. py:function:: pydu.inspect.get_func_args(func)
.. py:function:: pydu.inspect.get_func_full_args(func)
.. py:function:: pydu.inspect.func_accepts_kwargs(func)
.. py:function:: pydu.inspect.func_accepts_var_args(func)
.. py:function:: pydu.inspect.func_has_no_args(func)