runway.cfngin.ui module

CFNgin UI manipulation.

runway.cfngin.ui.get_raw_input(message)[source]

Just a wrapper for input() for testing purposes.

class runway.cfngin.ui.UI[source]

Bases: object

Used internally from terminal output in a multithreaded environment.

Ensures that two threads don’t write over each other while asking a user for input (e.g. in interactive mode).

Instantiate class.

lock(*_args, **_kwargs)[source]

Obtain an exclusive lock on the UI for the current thread.

log(lvl, msg, *args, **kwargs)[source]

Log the message if the current thread owns the underlying lock.

Parameters
  • lvl (int) – Log level.

  • msg (Union[str, Exception]) – String template or exception to use for the log record.

Keyword Arguments

logger (Union[logging.LoggerAdaptor, logging.Logger]) – Specific logger to log to.

unlock(*_args, **_kwargs)[source]

Release the lock on the UI.

info(msg, *args, **kwargs)[source]

Log the line if the current thread owns the underlying lock.

Parameters

msg (Union[str, Exception]) – String template or exception to use for the log record.

Keyword Arguments

logger (Union[logging.LoggerAdaptor, logging.Logger]) – Specific logger to log to.

ask(message)[source]

Collect input from a user in a multithreaded environment.

This wraps the built-in raw_input function to ensure that only 1 thread is asking for input from the user at a give time. Any process that tries to log output to the terminal will be blocked while the user is being prompted.

getpass(*args)[source]

Wrap getpass to lock the UI.