pytuflow.QCF.context#
- QCF.context(run_context='', context=None, parent=None)#
Create a
RunState
version of this object. The context will also be propagated to all child objects.The RunState instance will resolve all scenario and event scopes to a single event. For example, a command encompassed in “If Scenario” / “End if”, will be either included or removed based on the context provided.
- Parameters:
run_context (str | dict[str, str], optional) – A string in the format of the TUFLOW command line argument
"-s1 EXG -e1 100yr"
, or a dictionary with the same information using keys{'e1': '100yr', 's1': 'EXG'}
.context (Context, optional) – A Context instance to use instead of creating a new one. If not provided, a new Context will be created using the run_context string or dictionary.
parent (ControlFileRunState, optional) – The parent RunState instance. This will be passed to the created RunState instance.
- Returns:
Object with the context passed in.
- Return type:
RunState
Examples
>>> cf = ... # Assume cf is an instance of a ControlFileBuildState or similar >>> run_state = cf.context('-s1 EXG -e1 100yr')