text
stringlengths
0
828
""""""
Runs all of the registered display hook methods with the given value.
Look at the sys.displayhook documentation for more information.
:param value | <variant>
""""""
global _displayhooks
new_hooks = []
for hook_ref in _displayhooks:
hook = hook_ref()
if hook:
hook(value)
new_hooks.append(hook_ref)
_displayhooks = new_hooks
sys.__displayhook__(value)"
3704,"def excepthook(cls, error, trace):
""""""
Runs all of the registered exception hook methods with the given value.
Look at the sys.excepthook documentation for more information.
:param cls | <type>
error | <str>
trace | <traceback>
""""""
global _excepthooks
new_hooks = []
for hook_ref in _excepthooks:
hook = hook_ref()
if hook:
hook(cls, error, trace)
new_hooks.append(hook_ref)
_excepthook = new_hooks
sys.__excepthook__(cls, error, trace)"
3705,"def formatExcept(cls, error, trace):
""""""
Formats the inputted class, error, and traceback information to the standard
output commonly found in Python interpreters.
:param cls | <type>
error | <str>
trace | <traceback>
:return <str>
""""""
clsname = cls.__name__ if cls else 'UnknownError'
tb = 'Traceback (most recent call last):\n'
tb += ''.join(traceback.format_tb(trace))
tb += '{0}: {1}'.format(clsname, error)
return tb"
3706,"def registerDisplay(func):
""""""
Registers a function to the display hook queue to be called on hook.
Look at the sys.displayhook documentation for more information.
:param func | <callable>
""""""
setup()
ref = weakref.ref(func)
if ref not in _displayhooks:
_displayhooks.append(ref)"
3707,"def registerExcept(func):
""""""
Registers a function to the except hook queue to be called on hook.
Look at the sys.displayhook documentation for more information.
:param func | <callable>
""""""
setup()
ref = weakref.ref(func)
if ref not in _excepthooks:
_excepthooks.append(ref)"
3708,"def registerStdErr(func):
""""""
Registers a function to the print hook queue to be called on hook.
This method will also override the current sys.stdout variable with a new
<StreamHooks> instance. This will preserve any current sys.stdout
overrides while providing a hookable class for linking multiple methods to.
:param func | <callable>
""""""
if not isinstance(sys.stderr, StreamHooks):
sys.stderr = StreamHooks(sys.stderr)
ref = weakref.ref(func)
if ref not in sys.stderr.hooks:
sys.stderr.hooks.append(ref)"
3709,"def registerStdOut(func):
""""""
Registers a function to the print hook queue to be called on hook.
This method will also override the current sys.stdout variable with a new
<StreamHooks> instance. This will preserve any current sys.stdout
overrides while providing a hookable class for linking multiple methods to.
:param func | <callable>
""""""