urwid 5.1.3__tar.gz → 5.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {urwid-5.1.3 → urwid-5.2.0}/.github/labeler.yml +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/documentation-pdf.yml +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/documentation.yml +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/isolated_mypy.yml +2 -2
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/isolated_pylint.yml +2 -2
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/isolated_pyrefly.yml +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/pythonpackage.yml +10 -9
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/yamllint.yml +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/PKG-INFO +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/conftest.py +16 -1
- urwid-5.2.0/pylint-requirements.txt +1 -0
- {urwid-5.1.3 → urwid-5.2.0}/pyproject.toml +22 -5
- {urwid-5.1.3 → urwid-5.2.0}/pyrefly-requirements.txt +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/pytest_requirements.txt +2 -1
- {urwid-5.1.3 → urwid-5.2.0}/tox.ini +3 -3
- {urwid-5.1.3 → urwid-5.2.0}/urwid/__init__.py +14 -2
- urwid-5.2.0/urwid/ansi_parser/__init__.py +86 -0
- urwid-5.2.0/urwid/ansi_parser/_grammar.py +102 -0
- urwid-5.1.3/urwid/ansi_parser.py → urwid-5.2.0/urwid/ansi_parser/_parser.py +356 -637
- urwid-5.2.0/urwid/ansi_parser/_resolve.py +158 -0
- urwid-5.2.0/urwid/ansi_parser/_results.py +109 -0
- urwid-5.2.0/urwid/ansi_parser/_vt_parser.py +382 -0
- urwid-5.2.0/urwid/canvas/__init__.py +87 -0
- urwid-5.2.0/urwid/canvas/_base.py +600 -0
- urwid-5.2.0/urwid/canvas/_cache.py +230 -0
- urwid-5.2.0/urwid/canvas/_composite.py +820 -0
- urwid-5.2.0/urwid/canvas/_text.py +440 -0
- urwid-5.2.0/urwid/canvas/term/__init__.py +45 -0
- urwid-5.2.0/urwid/canvas/term/_cells.py +137 -0
- urwid-5.2.0/urwid/canvas/term/_editing.py +522 -0
- urwid-5.2.0/urwid/canvas/term/_modes.py +408 -0
- urwid-5.2.0/urwid/canvas/term/_palette.py +182 -0
- urwid-5.2.0/urwid/canvas/term/_parser.py +908 -0
- urwid-5.2.0/urwid/canvas/term/_rectangles.py +381 -0
- urwid-5.2.0/urwid/canvas/term/_reports.py +356 -0
- urwid-5.2.0/urwid/canvas/term/_screen.py +1183 -0
- urwid-5.2.0/urwid/canvas/term/_state.py +256 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_posix_raw_display.py +56 -11
- urwid-5.2.0/urwid/display/_raw_display_base/__init__.py +52 -0
- urwid-5.2.0/urwid/display/_raw_display_base/_attributes.py +193 -0
- urwid-5.2.0/urwid/display/_raw_display_base/_base.py +633 -0
- urwid-5.2.0/urwid/display/_raw_display_base/_detection.py +742 -0
- urwid-5.2.0/urwid/display/_raw_display_base/_input.py +388 -0
- urwid-5.2.0/urwid/display/_raw_display_base/_modes.py +601 -0
- urwid-5.2.0/urwid/display/_raw_display_base/_screen.py +391 -0
- urwid-5.2.0/urwid/display/_sgr.py +444 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_web.css +2 -1
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_web.js +27 -2
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_web_common.py +2 -1
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_win32_raw_display.py +78 -38
- urwid-5.2.0/urwid/display/common/__init__.py +193 -0
- urwid-5.2.0/urwid/display/common/_attr_spec.py +953 -0
- urwid-5.2.0/urwid/display/common/_colors.py +527 -0
- urwid-5.2.0/urwid/display/common/_css.py +127 -0
- urwid-5.2.0/urwid/display/common/_depth.py +442 -0
- urwid-5.2.0/urwid/display/common/_screen.py +581 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/curses.py +182 -105
- urwid-5.2.0/urwid/display/escape/__init__.py +233 -0
- urwid-5.2.0/urwid/display/escape/_input.py +298 -0
- urwid-5.2.0/urwid/display/escape/_keys.py +293 -0
- urwid-5.2.0/urwid/display/escape/_mouse.py +118 -0
- urwid-5.2.0/urwid/display/escape/_sequences.py +325 -0
- urwid-5.2.0/urwid/display/escape/_trie.py +955 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/html_fragment.py +15 -2
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/web.py +72 -14
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/abstract_loop.py +7 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/asyncio_loop.py +23 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/glib_loop.py +13 -11
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/guarded_loop.py +4 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/main_loop.py +148 -22
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/tornado_loop.py +59 -13
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/trio_loop.py +31 -9
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/twisted_loop.py +34 -5
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/zmq_loop.py +32 -3
- urwid-5.2.0/urwid/log_handler.py +358 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/str_util.py +33 -1
- {urwid-5.1.3 → urwid-5.2.0}/urwid/util.py +22 -3
- {urwid-5.1.3 → urwid-5.2.0}/urwid/version.py +3 -3
- urwid-5.2.0/urwid/vterm.py +1134 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/__init__.py +7 -1
- urwid-5.2.0/urwid/widget/_pop_up_list.py +211 -0
- urwid-5.2.0/urwid/widget/action_menu.py +790 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/bar_graph.py +42 -2
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/columns.py +105 -12
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/constants.py +7 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/container.py +40 -2
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/deque_walker.py +5 -1
- urwid-5.2.0/urwid/widget/drop_down.py +332 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/edit.py +2 -2
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/filler.py +41 -10
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/frame.py +24 -23
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/grid_flow.py +21 -13
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/line_box.py +9 -5
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/list_walker.py +12 -2
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/listbox.py +176 -14
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/monitored_deque.py +159 -34
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/monitored_list.py +19 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/notifications.py +7 -3
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/pile.py +18 -11
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/popup.py +303 -41
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/scrollable.py +39 -1
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/table.py +757 -96
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/tabs.py +13 -2
- urwid-5.2.0/urwid/widget/terminal_output.py +237 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/widget.py +44 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid.egg-info/PKG-INFO +1 -1
- {urwid-5.1.3 → urwid-5.2.0}/urwid.egg-info/SOURCES.txt +45 -5
- {urwid-5.1.3 → urwid-5.2.0}/urwid.egg-info/scm_file_list.json +52 -5
- urwid-5.2.0/urwid.egg-info/scm_version.json +8 -0
- urwid-5.1.3/pylint-requirements.txt +0 -1
- urwid-5.1.3/urwid/canvas.py +0 -1758
- urwid-5.1.3/urwid/display/_raw_display_base.py +0 -1988
- urwid-5.1.3/urwid/display/common.py +0 -1701
- urwid-5.1.3/urwid/display/escape.py +0 -1663
- urwid-5.1.3/urwid/vterm.py +0 -2530
- urwid-5.1.3/urwid/widget/drop_down.py +0 -267
- urwid-5.1.3/urwid.egg-info/scm_version.json +0 -8
- {urwid-5.1.3 → urwid-5.2.0}/.devcontainer/dev.dockerfile +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.devcontainer/devcontainer.json +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.devcontainer/docs-pdf/devcontainer.json +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.dockerignore +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.editorconfig +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/CODE_OF_CONDUCT.md +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/ISSUE_TEMPLATE/docs.md +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/ISSUE_TEMPLATE/question.md +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/dependabot.yml +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/release.yml +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.github/workflows/labels.yml +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.gitignore +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.pre-commit-config.yaml +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/.yamllint.yml +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/COPYING +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/MANIFEST.in +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/README.rst +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/SECURITY.md +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/classifiers.txt +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/mypy-requirements.txt +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/requirements.txt +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/setup.cfg +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/_deprecation.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/_selectors.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/command_map.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/__init__.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_web_common.js +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_websocket.css +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_websocket.html +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_websocket.js +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/_win32.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/lcd.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/raw.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/display/websocket.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/__init__.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/event_loop/select_loop.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/font.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/graphics.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/numedit.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/py.typed +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/signals.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/split_repr.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/testing.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/text_layout.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/ansi_text.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/attr_map.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/attr_wrap.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/big_text.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/box_adapter.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/divider.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/filtered_walker.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/overlay.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/overlay_stack.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/padding.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/progress_bar.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/solid_fill.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/spinner.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/text.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/treetools.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/widget_decoration.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid/widget/wimp.py +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid.egg-info/dependency_links.txt +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid.egg-info/not-zip-safe +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid.egg-info/requires.txt +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/urwid.egg-info/top_level.txt +0 -0
- {urwid-5.1.3 → urwid-5.2.0}/yamllint-requirements.txt +0 -0
|
@@ -17,13 +17,13 @@ jobs:
|
|
|
17
17
|
steps:
|
|
18
18
|
- uses: actions/checkout@v7
|
|
19
19
|
- name: Install uv
|
|
20
|
-
uses: astral-sh/setup-uv@v10.
|
|
20
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
21
21
|
- name: Create virtual environment
|
|
22
22
|
run: uv venv --python 3.14
|
|
23
23
|
- name: Install package with all extras
|
|
24
24
|
run: uv pip install -e ".[curses,serial,tornado,trio,twisted,zmq]"
|
|
25
25
|
- name: Install dependencies
|
|
26
26
|
run: uv pip install --upgrade -r mypy-requirements.txt
|
|
27
|
-
# tests other than tests/type_checks are not checked, see [tool.ruff]
|
|
27
|
+
# tests other than tests/type_checks are not checked, see [tool.ruff.lint] exclude in pyproject.toml
|
|
28
28
|
- name: Type check with mypy
|
|
29
29
|
run: uv run --no-project mypy urwid examples tests/type_checks
|
|
@@ -17,13 +17,13 @@ jobs:
|
|
|
17
17
|
steps:
|
|
18
18
|
- uses: actions/checkout@v7
|
|
19
19
|
- name: Install uv
|
|
20
|
-
uses: astral-sh/setup-uv@v10.
|
|
20
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
21
21
|
- name: Create virtual environment
|
|
22
22
|
run: uv venv --python 3.14
|
|
23
23
|
- name: Install package with all extras
|
|
24
24
|
run: uv pip install -e ".[curses,serial,tornado,trio,twisted,zmq]"
|
|
25
25
|
- name: Install dependencies
|
|
26
26
|
run: uv pip install --upgrade -r pylint-requirements.txt
|
|
27
|
-
# tests are not checked, see [tool.ruff]
|
|
27
|
+
# tests are not checked, see [tool.ruff.lint] exclude in pyproject.toml
|
|
28
28
|
- name: Lint with pylint
|
|
29
29
|
run: uv run --no-project pylint --output-format=github urwid
|
|
@@ -53,14 +53,14 @@ jobs:
|
|
|
53
53
|
steps:
|
|
54
54
|
- uses: actions/checkout@v7
|
|
55
55
|
- name: Install uv
|
|
56
|
-
uses: astral-sh/setup-uv@v10.
|
|
56
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
57
57
|
- name: Create virtual environment
|
|
58
58
|
run: uv venv --python 3.14
|
|
59
59
|
- name: Install package with all extras
|
|
60
60
|
run: uv pip install -e ".[curses,serial,tornado,trio,twisted,zmq]"
|
|
61
61
|
- name: Install dependencies
|
|
62
62
|
run: uv pip install --upgrade -r pylint-requirements.txt
|
|
63
|
-
# tests are not checked, see [tool.ruff]
|
|
63
|
+
# tests are not checked, see [tool.ruff.lint] exclude in pyproject.toml
|
|
64
64
|
- name: Lint with pylint
|
|
65
65
|
run: uv run --no-project pylint --output-format=github urwid
|
|
66
66
|
|
|
@@ -70,14 +70,14 @@ jobs:
|
|
|
70
70
|
steps:
|
|
71
71
|
- uses: actions/checkout@v7
|
|
72
72
|
- name: Install uv
|
|
73
|
-
uses: astral-sh/setup-uv@v10.
|
|
73
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
74
74
|
- name: Create virtual environment
|
|
75
75
|
run: uv venv --python 3.14
|
|
76
76
|
- name: Install package with all extras
|
|
77
77
|
run: uv pip install -e ".[curses,serial,tornado,trio,twisted,zmq]"
|
|
78
78
|
- name: Install dependencies
|
|
79
79
|
run: uv pip install --upgrade -r mypy-requirements.txt
|
|
80
|
-
# tests other than tests/type_checks are not checked, see [tool.ruff]
|
|
80
|
+
# tests other than tests/type_checks are not checked, see [tool.ruff.lint] exclude in pyproject.toml
|
|
81
81
|
- name: Type check with mypy
|
|
82
82
|
run: uv run --no-project mypy urwid examples tests/type_checks
|
|
83
83
|
|
|
@@ -87,7 +87,7 @@ jobs:
|
|
|
87
87
|
steps:
|
|
88
88
|
- uses: actions/checkout@v7
|
|
89
89
|
- name: Install uv
|
|
90
|
-
uses: astral-sh/setup-uv@v10.
|
|
90
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
91
91
|
- name: Create virtual environment
|
|
92
92
|
run: uv venv --python 3.14
|
|
93
93
|
- name: Install package with all extras
|
|
@@ -132,7 +132,7 @@ jobs:
|
|
|
132
132
|
python-version: ${{ matrix.python-version }}
|
|
133
133
|
allow-prereleases: true
|
|
134
134
|
- name: Install uv
|
|
135
|
-
uses: astral-sh/setup-uv@v10.
|
|
135
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
136
136
|
- name: Create virtual environment
|
|
137
137
|
run: uv venv --python-preference only-system --python ${{ matrix.python-version }}
|
|
138
138
|
- name: Install dependencies
|
|
@@ -150,7 +150,8 @@ jobs:
|
|
|
150
150
|
&& 'serial,tornado,trio,twisted,zmq'
|
|
151
151
|
|| 'curses,serial,tornado,trio,twisted,zmq' }}]"
|
|
152
152
|
- name: Test
|
|
153
|
-
|
|
153
|
+
# One pytest-xdist worker per runner CPU.
|
|
154
|
+
run: uv run --no-project python -m pytest -n auto --cov-report=term --cov-report=xml
|
|
154
155
|
- name: Coveralls Parallel
|
|
155
156
|
uses: coverallsapp/github-action@v2
|
|
156
157
|
with:
|
|
@@ -179,7 +180,7 @@ jobs:
|
|
|
179
180
|
fetch-depth: 0 # need for setuptools_scm
|
|
180
181
|
|
|
181
182
|
- name: Install uv
|
|
182
|
-
uses: astral-sh/setup-uv@v10.
|
|
183
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
183
184
|
|
|
184
185
|
- name: Build dist
|
|
185
186
|
run: uv build
|
|
@@ -203,7 +204,7 @@ jobs:
|
|
|
203
204
|
steps:
|
|
204
205
|
- uses: actions/checkout@v7
|
|
205
206
|
- name: Install uv
|
|
206
|
-
uses: astral-sh/setup-uv@v10.
|
|
207
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
207
208
|
- uses: actions/download-artifact@v8
|
|
208
209
|
with:
|
|
209
210
|
# unpacks default artifact into dist/
|
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
steps:
|
|
18
18
|
- uses: actions/checkout@v7
|
|
19
19
|
- name: Install uv
|
|
20
|
-
uses: astral-sh/setup-uv@v10.
|
|
20
|
+
uses: astral-sh/setup-uv@v10.4.0
|
|
21
21
|
- name: Lint YAML files
|
|
22
22
|
run: uv run --no-project --with-requirements yamllint-requirements.txt yamllint . -f github
|
|
23
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Pytest configuration: skip
|
|
1
|
+
"""Pytest configuration: prepare the pytest-xdist controller, skip modules that cannot be imported here."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -9,6 +9,8 @@ import typing
|
|
|
9
9
|
if typing.TYPE_CHECKING:
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
12
14
|
IS_WINDOWS = sys.platform == "win32"
|
|
13
15
|
|
|
14
16
|
# Modules that import only on one platform. Urwid picks between them at runtime
|
|
@@ -50,6 +52,19 @@ def _backend_available(name: str) -> bool:
|
|
|
50
52
|
return True
|
|
51
53
|
|
|
52
54
|
|
|
55
|
+
def pytest_configure(config: pytest.Config) -> None:
|
|
56
|
+
"""Import urwid in the pytest-xdist controller before the workers start.
|
|
57
|
+
|
|
58
|
+
The controller rebuilds each warning a worker reports by importing the module that defines its class,
|
|
59
|
+
on one execnet receiver thread per worker.
|
|
60
|
+
Two such threads importing urwid modules for the first time at once deadlock in the import system,
|
|
61
|
+
which ends the run with ``INTERNALERROR`` (pytest-dev/pytest-xdist#1422).
|
|
62
|
+
Once urwid is imported, those imports are lookups in :data:`sys.modules`.
|
|
63
|
+
"""
|
|
64
|
+
if not hasattr(config, "workerinput"):
|
|
65
|
+
importlib.import_module("urwid")
|
|
66
|
+
|
|
67
|
+
|
|
53
68
|
def pytest_ignore_collect(collection_path: Path) -> bool | None:
|
|
54
69
|
"""Skip collecting a platform-only or optional-backend test module that cannot run here."""
|
|
55
70
|
name = collection_path.name
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pylint==4.1.4
|
|
@@ -85,6 +85,7 @@ pytest = [
|
|
|
85
85
|
"pytest-asyncio",
|
|
86
86
|
"pytest-cov",
|
|
87
87
|
"pytest-timeout",
|
|
88
|
+
"pytest-xdist",
|
|
88
89
|
]
|
|
89
90
|
ruff = [
|
|
90
91
|
"ruff",
|
|
@@ -119,10 +120,9 @@ skip = [ "pp*", "*-musllinux_*" ]
|
|
|
119
120
|
[tool.ruff]
|
|
120
121
|
target-version = "py311"
|
|
121
122
|
line-length = 120
|
|
122
|
-
# The test suite is not
|
|
123
|
-
# rule sets, and that is a gap to close rather than a decision.
|
|
123
|
+
# The test suite is not linted by ruff, or checked by mypy, pyrefly, pylint or refurb yet: it is not clean against
|
|
124
|
+
# their rule sets, and that is a gap to close rather than a decision. Its formatting is checked.
|
|
124
125
|
# tests/type_checks is the exception for mypy and pyrefly: it is a fixture written for them, and they check it.
|
|
125
|
-
extend-exclude = [ "tests" ]
|
|
126
126
|
output-format = "full"
|
|
127
127
|
[tool.ruff.format]
|
|
128
128
|
docstring-code-format = true
|
|
@@ -132,6 +132,19 @@ docstring-code-format = true
|
|
|
132
132
|
# Shown verbatim in the docs as numbered listings, wcur2.py from a fixed line (`:lines: 7-`).
|
|
133
133
|
"docs/tutorial/*.py" = [ "D100", "D101", "D102", "D103", "D107" ]
|
|
134
134
|
"docs/manual/*.py" = [ "D100", "D101", "D102", "D103", "D107" ]
|
|
135
|
+
"tests/**" = [
|
|
136
|
+
"S101", # a test states its expectation with assert, which pytest rewrites to report the compared values
|
|
137
|
+
"B023", # a closure made in a test loop runs in the iteration that made it
|
|
138
|
+
"E741", # short names such as l are the data of a test
|
|
139
|
+
"D100", # a docstring on every test module, class and method would only repeat its name
|
|
140
|
+
"D101",
|
|
141
|
+
"D102",
|
|
142
|
+
"D103",
|
|
143
|
+
"D104",
|
|
144
|
+
"D105",
|
|
145
|
+
"D106",
|
|
146
|
+
"D107",
|
|
147
|
+
]
|
|
135
148
|
[tool.ruff.lint.isort]
|
|
136
149
|
known-third-party = []
|
|
137
150
|
[tool.ruff.lint.pydocstyle]
|
|
@@ -144,6 +157,7 @@ allow-dunder-method-names = [
|
|
|
144
157
|
"_contents__setitem__", # class generation
|
|
145
158
|
]
|
|
146
159
|
[tool.ruff.lint]
|
|
160
|
+
exclude = [ "tests/**" ]
|
|
147
161
|
extend-select = [
|
|
148
162
|
"A", # flake8-builtins
|
|
149
163
|
"ASYNC", # flake8-async
|
|
@@ -290,6 +304,9 @@ exclude-protected = [
|
|
|
290
304
|
"_w", # API
|
|
291
305
|
"os._exit",
|
|
292
306
|
]
|
|
307
|
+
[tool.pylint.imports]
|
|
308
|
+
# mypy's strict mode takes `import name as name` as the explicit re-export of a name a package's __all__ does not list
|
|
309
|
+
allow-reexport-from-package = true
|
|
293
310
|
[tool.pylint.dunder]
|
|
294
311
|
good-dunder-names = [
|
|
295
312
|
"__rich_repr__",
|
|
@@ -353,7 +370,7 @@ disable_error_code = [
|
|
|
353
370
|
|
|
354
371
|
[tool.pyrefly]
|
|
355
372
|
python-version = "3.11.0"
|
|
356
|
-
# Docs are not checked; tests other than tests/type_checks are not checked, see [tool.ruff]
|
|
373
|
+
# Docs are not checked; tests other than tests/type_checks are not checked, see [tool.ruff.lint] exclude.
|
|
357
374
|
project-includes = [ "examples", "tests/type_checks", "urwid" ]
|
|
358
375
|
check-unannotated-defs = true
|
|
359
376
|
# PyGObject is only installed with the "glib" extra, which needs system libraries.
|
|
@@ -382,7 +399,7 @@ matches = "examples/**"
|
|
|
382
399
|
[tool.pyrefly.sub-config.errors]
|
|
383
400
|
bad-override = "ignore"
|
|
384
401
|
[[tool.pyrefly.sub-config]]
|
|
385
|
-
matches = "urwid/
|
|
402
|
+
matches = "urwid/canvas/term/_parser.py"
|
|
386
403
|
[tool.pyrefly.sub-config.errors]
|
|
387
404
|
# CSI_COMMANDS is a table of lambdas, and Pyrefly does not type them from the CSICommand.callback field.
|
|
388
405
|
implicit-any-lambda = "ignore"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
pyrefly==1.
|
|
1
|
+
pyrefly==1.5.0
|
|
2
2
|
types-pyserial==3.5.0.20261104
|
|
@@ -100,21 +100,21 @@ dependency_groups = pylint
|
|
|
100
100
|
extras =
|
|
101
101
|
{[testenv]extras}
|
|
102
102
|
glib
|
|
103
|
-
# tests are not checked, see [tool.ruff]
|
|
103
|
+
# tests are not checked, see [tool.ruff.lint] exclude in pyproject.toml
|
|
104
104
|
commands = pylint urwid
|
|
105
105
|
|
|
106
106
|
[testenv:refurb]
|
|
107
107
|
depends = ruff
|
|
108
108
|
deps = refurb
|
|
109
109
|
extras =
|
|
110
|
-
# tests are not checked, see [tool.ruff]
|
|
110
|
+
# tests are not checked, see [tool.ruff.lint] exclude in pyproject.toml
|
|
111
111
|
commands = refurb urwid examples
|
|
112
112
|
|
|
113
113
|
[testenv:mypy]
|
|
114
114
|
base_python = py314
|
|
115
115
|
depends = ruff
|
|
116
116
|
dependency_groups = mypy
|
|
117
|
-
# tests other than tests/type_checks are not checked, see [tool.ruff]
|
|
117
|
+
# tests other than tests/type_checks are not checked, see [tool.ruff.lint] exclude in pyproject.toml
|
|
118
118
|
commands = mypy urwid examples tests/type_checks
|
|
119
119
|
|
|
120
120
|
[testenv:pyrefly]
|
|
@@ -41,6 +41,7 @@ from urwid.canvas import (
|
|
|
41
41
|
SolidCanvas,
|
|
42
42
|
TextCanvas,
|
|
43
43
|
)
|
|
44
|
+
from urwid.canvas.term import TermCanvas, TermCharset, TermModes
|
|
44
45
|
from urwid.command_map import (
|
|
45
46
|
ACTIVATE,
|
|
46
47
|
CURSOR_DOWN,
|
|
@@ -160,6 +161,7 @@ from .widget import (
|
|
|
160
161
|
TOP,
|
|
161
162
|
WEIGHT,
|
|
162
163
|
AbstractWidget,
|
|
164
|
+
ActionMenu,
|
|
163
165
|
Align,
|
|
164
166
|
ANSIText,
|
|
165
167
|
AttrMap,
|
|
@@ -194,6 +196,7 @@ from .widget import (
|
|
|
194
196
|
ListBoxError,
|
|
195
197
|
ListWalker,
|
|
196
198
|
ListWalkerError,
|
|
199
|
+
MenuItem,
|
|
197
200
|
MonitoredDeque,
|
|
198
201
|
MonitoredFocusDeque,
|
|
199
202
|
MonitoredFocusList,
|
|
@@ -210,6 +213,7 @@ from .widget import (
|
|
|
210
213
|
Pile,
|
|
211
214
|
PileError,
|
|
212
215
|
PopUpLauncher,
|
|
216
|
+
PopUpPlacement,
|
|
213
217
|
PopUpTarget,
|
|
214
218
|
ProgressBar,
|
|
215
219
|
RadioButton,
|
|
@@ -232,6 +236,7 @@ from .widget import (
|
|
|
232
236
|
TableRow,
|
|
233
237
|
Tabs,
|
|
234
238
|
TabsError,
|
|
239
|
+
TerminalOutput,
|
|
235
240
|
Text,
|
|
236
241
|
TextError,
|
|
237
242
|
TreeListBox,
|
|
@@ -309,6 +314,7 @@ __all__: tuple[str, ...] = (
|
|
|
309
314
|
"YELLOW",
|
|
310
315
|
"ANSIText",
|
|
311
316
|
"AbstractWidget",
|
|
317
|
+
"ActionMenu",
|
|
312
318
|
"Align",
|
|
313
319
|
"AsyncioEventLoop",
|
|
314
320
|
"AttrMap",
|
|
@@ -369,6 +375,7 @@ __all__: tuple[str, ...] = (
|
|
|
369
375
|
"ListWalker",
|
|
370
376
|
"ListWalkerError",
|
|
371
377
|
"MainLoop",
|
|
378
|
+
"MenuItem",
|
|
372
379
|
"MetaSignals",
|
|
373
380
|
"MetaSuper",
|
|
374
381
|
"MonitoredDeque",
|
|
@@ -387,6 +394,7 @@ __all__: tuple[str, ...] = (
|
|
|
387
394
|
"Pile",
|
|
388
395
|
"PileError",
|
|
389
396
|
"PopUpLauncher",
|
|
397
|
+
"PopUpPlacement",
|
|
390
398
|
"PopUpTarget",
|
|
391
399
|
"ProgressBar",
|
|
392
400
|
"RadioButton",
|
|
@@ -418,6 +426,10 @@ __all__: tuple[str, ...] = (
|
|
|
418
426
|
"Tabs",
|
|
419
427
|
"TabsError",
|
|
420
428
|
"TagMarkupException",
|
|
429
|
+
"TermCanvas",
|
|
430
|
+
"TermCharset",
|
|
431
|
+
"TermModes",
|
|
432
|
+
"TerminalOutput",
|
|
421
433
|
"Text",
|
|
422
434
|
"TextCanvas",
|
|
423
435
|
"TextError",
|
|
@@ -515,9 +527,9 @@ else:
|
|
|
515
527
|
|
|
516
528
|
# OS Specific
|
|
517
529
|
if sys.platform != "win32":
|
|
518
|
-
from .vterm import
|
|
530
|
+
from .vterm import Terminal
|
|
519
531
|
|
|
520
|
-
__all__ += ("
|
|
532
|
+
__all__ += ("Terminal",)
|
|
521
533
|
|
|
522
534
|
# ZMQEventLoop cause interpreter crash on Windows
|
|
523
535
|
try:
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Urwid standalone ANSI/VT100 escape-sequence line parser
|
|
2
|
+
# Copyright (C) 2026 urwid contributors
|
|
3
|
+
#
|
|
4
|
+
# This library is free software; you can redistribute it and/or
|
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
6
|
+
# License as published by the Free Software Foundation; either
|
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+
# Lesser General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
15
|
+
# License along with this library; if not, write to the Free Software
|
|
16
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17
|
+
#
|
|
18
|
+
# Urwid web site: https://urwid.org/
|
|
19
|
+
"""Standalone ANSI/VT100 escape-sequence parsing, decoupled from any canvas.
|
|
20
|
+
|
|
21
|
+
This package extracts the platform-independent portion of the escape-sequence
|
|
22
|
+
grammar historically embedded inside :mod:`urwid.canvas.term`'s ``TermCanvas`` --
|
|
23
|
+
SGR colour/attribute interpretation, horizontal cursor movement, BEL, OSC
|
|
24
|
+
title, OSC 8 hyperlink, DEC Special Graphics and keyboard-LED recognition -- into a form that can be used to
|
|
25
|
+
interpret a single string (or a stream of chunks) of ANSI-coloured text
|
|
26
|
+
without instantiating a pty-backed :class:`~urwid.Terminal` widget.
|
|
27
|
+
|
|
28
|
+
Sequences that only make sense against a genuine two-dimensional screen
|
|
29
|
+
buffer (vertical cursor movement, scroll regions, mode toggles, and so
|
|
30
|
+
forth) are recognised, stripped from the resolved text and logged (see
|
|
31
|
+
:class:`SkippedOp`) rather than raising or being silently discarded without
|
|
32
|
+
trace.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
from __future__ import annotations
|
|
36
|
+
|
|
37
|
+
from urwid.ansi_parser._grammar import _CANCEL as _CANCEL
|
|
38
|
+
from urwid.ansi_parser._grammar import MAX_CSI_LENGTH, MAX_OSC_LENGTH, OSC_IGNORED_CONTROLS, ParseState
|
|
39
|
+
from urwid.ansi_parser._parser import _DEC_SPECIAL_GRAPHICS as _DEC_SPECIAL_GRAPHICS
|
|
40
|
+
from urwid.ansi_parser._parser import _FBTERM_COLOR_SGR as _FBTERM_COLOR_SGR
|
|
41
|
+
from urwid.ansi_parser._parser import _INLINE_CONTROLS as _INLINE_CONTROLS
|
|
42
|
+
from urwid.ansi_parser._parser import _LINE_END_PAIR as _LINE_END_PAIR
|
|
43
|
+
from urwid.ansi_parser._parser import _MAX_CURSOR_POSITION as _MAX_CURSOR_POSITION
|
|
44
|
+
from urwid.ansi_parser._parser import _MAX_SKIPPED as _MAX_SKIPPED
|
|
45
|
+
from urwid.ansi_parser._parser import _PADDING_BUDGET as _PADDING_BUDGET
|
|
46
|
+
from urwid.ansi_parser._parser import _PADDING_PER_CHARACTER as _PADDING_PER_CHARACTER
|
|
47
|
+
from urwid.ansi_parser._parser import _PADDING_PER_ROW as _PADDING_PER_ROW
|
|
48
|
+
from urwid.ansi_parser._parser import _TERMINAL_SETTING_CSI as _TERMINAL_SETTING_CSI
|
|
49
|
+
from urwid.ansi_parser._parser import _VERTICAL_MOVE_CSI as _VERTICAL_MOVE_CSI
|
|
50
|
+
from urwid.ansi_parser._parser import LOGGER as LOGGER
|
|
51
|
+
from urwid.ansi_parser._parser import AnsiParser, parse_ansi_line, parse_ansi_text
|
|
52
|
+
from urwid.ansi_parser._resolve import _LED_STATES as _LED_STATES
|
|
53
|
+
from urwid.ansi_parser._resolve import LedsLiteral as LedsLiteral
|
|
54
|
+
from urwid.ansi_parser._resolve import attrspec_with_hyperlink, led_state, resolve_osc_hyperlink, resolve_osc_title
|
|
55
|
+
from urwid.ansi_parser._results import _ASCII_SET as _ASCII_SET
|
|
56
|
+
from urwid.ansi_parser._results import CharsetState, ParsedLine, SkippedOp
|
|
57
|
+
from urwid.display._sgr import parse_sgr_parameters, sgi_params_to_attrspec, split_sgr_parameters
|
|
58
|
+
|
|
59
|
+
# Importable from this module in 5.1.3, where the SGR decoder that used them lived.
|
|
60
|
+
from urwid.display.common import _BASIC_COLORS as BASIC_COLORS
|
|
61
|
+
from urwid.display.common import _color_desc_256 as color_desc_256
|
|
62
|
+
from urwid.display.common import _color_desc_true as color_desc_true
|
|
63
|
+
|
|
64
|
+
# Defined in this module in 5.1.3.
|
|
65
|
+
from urwid.display.escape import BEL as BEL
|
|
66
|
+
from urwid.display.escape import ESC as ESC
|
|
67
|
+
|
|
68
|
+
__all__ = (
|
|
69
|
+
"MAX_CSI_LENGTH",
|
|
70
|
+
"MAX_OSC_LENGTH",
|
|
71
|
+
"OSC_IGNORED_CONTROLS",
|
|
72
|
+
"AnsiParser",
|
|
73
|
+
"CharsetState",
|
|
74
|
+
"ParseState",
|
|
75
|
+
"ParsedLine",
|
|
76
|
+
"SkippedOp",
|
|
77
|
+
"attrspec_with_hyperlink",
|
|
78
|
+
"led_state",
|
|
79
|
+
"parse_ansi_line",
|
|
80
|
+
"parse_ansi_text",
|
|
81
|
+
"parse_sgr_parameters",
|
|
82
|
+
"resolve_osc_hyperlink",
|
|
83
|
+
"resolve_osc_title",
|
|
84
|
+
"sgi_params_to_attrspec",
|
|
85
|
+
"split_sgr_parameters",
|
|
86
|
+
)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Urwid standalone ANSI/VT100 escape-sequence line parser
|
|
2
|
+
# Copyright (C) 2026 urwid contributors
|
|
3
|
+
#
|
|
4
|
+
# This library is free software; you can redistribute it and/or
|
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
6
|
+
# License as published by the Free Software Foundation; either
|
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+
# Lesser General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
15
|
+
# License along with this library; if not, write to the Free Software
|
|
16
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17
|
+
#
|
|
18
|
+
# Urwid web site: https://urwid.org/
|
|
19
|
+
|
|
20
|
+
"""The escape-sequence grammar both parsers share: the parser states, limits and control character sets."""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import enum
|
|
25
|
+
import typing
|
|
26
|
+
|
|
27
|
+
from urwid.display.escape import _C0_CONTROLS, BEL, ESC
|
|
28
|
+
|
|
29
|
+
#: CAN and SUB, which abort an escape sequence in progress.
|
|
30
|
+
_CANCEL = frozenset("\x18\x1a")
|
|
31
|
+
|
|
32
|
+
#: Control characters a terminal ignores inside an OSC string, unless they follow an ESC there: they are neither
|
|
33
|
+
#: executed nor part of the string. DEL is not among them: a terminal keeps it in the string.
|
|
34
|
+
OSC_IGNORED_CONTROLS = frozenset(map(chr, _C0_CONTROLS)) - {BEL, ESC, *_CANCEL}
|
|
35
|
+
|
|
36
|
+
#: The control characters ignored inside a DCS, SOS, PM or APC string: those of an OSC string, BEL, which ends only
|
|
37
|
+
#: OSC, and DEL, which the VT500 parser model ignores in a DCS string but keeps in an OSC string.
|
|
38
|
+
_COMMAND_STRING_IGNORED: typing.Final = OSC_IGNORED_CONTROLS | {BEL, "\x7f"}
|
|
39
|
+
|
|
40
|
+
#: The final bytes after ESC that open a DCS, SOS, PM and APC string, which are discarded up to their ST.
|
|
41
|
+
_COMMAND_STRING_OPENERS: typing.Final = frozenset("PX^_")
|
|
42
|
+
|
|
43
|
+
#: CSI parameter strings of this length or longer are skipped unparsed. Real sequences are far shorter (a truecolour
|
|
44
|
+
#: foreground and background SGR is under 50 characters). Staying below 640, the lowest limit
|
|
45
|
+
#: :func:`sys.set_int_max_str_digits` accepts, guarantees ``int()`` never rejects a parameter.
|
|
46
|
+
MAX_CSI_LENGTH = 256
|
|
47
|
+
|
|
48
|
+
#: OSC, DCS, SOS, PM and APC strings of this length or longer are skipped, and the rest of the string up to its
|
|
49
|
+
#: terminator, or up to an ESC starting a new sequence, is discarded unbuffered, so an unterminated string costs neither
|
|
50
|
+
#: memory nor quadratic string growth.
|
|
51
|
+
MAX_OSC_LENGTH = 4096
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class ParseState(enum.IntEnum):
|
|
55
|
+
"""State of an escape-sequence parser, shared by :class:`AnsiParser` and :class:`~urwid.TermCanvas`.
|
|
56
|
+
|
|
57
|
+
The parser is in :attr:`ESCAPE` both right after an ESC and while it reads no sequence at all; its flag for being
|
|
58
|
+
within an escape sequence tells the two apart.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
ESCAPE = 0
|
|
62
|
+
CSI = 1
|
|
63
|
+
OSC = 2
|
|
64
|
+
#: the intermediate bytes of an escape sequence (ECMA-35), such as the "(" of a G0 designation
|
|
65
|
+
ESC_INTERMEDIATE = 3
|
|
66
|
+
#: the discarded rest of an OSC string of :data:`MAX_OSC_LENGTH` or more, up to its terminator
|
|
67
|
+
OSC_OVERFLOW = 4
|
|
68
|
+
#: a DCS, SOS, PM or APC string, which only ST ends
|
|
69
|
+
COMMAND_STRING = 5
|
|
70
|
+
#: the discarded rest of a command string of :data:`MAX_OSC_LENGTH` or more, up to its ST
|
|
71
|
+
COMMAND_STRING_OVERFLOW = 6
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
#: the states of an OSC string, which BEL or ST ends
|
|
75
|
+
_OSC_STATES: typing.Final = frozenset((ParseState.OSC, ParseState.OSC_OVERFLOW))
|
|
76
|
+
#: the states of a DCS, SOS, PM or APC string, which only ST ends
|
|
77
|
+
_COMMAND_STRING_STATES: typing.Final = frozenset((ParseState.COMMAND_STRING, ParseState.COMMAND_STRING_OVERFLOW))
|
|
78
|
+
#: the states of a command string, in which control characters are ignored rather than executed
|
|
79
|
+
_STRING_STATES: typing.Final = _OSC_STATES | _COMMAND_STRING_STATES
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _csi_parameters(body: str | bytes | bytearray) -> list[int | None] | None:
|
|
83
|
+
"""Return the numeric parameters of the CSI parameter string *body*.
|
|
84
|
+
|
|
85
|
+
:returns: one number per ``;``-separated parameter, None for an empty one, so an empty *body* gives ``[None]``;
|
|
86
|
+
None when *body* holds anything but digits and ``;``: a sub-parameter, a private marker or an intermediate byte.
|
|
87
|
+
|
|
88
|
+
>>> _csi_parameters("1;;38")
|
|
89
|
+
[1, None, 38]
|
|
90
|
+
>>> _csi_parameters(b"?25") is None
|
|
91
|
+
True
|
|
92
|
+
"""
|
|
93
|
+
parameters: list[str] | list[bytes] | list[bytearray]
|
|
94
|
+
if isinstance(body, str):
|
|
95
|
+
if body.strip("0123456789;"):
|
|
96
|
+
return None
|
|
97
|
+
parameters = body.split(";")
|
|
98
|
+
else:
|
|
99
|
+
if body.strip(b"0123456789;"):
|
|
100
|
+
return None
|
|
101
|
+
parameters = body.split(b";")
|
|
102
|
+
return [int(parameter) if parameter else None for parameter in parameters]
|