def __init__(self, func, types, typesentry_config):
# The Config object
self._tc = typesentry_config
# The original function that was inspected
self.function = func
# List of all parameters (Parameter objects), positional and keyword
self.params = []
# Parameter object for the return value
self.retval = Parameter("_return", kind="RETURN")
# Index of the vararg parameter in self.params
self._ivararg = None
# Index of the varkws parameter in self.params
self._ivarkws = None
self._iargs = dict()
# Maximum number of positional parameters (without varargs)
self._max_positional_args = 0
# Minimum number of arguments that must be supplied -- all the other
# have defaults and can be omitted.
self._min_positional_args = 0
# Names of keyword-only arguments that have no defaults
self._required_kwonly_args = set()
# 0 or 1 depending on whether the function has 'self' argument. This
# flag allows us to correctly report the number of arguments for a
# method (1 less than what the signature suggests).
self._num_self_args = 0
#--------------------------------------------------------
# This will initialize all of the arguments defined above
self._fill_from_inspection_spec(types)
# Function that can be invoked to check the type of the return value
self.return_checker = self._make_retval_checker()
# Function that can be invoked to check the arguments passed to the
# inspected function.
self.params_checker = self._make_args_checker()
评论列表
文章目录