/opt/imh-python/lib/python3.9/site-packages/IPython/utils
NameSizeModeActions
tests/-0755rm
__pycache__/-0755rm
capture.py51610644editdlrm
colorable.py7860644editdlrm
coloransi.py69720644editdlrm
contexts.py16190644editdlrm
daemonize.py2000644editdlrm
data.py10150644editdlrm
decorators.py26800644editdlrm
dir2.py22320644editdlrm
docs.py860644editdlrm
encoding.py28430644editdlrm
eventful.py1380644editdlrm
frame.py30480644editdlrm
generics.py7060644editdlrm
importstring.py10500644editdlrm
io.py46310644editdlrm
ipstruct.py118560644editdlrm
jsonutil.py1480644editdlrm
localinterfaces.py1690644editdlrm
log.py1230644editdlrm
module_paths.py23270644editdlrm
openpy.py34170644editdlrm
path.py119370644editdlrm
process.py18780644editdlrm
py3compat.py16020644editdlrm
PyColorize.py108750644editdlrm
sentinel.py4210644editdlrm
shimmodule.py26690644editdlrm
signatures.py4740644editdlrm
strdispatch.py18380644editdlrm
sysinfo.py43650644editdlrm
syspathcontext.py19520644editdlrm
tempdir.py18670644editdlrm
terminal.py32060644editdlrm
text.py244280644editdlrm
timing.py42750644editdlrm
tokenutil.py50830644editdlrm
traitlets.py1430644editdlrm
tz.py13800644editdlrm
ulinecache.py6840644editdlrm
version.py12230644editdlrm
wildcard.py46120644editdlrm
_process_cli.py20200644editdlrm
_process_common.py70030644editdlrm
_process_posix.py86660644editdlrm
_process_win32.py61320644editdlrm
_process_win32_controller.py213290644editdlrm
_sysinfo.py450644editdlrm
__init__.py00644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/IPython/utils/decorators.py (2680B)
# encoding: utf-8 """Decorators that don't go anywhere else. This module contains misc. decorators that don't really go with another module in :mod:`IPython.utils`. Before putting something here please see if it should go into another topical module in :mod:`IPython.utils`. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- from typing import Sequence from IPython.utils.docs import GENERATING_DOCUMENTATION #----------------------------------------------------------------------------- # Code #----------------------------------------------------------------------------- def flag_calls(func): """Wrap a function to detect and flag when it gets called. This is a decorator which takes a function and wraps it in a function with a 'called' attribute. wrapper.called is initialized to False. The wrapper.called attribute is set to False right before each call to the wrapped function, so if the call fails it remains False. After the call completes, wrapper.called is set to True and the output is returned. Testing for truth in wrapper.called allows you to determine if a call to func() was attempted and succeeded.""" # don't wrap twice if hasattr(func, 'called'): return func def wrapper(*args,**kw): wrapper.called = False out = func(*args,**kw) wrapper.called = True return out wrapper.called = False wrapper.__doc__ = func.__doc__ return wrapper def undoc(func): """Mark a function or class as undocumented. This is found by inspecting the AST, so for now it must be used directly as @undoc, not as e.g. @decorators.undoc """ return func def sphinx_options( show_inheritance: bool = True, show_inherited_members: bool = False, exclude_inherited_from: Sequence[str] = tuple(), ): """Set sphinx options""" def wrapper(func): if not GENERATING_DOCUMENTATION: return func func._sphinx_options = dict( show_inheritance=show_inheritance, show_inherited_members=show_inherited_members, exclude_inherited_from=exclude_inherited_from, ) return func return wrapper