compositor
¶
Containg the compositor classes.
All examples shows the composed prompt in APPL functions.
DashList
¶
DashList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The dash list compositor.
Attributes:
-
_indexing
–The class default indexing mode is "dash".
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
DoubleLineSeparated
¶
DoubleLineSeparated(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: Compositor
The double line separated compositor.
Attributes:
-
_sep
–The class default separator is "\n\n".
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
IndentedList
¶
IndentedList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The indented list compositor.
Attributes:
-
_inc_indent
–The class default indentation is INDENT.
Example
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
InlineTagged
¶
InlineTagged(
tag: str,
*args: Any,
attrs: Optional[Dict[str, str]] = None,
tag_begin: str = "<{}{}>",
tag_end: str = "</{}>",
indent_inside: Union[str, int, None] = None,
**kwargs: Any
)
Bases: Tagged
The inline tagged compositor, which is used to wrap the content with a tag.
Attributes:
-
_sep
–The class default separator is "".
-
_indexing
–The class default indexing mode is no indexing.
-
_new_indent
–The class default indentation is "".
-
_is_inline
–The class default is True.
-
_indent_inside
(Optional[str]
) –This class does not support indentation inside.
Example
Parameters:
-
tag
(str
) –The tag name.
-
*args
(Any
, default:()
) –The arguments.
-
attrs
(Optional[Dict[str, str]]
, default:None
) –The attributes of the tag.
-
tag_begin
(str
, default:'<{}{}>'
) –The format of tag begin string.
-
tag_end
(str
, default:'</{}>'
) –The format of tag end string.
-
indent_inside
(Union[str, int, None]
, default:None
) –The indentation inside the tag.
-
**kwargs
(Any
, default:{}
) –The keyword arguments.
Source code in src/appl/compositor.py
LineSeparated
¶
LineSeparated(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: Compositor
The line separated compositor.
Attributes:
-
_sep
–The class default separator is "\n".
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
Logged
¶
Logged(
*args: Any,
prolog: str,
epilog: str,
indent_inside: Union[str, int, None] = None,
**kwargs: Any
)
Bases: LineSeparated
The logged compositor, which is used to wrap the content with logs.
Note the indent will also apply to the prolog and epilog.
Attributes:
Example
Parameters:
-
*args
(Any
, default:()
) –The arguments.
-
prolog
(str
) –The prolog string.
-
epilog
(str
) –The epilog string.
-
indent_inside
(Union[str, int, None]
, default:None
) –The indentation inside the prolog and epilog.
-
**kwargs
(Any
, default:{}
) –The keyword arguments.
Source code in src/appl/compositor.py
LowerLetterList
¶
LowerLetterList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The lower letter list compositor.
Attributes:
-
_indexing
–The class default indexing mode is "lower".
Example
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
LowerRomanList
¶
LowerRomanList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The lower roman list compositor.
Attributes:
-
_indexing
–The class default indexing mode is "roman".
Example
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
NoIndent
¶
NoIndent(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The list compositor with no indentation.
Attributes:
-
_inc_indent
–The class default indentation is "".
Example
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
NumberedList
¶
NumberedList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The number list compositor.
Attributes:
-
_indexing
–The class default indexing mode is "number".
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
StarList
¶
StarList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The star list compositor.
Attributes:
-
_indexing
–The class default indexing mode is "star".
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
Tagged
¶
Tagged(
tag: str,
*args: Any,
attrs: Optional[Dict[str, str]] = None,
tag_begin: str = "<{}{}>",
tag_end: str = "</{}>",
indent_inside: Union[str, int, None] = None,
**kwargs: Any
)
Bases: Logged
The tagged compositor, which is used to wrap the content with a tag.
Note the indent will also applyt to the tag indicator.
Attributes:
-
_indent_inside
(Optional[str]
) –The class default indentation inside prolog and epilog is 4 spaces.
Example
Parameters:
-
tag
(str
) –The tag name.
-
*args
(Any
, default:()
) –The arguments.
-
attrs
(Optional[Dict[str, str]]
, default:None
) –The attributes of the tag.
-
tag_begin
(str
, default:'<{}{}>'
) –The format of tag begin string.
-
tag_end
(str
, default:'</{}>'
) –The format of tag end string.
-
indent_inside
(Union[str, int, None]
, default:None
) –The indentation inside the tag.
-
**kwargs
(Any
, default:{}
) –The keyword arguments.
Source code in src/appl/compositor.py
UpperLetterList
¶
UpperLetterList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The upper letter list compositor.
Attributes:
-
_indexing
–The class default indexing mode is "upper".
Example
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
UpperRomanList
¶
UpperRomanList(
sep: Optional[str] = None,
indexing: Union[Indexing, Optional[str]] = None,
indent: Optional[Union[str, int]] = None,
new_indent: Optional[Union[str, int]] = None,
is_inline: Optional[bool] = None,
role: Optional[MessageRole] = None,
_ctx: Optional[PromptContext] = None,
)
Bases: LineSeparated
The upper roman list compositor.
Attributes:
-
_indexing
–The class default indexing mode is "Roman".
Example
Parameters:
-
sep
(Optional[str]
, default:None
) –The separator string. Defaults to use the class default.
-
indexing
(Union[Indexing, Optional[str]]
, default:None
) –The indexing mode. Defaults to use the class default.
-
indent
(Optional[Union[str, int]]
, default:None
) –The indentation string. Defaults to use the class default.
-
new_indent
(Optional[Union[str, int]]
, default:None
) –The new indentation string. Defaults to use the class default.
-
is_inline
(Optional[bool]
, default:None
) –Flag indicating if the modifier is inline. Defaults to use the class default.
-
role
(Optional[MessageRole]
, default:None
) –The role of the modifier. Defaults to use the class default.
-
_ctx
(Optional[PromptContext]
, default:None
) –The prompt context filled automatically by the APPL function.
Source code in src/appl/core/modifiers.py
iter
¶
iter(
lst: Iterable,
compositor: Optional[Compositor] = None,
_ctx: Optional[PromptContext] = None,
) -> Iterable
Iterate over the iterable list with the compositor.