omnipy.shared.enums.display
| CLASS | DESCRIPTION |
|---|---|
DarkBackground |
Specifies whether the background color of the output is dark or light. |
DisplayColorSystem |
Supported display color systems for syntax highlighting. |
DisplayDimensionsUpdateMode |
Specifies how display dimensions should be updated. |
HexdumpSyntaxLanguage |
|
HorizontalOverflowMode |
Horizontal overflow modes for the output. Horizontal overflow modes have |
JsonSyntaxLanguage |
|
Justify |
Justification modes for the output. |
MaxTitleHeight |
|
PanelDesign |
Visual design for the layout of the output. |
PrettyPrinterLib |
Supported libraries for pretty printing of various data structures. |
PythonSyntaxLanguage |
|
SyntaxLanguage |
Supported languages for syntax recognition and highlighting. |
SyntaxLanguageSpec |
Specification of language for syntax recognition and highlighting. |
TextSyntaxLanguage |
|
VerticalOverflowMode |
Vertical overflow modes for the output. Vertical overflow modes have |
DarkBackground
Bases: LiteralEnum[str | bool]
Specifies whether the background color of the output is dark or light.
This is used for selecting the appropriate color scheme for syntax highlighting and other color styles. The dark background mode is automatically detected based on the terminal capabilities, but can be overridden by the user in the configs.
| ATTRIBUTE | DESCRIPTION |
|---|---|
AUTO |
Automatically detects whether the background color of the output is dark or light.
TYPE:
|
FALSE |
Specifies that the background color of the output is light.
TYPE:
|
Literals |
|
TRUE |
Specifies that the background color of the output is dark.
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
AUTO
class-attribute
instance-attribute
Automatically detects whether the background color of the output is dark or light.
FALSE
class-attribute
instance-attribute
Specifies that the background color of the output is light.
DisplayColorSystem
Bases: LiteralEnum[str]
Supported display color systems for syntax highlighting.
The color systems map to the color systems provided by the Rich library (https://rich.readthedocs.io/en/stable/console.html#color-systems). The names of the Omnipy attributes have been slightly modified to be more descriptive.
| ATTRIBUTE | DESCRIPTION |
|---|---|
ANSI_16 |
The standard ANSI color system, which supports 16 colors.
TYPE:
|
ANSI_256 |
The extended ANSI color system, which supports 256 colors.
TYPE:
|
ANSI_RGB |
The truecolor ANSI color system, which supports 16 million colors. Most
TYPE:
|
AUTO |
The default color system, which is automatically detected based on the
TYPE:
|
Literals |
|
WINDOWS_LEGACY |
The legacy Windows color system, for backwards compatibility with older
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
ANSI_16
class-attribute
instance-attribute
The standard ANSI color system, which supports 16 colors.
ANSI_256
class-attribute
instance-attribute
The extended ANSI color system, which supports 256 colors.
ANSI_RGB
class-attribute
instance-attribute
The truecolor ANSI color system, which supports 16 million colors. Most modern terminals support this color system.
AUTO
class-attribute
instance-attribute
The default color system, which is automatically detected based on the terminal capabilities. This is the default value.
Literals
class-attribute
instance-attribute
DisplayDimensionsUpdateMode
Bases: LiteralEnum[str]
Specifies how display dimensions should be updated.
| ATTRIBUTE | DESCRIPTION |
|---|---|
AUTO |
Automatically updates the
TYPE:
|
FIXED |
Updates the
TYPE:
|
Literals |
|
Source code in src/omnipy/shared/enums/display.py
AUTO
class-attribute
instance-attribute
Automatically updates the width and height dimension configs of the
relevant interface output based on the currently available display area
every time some output renders or (in some cases) when there is a change
in the available display area (e.g. a window is resized). Automatic
updates might not work in cases when the available display area can be
automatically determined (which is e.g. the case for PYCHARM_TERMINAL
and PYCHARM_IPYTHON user interface types). In those cases, the
specified dimensions are kept unchanged. Default values are defined for
each type of user interface .
FIXED
class-attribute
instance-attribute
Updates the width and height dimension config according to the
available display area only once at the start of the program. Default
values are defined for each type of user interface. The default values
can be overridden by the user in the configs, however users are then
advised to first set dims_mode to FIXED even when the current
display area cannot be automatically determined. Setting dims_mode to
FIXED retains the current dimensions at the time of the setting.
HexdumpSyntaxLanguage
Bases: LiteralEnum[str]
| ATTRIBUTE | DESCRIPTION |
|---|---|
HEXDUMP |
TYPE:
|
Literals |
|
Source code in src/omnipy/shared/enums/display.py
HorizontalOverflowMode
Bases: LiteralEnum[str]
Horizontal overflow modes for the output. Horizontal overflow modes have no effect on layout panels.
The horizontal overflow modes are:
- ELLIPSIS: Adds an ellipsis (...) at the end of the line if it
exceeds the width.
- CROP: Crops the line to fit within the width, without adding an
ellipsis.
- WRAP: Wraps the line to the next line if it exceeds the
width, breaking according to the specified syntax language.
| ATTRIBUTE | DESCRIPTION |
|---|---|
CROP |
TYPE:
|
ELLIPSIS |
TYPE:
|
Literals |
|
WRAP |
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
JsonSyntaxLanguage
Bases: LiteralEnum[str]
| ATTRIBUTE | DESCRIPTION |
|---|---|
JSON |
TYPE:
|
JSON5 |
TYPE:
|
JSON_LD |
TYPE:
|
Literals |
|
Source code in src/omnipy/shared/enums/display.py
Justify
Bases: LiteralEnum[str]
Justification modes for the output.
The justification modes are:
- LEFT: Left-justified text.
- RIGHT: Right-justified text.
- CENTER: Centered text.
| ATTRIBUTE | DESCRIPTION |
|---|---|
CENTER |
TYPE:
|
LEFT |
TYPE:
|
Literals |
|
RIGHT |
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
MaxTitleHeight
PanelDesign
Bases: LiteralEnum[str]
Visual design for the layout of the output.
The layout designs are:
- TABLE: The output is displayed as a simple table grid
- TABLE_SHOW_STYLE: The output is displayed as a simple table grid
- PANELS: The output is displayed as a set of panels
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
PANELS |
TYPE:
|
TABLE |
TYPE:
|
TABLE_SHOW_STYLE |
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
Literals
class-attribute
instance-attribute
PrettyPrinterLib
Bases: LiteralEnum[str]
Supported libraries for pretty printing of various data structures.
Comparison of RICH and DEVTOOLS for Python structures: the outputs are
more or less the same. However, the RICH library formats the width of
the output on a per-item basis, while the DEVTOOLS library formats the
width of the output based on the maximum width of the output. This means
that the RICH library will in many cases produce a more compact output,
which is typically recommended. However, the DEVTOOLS library might be
more suitable for visualizing Pydantic models with debug_mode set to
True, as it is specifically designed for that purpose.
| ATTRIBUTE | DESCRIPTION |
|---|---|
AUTO |
Automatically selects the pretty printer.
TYPE:
|
CODE |
Code pretty printer.
TYPE:
|
COLUMN |
Column pretty printer.
TYPE:
|
COMPACT_JSON |
Compact JSON pretty printer.
TYPE:
|
DEVTOOLS |
Devtools pretty printer for Python objects.
TYPE:
|
HEXDUMP |
Hexdump pretty printer.
TYPE:
|
Literals |
|
RICH |
Rich pretty printer for Python objects.
TYPE:
|
TEXT |
Text pretty printer.
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
AUTO
class-attribute
instance-attribute
Automatically selects the pretty printer.
The auto-selection of the pretty printer is based on:
-
Autodetection of the pretty printer based on specific content types, such as StrModel, ColumnModel, or PrintableTable.
-
The
syntaxconfig parameter, if other thanAUTO. The pretty printer is set to the default pretty printer for the specified syntax language subgroup (see subtypes ofSyntaxLanguage). -
If the
syntaxconfig parameter is set toAUTO, the pretty printer is finally determined based on the content of the output, this time in default mode.
the default pretty printer for a syntax language subgroup is
currently determined in the get_pretty_printer_from_syntax()
function in omnipy.data._display.text.pretty_printer.register,
while the mapping of content types to pretty printers is determined
in the get_pretty_printer_from_content() function in the same
module, based on the is_suitable_content() method of each pretty
printer class. The implementation of determining the pretty printer
when set to AUTO will likely change in the future.
CODE
class-attribute
instance-attribute
Code pretty printer.
The code pretty printer, which is used for displaying plain text containing code. The default syntax is Python.
COLUMN
class-attribute
instance-attribute
Column pretty printer.
The column pretty printer is the basis for tabular data display in Omnipy, with the regular panel layout providing the table formatting.
COMPACT_JSON
class-attribute
instance-attribute
Compact JSON pretty printer.
The compact-json library (https://github.com/masaccio/compact-json), which is used for compact formatting of JSON data structures.
DEVTOOLS
class-attribute
instance-attribute
Devtools pretty printer for Python objects.
The pretty printer of the Devtools library (https://python-devtools.helpmanual.io/), a general-purpose formatter of Python objects and specifically designed for visualizing Pydantic models.
HEXDUMP
class-attribute
instance-attribute
Hexdump pretty printer.
Hexdump pretty printer based on simple-hexdump for displaying binary content.
Literals
class-attribute
instance-attribute
RICH
class-attribute
instance-attribute
Rich pretty printer for Python objects.
The pretty printer of Rich library (https://rich.readthedocs.io/en/stable/), a general-purpose formatter of Python objects. This is the default value.
PythonSyntaxLanguage
Bases: LiteralEnum[str]
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
PYTHON |
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
SyntaxLanguage
Bases: JsonSyntaxLanguage, TextSyntaxLanguage, HexdumpSyntaxLanguage, PythonSyntaxLanguage
Supported languages for syntax recognition and highlighting.
A selected subset of the lexer languages supported by the Pygments library (https://pygments.org/languages/), assumed to be the ones most relevant for Omnipy.
| ATTRIBUTE | DESCRIPTION |
|---|---|
Literals |
|
Source code in src/omnipy/shared/enums/display.py
Literals
class-attribute
instance-attribute
Literals = Literal[
JsonSyntaxLanguage.Literals,
TextSyntaxLanguage.Literals,
HexdumpSyntaxLanguage.Literals,
PythonSyntaxLanguage.Literals,
]
SyntaxLanguageSpec
Bases: SyntaxLanguage
Specification of language for syntax recognition and highlighting.
The available values include all supported syntax languages (see
SyntaxLanguage), plus the AUTO option for automatic syntax
recognition.
| METHOD | DESCRIPTION |
|---|---|
is_hexdump_syntax |
Checks if the given syntax is a binary hexdump variant. |
is_json_syntax |
Checks if the given syntax is a JSON syntax. |
is_python_syntax |
Checks if the given syntax is a Python variant. |
is_supported_syntax_language |
Checks if the given syntax is a supported syntax language. |
is_syntax_language_spec |
Checks for a valid syntax language specification. |
is_text_syntax |
Checks if the given syntax is a general text syntax. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
AUTO |
Automatically select the syntax language.
TYPE:
|
Literals |
|
Source code in src/omnipy/shared/enums/display.py
AUTO
class-attribute
instance-attribute
Automatically select the syntax language.
Automatically set the syntax language in accordance with the specified
pretty printer selected for the output (e.g. specified in printer
config parameter). The syntax language specified in the
get_default_syntax_language() class method is selected.
is_hexdump_syntax
classmethod
is_hexdump_syntax(syntax: str) -> TypeIs[HexdumpSyntaxLanguage.Literals]
Checks if the given syntax is a binary hexdump variant.
is_json_syntax
classmethod
is_json_syntax(syntax: str) -> TypeIs[JsonSyntaxLanguage.Literals]
is_python_syntax
classmethod
is_python_syntax(syntax: str) -> TypeIs[PythonSyntaxLanguage.Literals]
Checks if the given syntax is a Python variant.
is_supported_syntax_language
classmethod
is_supported_syntax_language(syntax: str) -> TypeIs[SyntaxLanguage.Literals]
Checks if the given syntax is a supported syntax language.
is_syntax_language_spec
classmethod
is_syntax_language_spec(syntax: str) -> TypeIs[SyntaxLanguageSpec.Literals]
Checks for a valid syntax language specification.
This checks whether the syntax string is one of the supported
options for syntax language specification (including AUTO).
Source code in src/omnipy/shared/enums/display.py
is_text_syntax
classmethod
is_text_syntax(syntax: str) -> TypeIs[TextSyntaxLanguage.Literals]
Checks if the given syntax is a general text syntax.
TextSyntaxLanguage
Bases: LiteralEnum[str]
| ATTRIBUTE | DESCRIPTION |
|---|---|
BASH |
TYPE:
|
CSS |
TYPE:
|
HTML |
TYPE:
|
Literals |
|
MARKDOWN |
TYPE:
|
NUMPY |
TYPE:
|
SPARQL |
TYPE:
|
SQL |
TYPE:
|
TEX |
TYPE:
|
TEXT |
TYPE:
|
TOML |
TYPE:
|
XML |
TYPE:
|
YAML |
TYPE:
|
Source code in src/omnipy/shared/enums/display.py
VerticalOverflowMode
Bases: LiteralEnum[str]
Vertical overflow modes for the output. Vertical overflow modes have no effect on layout panels.
The vertical overflow modes are:
- CROP_TOP: Crops the top of the output if it exceeds the height.
- CROP_BOTTOM: Crops the bottom of the output if it exceeds the
height.
| ATTRIBUTE | DESCRIPTION |
|---|---|
CROP_BOTTOM |
TYPE:
|
CROP_TOP |
TYPE:
|
ELLIPSIS_BOTTOM |
TYPE:
|
ELLIPSIS_TOP |
TYPE:
|
Literals |
|