magpie.util¶
Module Contents¶
Classes¶
Functions¶
Return a short string representation of the given object. |
|
Return the cleaned text content from the given string (usually html content). |
|
Return a list of the PIDs of the children from the given process. |
|
Revalidate a |
|
Return a “smart” representation of an object according to its type: |
|
Smart pretty-print function that will print an object according to its type: |
|
Re-export of the |
Data¶
API¶
- magpie.util.TRUNCATION_MARKER¶
‘ […]’
- magpie.util.TRUNCATION_MARKER_LEN¶
‘len(…)’
- magpie.util.short_str(obj, maxlen: int = 80) str[source]¶
Return a short string representation of the given object.
- Parameters:
obj – the object for which we want a str representation
maxlen – the max numbers of chars allowed in the string output after which truncation will occur
- Returns:
A
strrepresentation with maximum lengthmaxlen
- magpie.util.clean_content(content: str) str[source]¶
Return the cleaned text content from the given string (usually html content).
- magpie.util.children_pids(pid) list[int][source]¶
Return a list of the PIDs of the children from the given process.
- magpie.util.revalidate(obj: msgspec.Struct) None[source]¶
Revalidate a
msgspec.Struct. This is useful when you had a struct that was valid some time before, it got modified (potentially to an invalid state), and you want to make sure it is still valid.- Parameters:
obj (msgspec.Struct) – the
msgspec.Structto revalidate- Returns:
Noneifobjvalidates successfully- Raises:
msgspec.ValidationError – on error
- magpie.util.console¶
‘Console(…)’
- class magpie.util.ColorScheme[source]¶
Bases:
magpie.datamodel.Base- folder_name: str¶
None
- link: str¶
None
- key: str¶
None
- value: str¶
None
- type: str¶
None
- magpie.util.colors¶
‘ColorScheme(…)’
- magpie.util.pformat_twig(t: magpie.datamodel.Twig) Iterator[str][source]¶
- magpie.util.pformat_folder(f: magpie.datamodel.Folder) Iterator[str][source]¶
- magpie.util.pformat(obj) str[source]¶
Return a “smart” representation of an object according to its type:
if a
Folderor aTwig, use our own functions for a neat displayif a
strprint a nicely formatted JSON string.