flow360.report.PatternCaption#

class PatternCaption#

Bases: Flow360BaseModel

Class for setting up chart caption.

pattern: str = '[case.name]'#

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]".

type_name: Literal['PatternCaption'] = 'PatternCaption'#
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:

str

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'