py-ntfs-quick-index 0.1.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.
@@ -0,0 +1,221 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # py-ntfs-quick-index local artifacts
221
+ pnqi.index.sqlite*
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GGN_2015
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-ntfs-quick-index
3
+ Version: 0.1.0
4
+ Summary: Fast NTFS indexing and search for Windows amd64.
5
+ Project-URL: Homepage, https://github.com/
6
+ Author: py-ntfs-quick-index contributors
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: index,ntfs,sqlite,usn,windows
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Environment :: Win32 (MS Windows)
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Desktop Environment :: File Managers
19
+ Classifier: Topic :: System :: Filesystems
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: py-admin-launch>=0.1.3
23
+ Requires-Dist: tqdm>=4.66
24
+ Description-Content-Type: text/markdown
25
+
26
+ # py-ntfs-quick-index
27
+
28
+ Fast Windows NTFS indexing and search for amd64 machines.
29
+
30
+ `pnqi` uses NTFS MFT enumeration for initial indexing and the NTFS USN Journal
31
+ for incremental refreshes. Indexes are stored as SQLite files named
32
+ `pnqi.index.sqlite` in the volume root, for example `C:\pnqi.index.sqlite`.
33
+
34
+ ## Requirements
35
+
36
+ - Windows only
37
+ - amd64 / x86_64 CPU only
38
+ - Administrator privileges
39
+ - NTFS volumes only
40
+ - Python 3.10+
41
+
42
+ The program elevates only at startup through
43
+ [`py-admin-launch`](https://pypi.org/project/py-admin-launch/). Internal library
44
+ calls require the already-elevated process and do not trigger additional UAC
45
+ prompts.
46
+
47
+ ## Install
48
+
49
+ ```powershell
50
+ python -m pip install -e .
51
+ ```
52
+
53
+ ## CLI
54
+
55
+ Create or replace an index for a folder:
56
+
57
+ ```powershell
58
+ pnqi index C:\
59
+ ```
60
+
61
+ Search with `*` wildcards. `*` matches any string, including `\`.
62
+
63
+ ```powershell
64
+ pnqi search "C:\Users\*\Desktop\*.pdf"
65
+ ```
66
+
67
+ Show descendants sorted by recursive size:
68
+
69
+ ```powershell
70
+ pnqi sizes C:\Users --limit 100
71
+ ```
72
+
73
+ Show only direct children:
74
+
75
+ ```powershell
76
+ pnqi sizes C:\Users --direct
77
+ ```
78
+
79
+ CLI progress bars use `tqdm`, and `Ctrl+C` cancels cleanly.
80
+
81
+ ## GUI
82
+
83
+ ```powershell
84
+ pnqi-gui
85
+ ```
86
+
87
+ The GUI supports creating indexes, searching wildcard paths, browsing indexed
88
+ folders, and viewing recursive sizes. During long operations the interface is
89
+ locked except for Cancel. Cancelled index builds write only to a temporary
90
+ SQLite file and do not replace the existing index.
91
+
92
+ ## Incremental Updates
93
+
94
+ On startup, and before searches or browsing, `pnqi` checks existing
95
+ `pnqi.index.sqlite` files and replays USN Journal changes into SQLite. If the
96
+ USN Journal was recreated or no longer contains the required history, `pnqi`
97
+ reports that the index must be recreated.
@@ -0,0 +1,72 @@
1
+ # py-ntfs-quick-index
2
+
3
+ Fast Windows NTFS indexing and search for amd64 machines.
4
+
5
+ `pnqi` uses NTFS MFT enumeration for initial indexing and the NTFS USN Journal
6
+ for incremental refreshes. Indexes are stored as SQLite files named
7
+ `pnqi.index.sqlite` in the volume root, for example `C:\pnqi.index.sqlite`.
8
+
9
+ ## Requirements
10
+
11
+ - Windows only
12
+ - amd64 / x86_64 CPU only
13
+ - Administrator privileges
14
+ - NTFS volumes only
15
+ - Python 3.10+
16
+
17
+ The program elevates only at startup through
18
+ [`py-admin-launch`](https://pypi.org/project/py-admin-launch/). Internal library
19
+ calls require the already-elevated process and do not trigger additional UAC
20
+ prompts.
21
+
22
+ ## Install
23
+
24
+ ```powershell
25
+ python -m pip install -e .
26
+ ```
27
+
28
+ ## CLI
29
+
30
+ Create or replace an index for a folder:
31
+
32
+ ```powershell
33
+ pnqi index C:\
34
+ ```
35
+
36
+ Search with `*` wildcards. `*` matches any string, including `\`.
37
+
38
+ ```powershell
39
+ pnqi search "C:\Users\*\Desktop\*.pdf"
40
+ ```
41
+
42
+ Show descendants sorted by recursive size:
43
+
44
+ ```powershell
45
+ pnqi sizes C:\Users --limit 100
46
+ ```
47
+
48
+ Show only direct children:
49
+
50
+ ```powershell
51
+ pnqi sizes C:\Users --direct
52
+ ```
53
+
54
+ CLI progress bars use `tqdm`, and `Ctrl+C` cancels cleanly.
55
+
56
+ ## GUI
57
+
58
+ ```powershell
59
+ pnqi-gui
60
+ ```
61
+
62
+ The GUI supports creating indexes, searching wildcard paths, browsing indexed
63
+ folders, and viewing recursive sizes. During long operations the interface is
64
+ locked except for Cancel. Cancelled index builds write only to a temporary
65
+ SQLite file and do not replace the existing index.
66
+
67
+ ## Incremental Updates
68
+
69
+ On startup, and before searches or browsing, `pnqi` checks existing
70
+ `pnqi.index.sqlite` files and replays USN Journal changes into SQLite. If the
71
+ USN Journal was recreated or no longer contains the required history, `pnqi`
72
+ reports that the index must be recreated.
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "py-ntfs-quick-index"
7
+ version = "0.1.0"
8
+ description = "Fast NTFS indexing and search for Windows amd64."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "py-ntfs-quick-index contributors" }
14
+ ]
15
+ keywords = ["ntfs", "usn", "index", "windows", "sqlite"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Environment :: Win32 (MS Windows)",
20
+ "Intended Audience :: End Users/Desktop",
21
+ "License :: OSI Approved :: MIT License",
22
+ "Operating System :: Microsoft :: Windows",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ "Topic :: Desktop Environment :: File Managers",
26
+ "Topic :: System :: Filesystems",
27
+ "Topic :: Utilities",
28
+ ]
29
+ dependencies = [
30
+ "py-admin-launch>=0.1.3",
31
+ "tqdm>=4.66",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/"
36
+
37
+ [project.scripts]
38
+ pnqi = "pnqi.cli:main"
39
+ pnqi-gui = "pnqi.gui:main"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/pnqi"]
43
+
44
+ [tool.ruff]
45
+ line-length = 100
46
+ target-version = "py310"
47
+
48
+ [tool.ruff.lint]
49
+ select = ["E", "F", "I", "UP", "B"]
50
+
@@ -0,0 +1,8 @@
1
+ """py-ntfs-quick-index package."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __app_name__ = "py-ntfs-quick-index"
6
+ __version__ = "0.1.0"
7
+ INDEX_FILENAME = "pnqi.index.sqlite"
8
+
@@ -0,0 +1,8 @@
1
+ from __future__ import annotations
2
+
3
+ from .cli import main
4
+
5
+
6
+ if __name__ == "__main__":
7
+ raise SystemExit(main())
8
+
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import sys
5
+ from collections.abc import Sequence
6
+
7
+ from .errors import NotAdminError
8
+ from .platform import is_admin, validate_supported_platform
9
+
10
+ ELEVATED_CHILD_FLAG = "--pnqi-elevated-child"
11
+
12
+
13
+ def without_elevated_flag(argv: Sequence[str]) -> list[str]:
14
+ return [arg for arg in argv if arg != ELEVATED_CHILD_FLAG]
15
+
16
+
17
+ def ensure_startup_admin(argv: Sequence[str] | None = None, *, gui: bool = False) -> bool:
18
+ """Ensure the process is elevated once, at program startup.
19
+
20
+ Returns True in the process that should continue. Returns False after
21
+ requesting elevation from the original process.
22
+ """
23
+
24
+ validate_supported_platform()
25
+ args = list(sys.argv[1:] if argv is None else argv)
26
+ if is_admin():
27
+ return True
28
+ if ELEVATED_CHILD_FLAG in args:
29
+ raise NotAdminError("Elevation was requested but administrator rights are still missing.")
30
+
31
+ from py_admin_launch import AdminLaunchError, launch
32
+
33
+ child_args = [arg for arg in args if arg != ELEVATED_CHILD_FLAG]
34
+ if gui and "--gui" not in child_args:
35
+ child_args.insert(0, "--gui")
36
+ command = [sys.executable, "-m", "pnqi", ELEVATED_CHILD_FLAG, *child_args]
37
+ try:
38
+ launch(command, cwd=os.getcwd(), wait=False)
39
+ except (AdminLaunchError, OSError) as exc:
40
+ raise NotAdminError(f"Could not launch administrator process: {exc}") from exc
41
+ return False
@@ -0,0 +1,157 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+ from collections.abc import Callable
6
+
7
+ from tqdm import tqdm
8
+
9
+ from .admin import ELEVATED_CHILD_FLAG, ensure_startup_admin, without_elevated_flag
10
+ from .errors import OperationCancelled, PnqiError
11
+ from .formatting import human_size
12
+ from .indexer import build_index, list_sizes, refresh_known_indexes, search
13
+ from .progress import CancellationToken, ProgressUpdate
14
+
15
+
16
+ class TqdmProgress:
17
+ def __init__(self) -> None:
18
+ self._bars: dict[str, tqdm] = {}
19
+
20
+ def close(self) -> None:
21
+ for bar in self._bars.values():
22
+ bar.close()
23
+ self._bars.clear()
24
+
25
+ def __call__(self, update: ProgressUpdate) -> None:
26
+ total = update.total
27
+ current = update.current
28
+ key = update.stage
29
+ bar = self._bars.get(key)
30
+ if bar is None:
31
+ bar = tqdm(
32
+ total=total,
33
+ desc=key,
34
+ unit="item",
35
+ dynamic_ncols=True,
36
+ leave=key == "done",
37
+ )
38
+ self._bars[key] = bar
39
+ elif total is not None and bar.total != total:
40
+ bar.total = total
41
+ bar.refresh()
42
+ if current is not None:
43
+ delta = current - int(bar.n)
44
+ if delta > 0:
45
+ bar.update(delta)
46
+ elif delta < 0:
47
+ bar.n = current
48
+ bar.refresh()
49
+ if update.message:
50
+ bar.set_postfix_str(update.message[:80])
51
+ if update.stage == "done":
52
+ bar.close()
53
+
54
+
55
+ def _add_common(parser: argparse.ArgumentParser) -> None:
56
+ parser.add_argument(
57
+ "--skip-startup-refresh",
58
+ action="store_true",
59
+ help="do not refresh existing pnqi.index.sqlite files at startup",
60
+ )
61
+
62
+
63
+ def build_parser() -> argparse.ArgumentParser:
64
+ parser = argparse.ArgumentParser(
65
+ prog="pnqi",
66
+ description="Fast NTFS index and search tool for Windows amd64.",
67
+ )
68
+ parser.add_argument("--gui", action="store_true", help=argparse.SUPPRESS)
69
+ parser.add_argument(ELEVATED_CHILD_FLAG, nargs="?", help=argparse.SUPPRESS)
70
+ _add_common(parser)
71
+ subparsers = parser.add_subparsers(dest="command")
72
+
73
+ index_parser = subparsers.add_parser("index", help="create or replace an index for a folder")
74
+ index_parser.add_argument("path", help="folder to index")
75
+
76
+ search_parser = subparsers.add_parser("search", help="search indexed files by a * wildcard path")
77
+ search_parser.add_argument("pattern", help="path pattern; * matches any string including backslashes")
78
+ search_parser.add_argument("--limit", type=int, default=0, help="maximum number of rows to print")
79
+
80
+ sizes_parser = subparsers.add_parser(
81
+ "sizes",
82
+ help="show files and folders sorted by recursive size descending",
83
+ )
84
+ sizes_parser.add_argument("path", help="folder to inspect")
85
+ sizes_parser.add_argument(
86
+ "--direct",
87
+ action="store_true",
88
+ help="show only direct children instead of all descendants",
89
+ )
90
+ sizes_parser.add_argument("--limit", type=int, default=0, help="maximum number of rows to print")
91
+ return parser
92
+
93
+
94
+ def _refresh_startup(args: argparse.Namespace, progress: Callable[[ProgressUpdate], None], token: CancellationToken) -> None:
95
+ if args.skip_startup_refresh:
96
+ return
97
+ refresh_known_indexes(progress=progress, token=token)
98
+
99
+
100
+ def run(argv: list[str] | None = None) -> int:
101
+ parser = build_parser()
102
+ raw_args = list(sys.argv[1:] if argv is None else argv)
103
+ args = parser.parse_args(without_elevated_flag(raw_args))
104
+ if args.gui:
105
+ from .gui import main as gui_main
106
+
107
+ return gui_main(without_elevated_flag(raw_args))
108
+
109
+ if args.command is None:
110
+ parser.print_help()
111
+ return 2
112
+
113
+ if not ensure_startup_admin(raw_args):
114
+ print("Requested administrator privileges; the elevated pnqi process will continue.")
115
+ return 0
116
+
117
+ token = CancellationToken()
118
+ progress = TqdmProgress()
119
+ try:
120
+ _refresh_startup(args, progress, token)
121
+ if args.command == "index":
122
+ index_path = build_index(args.path, progress=progress, token=token)
123
+ print(f"Index written: {index_path}")
124
+ elif args.command == "search":
125
+ rows = search(args.pattern, progress=progress, token=token)
126
+ shown = rows if args.limit <= 0 else rows[: args.limit]
127
+ for entry in shown:
128
+ print(f"{entry.display_size:>12} {entry.path}")
129
+ if args.limit > 0 and len(rows) > args.limit:
130
+ print(f"... {len(rows) - args.limit} more")
131
+ elif args.command == "sizes":
132
+ rows = list_sizes(args.path, recursive=not args.direct, progress=progress, token=token)
133
+ shown = rows if args.limit <= 0 else rows[: args.limit]
134
+ for entry in shown:
135
+ print(f"{human_size(entry.tree_size if entry.is_dir else entry.size):>12} {entry.path}")
136
+ if args.limit > 0 and len(rows) > args.limit:
137
+ print(f"... {len(rows) - args.limit} more")
138
+ else:
139
+ parser.error(f"unknown command: {args.command}")
140
+ return 0
141
+ except KeyboardInterrupt:
142
+ token.cancel()
143
+ print("", file=sys.stderr)
144
+ print("Cancelled.", file=sys.stderr)
145
+ return 130
146
+ except OperationCancelled:
147
+ print("Cancelled.", file=sys.stderr)
148
+ return 130
149
+ except PnqiError as exc:
150
+ print(f"pnqi: {exc}", file=sys.stderr)
151
+ return 1
152
+ finally:
153
+ progress.close()
154
+
155
+ def main(argv: list[str] | None = None) -> int:
156
+ return run(argv)
157
+