Module contextlib

Context manager implementation

Functions

try (f, _except, finally) Safely execute a function
except (types, f) Handle exceptions of specific types
with (context, _do) Execute a function within a context
yield (...) Yield control back to function inside the current context
contextmanager (f) Create a ContextManager from a function
open (name, mode) Open a file with a given mode, ensuring to close it after
run_and_close (name, close_after) Run a clean copy of an app and close it after
run_if_closed (name) Run an app and close it after if it is not already running
suppress (...) Suppress exceptions of a given type
time_ensured (t) Ensure code execution takes a certain amount of time
time_padded (t_before, t_after) Wait before and after executing code

Class ContextManager

ContextManager:__enter (...) Enter (setup) the context
ContextManager:__exit (_type, value) Exit (teardown) the context

Class Exception

Exception:__init (_type, message) Create an Exception object
Exception.add_traceback (s, force) Recent traceback for error tracking


Functions

try (f, _except, finally)
Safely execute a function

Parameters:

  • f
  • _except
  • finally
except (types, f)
Handle exceptions of specific types

Parameters:

  • types
  • f
with (context, _do)
Execute a function within a context

Parameters:

  • context
  • _do
yield (...)
Yield control back to function inside the current context

Parameters:

  • ...
contextmanager (f)
Create a ContextManager from a function

Parameters:

  • f any function that yields
open (name, mode)
Open a file with a given mode, ensuring to close it after

Parameters:

  • name
  • mode
run_and_close (name, close_after)
Run a clean copy of an app and close it after

Parameters:

  • name
  • close_after
run_if_closed (name)
Run an app and close it after if it is not already running

Parameters:

  • name
suppress (...)
Suppress exceptions of a given type

Parameters:

  • ...
time_ensured (t)
Ensure code execution takes a certain amount of time

Parameters:

  • t
time_padded (t_before, t_after)
Wait before and after executing code

Parameters:

  • t_before
  • t_after

Class ContextManager

Context manager object
ContextManager:__enter (...)
Enter (setup) the context

Parameters:

  • ...
ContextManager:__exit (_type, value)
Exit (teardown) the context

Parameters:

  • _type
  • value

Class Exception

Exception object
Exception:__init (_type, message)
Create an Exception object

Parameters:

  • _type
  • message
Exception.add_traceback (s, force)
Recent traceback for error tracking

Parameters:

  • s
  • force
generated by LDoc 1.4.6 Last updated 2018-11-10 22:55:04