From bb6b045a615464b66b5847b344b8d6117f248530 Mon Sep 17 00:00:00 2001 From: Prodesire Date: Tue, 14 Nov 2017 08:27:36 +0800 Subject: [PATCH] add doc for inspect.getargspec --- docs/index.rst | 1 + docs/inspect.rst | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 docs/inspect.rst diff --git a/docs/index.rst b/docs/index.rst index 0973451..940c1f6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,6 +25,7 @@ Content compat console dict + inspect misc request set diff --git a/docs/inspect.rst b/docs/inspect.rst new file mode 100644 index 0000000..2e52dda --- /dev/null +++ b/docs/inspect.rst @@ -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) + +