我正在研究一个正在修改函数的关键字参数的装饰器库,并且该库正在做我想要它做的事情,但是在调试时,每当调用用户函数时,调试器都必须通过装饰器库代码。
我将装饰器实现为一个类(参见https://github.com/mapa17/configfy/blob/master/configfy/decorator.py)
并且用户函数由以下库代码包装:
def __call__(self, *args, **kwargs):
if self.needs_wrapping:
self.needs_wrapping = False
self.func = args[0]
functools.update_wrapper(self, self.func)
self.kwargs = self.__get_kw_args(self.func)
# If config file is specified in decorator, new kwargs can be precalculated!
if self.config is not None:
self.new_kwargs = self._get_new_kwargs()
return self
# Use precalculated kwargs if available
if self.new_kwargs is None:
new_kwargs = self._get_new_kwargs()
else:
new_kwargs = self.new_kwargs
# Overwrite them with any passed arguments; passed arguments have priority!
new_kwargs.update(kwargs)
# Call target (aka user) function with altered kwargs
return self.func(*args, **new_kwargs)
那么在调试时是否有可能以某种方式跳过这个库代码?