runway.cfngin.ui module

CFNgin UI manipulation.

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

Just a wrapper for input() for testing purposes.

class runway.cfngin.ui.UI[source]

Bases: ContextManager[UI]

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).

__init__() None[source]

Instantiate class.

log(lvl: int, msg: Union[Exception, str], *args: Any, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = <RunwayLogger runway.cfngin.ui (WARNING)>, **kwargs: Any) None[source]

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

Parameters
  • lvl – Log level.

  • msg – String template or exception to use for the log record.

  • logger – Specific logger to log to.

info(msg: str, *args: Any, logger: Union[logging.Logger, logging.LoggerAdapter[Any]] = <RunwayLogger runway.cfngin.ui (WARNING)>, **kwargs: Any) None[source]

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

Parameters
  • msg – String template or exception to use for the log record.

  • logger – Specific logger to log to.

ask(message: str) str[source]

Collect input from a user in a multithreaded environment.

This wraps the built-in 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(prompt: str, stream: Optional[TextIO] = None) str[source]

Wrap getpass to lock the UI.

__enter__() runway.cfngin.ui.UI[source]

Enter the context manager.

__exit__(exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType]) None[source]

Exit the context manager.

__new__(**kwargs)