launch.launch_context module

Module for LaunchContext class.

class launch.launch_context.LaunchContext[source]

Bases: object

Runtime context used by various launch entities when being visited or executed.

__init__(*, argv: Iterable[str] | None = None, noninteractive: bool = False) None[source]

Create a LaunchContext.

Param:

argv stored in the context for access by the entities, None results in []

Param:

noninteractive if True (not default), this service will assume it has no terminal associated e.g. it is being executed from a non interactive script

add_completion_future(completion_future: Future) None[source]

Add an asyncio.Future to the list of futures that the LaunchService will wait on.

property argv

Getter for argv.

property asyncio_loop

Getter for asyncio_loop.

async emit_event(event: Event) None[source]

Emit an event.

emit_event_sync(event: Event) None[source]

Emit an event synchronously.

property environment: MutableMapping[str, str]

Getter for environment variables dictionary.

extend_globals(extensions: Dict[str, Any]) None[source]

Extend the context.locals object permanently with new members.

These “globals” are in the context.locals, but are overridden by overlapping keys provided by extend_locals().

extend_locals(extensions: Dict[str, Any]) None[source]

Extend the context.locals object with new members until popped.

get_locals_as_dict() Dict[str, Any][source]

Access the context locals as a dictionary.

property is_shutdown

Getter for is_shutdown.

property launch_configurations: Dict[str, str]

Getter for launch_configurations dictionary.

property locals

Getter for the locals.

property noninteractive

Getter for noninteractive.

perform_substitution(substitution: Substitution) str[source]

Perform substitution on given Substitution.

register_event_handler(event_handler: BaseEventHandler, append=False) None[source]

Register a event handler.

Parameters:

append – if ‘true’, the new event handler will be executed after the previously registered ones. If not, it will prepend the old handlers.

unregister_event_handler(event_handler: BaseEventHandler) None[source]

Unregister an event handler.

would_handle_event(event: Event) bool[source]

Check whether an event would be handled or not.