report.PatternCaption#
- class PatternCaption#
Bases:
Flow360BaseModelClass for setting up chart caption.
Attributes
- pattern: str#
The caption pattern containing placeholders like [case.name] and [case.id]. These placeholders will be replaced with the actual case name and ID when resolving the caption. For example, “The case is [case.name] with ID [case.id]”. Defaults to
"[case.name]".- Default:
'[case.name]'
Additional Constructors
- classmethod from_file(filename)#
Loads a
Flow360BaseModelfrom .json, or .yaml file.- Parameters:
filename (str) – Full path to the .yaml or .json file to load the
Flow360BaseModelfrom.- Returns:
An instance of the component class calling load.
- Return type:
Flow360BaseModel
Example
>>> params = Flow360BaseModel.from_file(filename='folder/sim.json')
Methods
- resolve(case)#
Resolves the pattern to the actual caption string using the provided case object.
- Parameters:
case (Case) – The case object containing name and id attributes.
- Returns:
The resolved caption string with placeholders replaced by actual values.
- Return type:
Examples
>>> caption = PatternCaption(pattern="The case is [case.name] with ID [case.id]") >>> case = Case(name="Example", id=123) >>> caption.resolve(case) 'The case is Example with ID 123'
- help(methods=False)#
Prints message describing the fields and methods of a
Flow360BaseModel.- Parameters:
methods (bool = False) – Whether to also print out information about object’s methods.
- Return type:
None
Example
>>> params.help(methods=True)