omdev 0.0.0.dev89__tar.gz → 0.0.0.dev91__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.
Potentially problematic release.
This version of omdev might be problematic. Click here for more details.
- {omdev-0.0.0.dev89/omdev.egg-info → omdev-0.0.0.dev91}/PKG-INFO +8 -5
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/__about__.py +5 -1
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/_pathhack.py +19 -6
- omdev-0.0.0.dev91/omdev/prompttoolkit/__init__.py +11 -0
- omdev-0.0.0.dev91/omdev/prompttoolkit/apps/__init__.py +0 -0
- omdev-0.0.0.dev91/omdev/prompttoolkit/apps/ncdu.py +140 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/interp.py +27 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/pyproject.py +27 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91/omdev.egg-info}/PKG-INFO +8 -5
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev.egg-info/SOURCES.txt +3 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev.egg-info/requires.txt +7 -3
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/pyproject.toml +9 -5
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/LICENSE +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/MANIFEST.in +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/README.rst +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/.manifests.json +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/amalg/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/amalg/__main__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/amalg/amalg.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/antlr/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/antlr/_antlr/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/antlr/consts.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/antlr/gen.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/bracepy.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/cache.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/contexts.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/currents.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/fns.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/resolvers.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/storage.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/compute/types.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/data/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/data/actions.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/data/cache.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/data/consts.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/data/defaults.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/data/manifests.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cache/data/specs.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_boilerplate.cc +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/LICENSE +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/build_ext.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/compilers/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/compilers/ccompiler.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/compilers/options.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/compilers/unixccompiler.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/dir_util.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/errors.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/extension.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/file_util.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/modified.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/spawn.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/sysconfig.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/util.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/_distutils/version.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/build.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/cmake.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/importhook.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/magic.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cexts/scan.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/classdot.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/__main__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/clicli.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/install.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/main.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/managers.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cli/types.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/clipboard/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/clipboard/clipboard.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/clipboard/darwin.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/cmake.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/findimports.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/findmagic.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/git.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/imgur.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/__main__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/cli.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/inspect.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/providers.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/pyenv.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/resolvers.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/standalone.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/system.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/interp/types.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/manifests/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/manifests/build.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/manifests/load.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/manifests/types.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/mypy/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/mypy/debug.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/packaging/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/packaging/names.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/packaging/requires.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/packaging/specifiers.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/packaging/versions.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/__main__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/base.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/git.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/lite.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/main.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/manifests.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/precheck/scripts.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/pyproject/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/pyproject/__main__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/pyproject/cexts.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/pyproject/cli.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/pyproject/configs.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/pyproject/pkg.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/pyproject/reqs.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/revisions.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/bumpversion.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/execrss.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/exectime.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/importtrace.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/scripts/slowcat.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/secrets.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tokens.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/toml/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/toml/parser.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/toml/writer.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/__init__.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/dockertools.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/gittools.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/importscan.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/mkrelimp.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/nbtools.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/piptools.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/proftools.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/rsttool.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/tools/sqlrepl.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev/wheelfile.py +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev.egg-info/dependency_links.txt +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev.egg-info/entry_points.txt +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/omdev.egg-info/top_level.txt +0 -0
- {omdev-0.0.0.dev89 → omdev-0.0.0.dev91}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev91
|
|
4
4
|
Summary: omdev
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -10,9 +10,9 @@ Classifier: Development Status :: 2 - Pre-Alpha
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
|
-
Requires-Python:
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omlish==0.0.0.dev91
|
|
16
16
|
Provides-Extra: all
|
|
17
17
|
Requires-Dist: black~=24.10; extra == "all"
|
|
18
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
@@ -21,7 +21,8 @@ Requires-Dist: pcpp~=1.30; extra == "all"
|
|
|
21
21
|
Requires-Dist: docutils~=0.21; extra == "all"
|
|
22
22
|
Requires-Dist: mypy~=1.11; extra == "all"
|
|
23
23
|
Requires-Dist: gprof2dot~=2024.6; extra == "all"
|
|
24
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: prompt-toolkit~=3.0; extra == "all"
|
|
25
|
+
Requires-Dist: tokenize-rt~=6.1; extra == "all"
|
|
25
26
|
Requires-Dist: wheel~=0.44; extra == "all"
|
|
26
27
|
Provides-Extra: black
|
|
27
28
|
Requires-Dist: black~=24.10; extra == "black"
|
|
@@ -35,7 +36,9 @@ Provides-Extra: mypy
|
|
|
35
36
|
Requires-Dist: mypy~=1.11; extra == "mypy"
|
|
36
37
|
Provides-Extra: prof
|
|
37
38
|
Requires-Dist: gprof2dot~=2024.6; extra == "prof"
|
|
39
|
+
Provides-Extra: prompttoolkit
|
|
40
|
+
Requires-Dist: prompt-toolkit~=3.0; extra == "prompttoolkit"
|
|
38
41
|
Provides-Extra: tokens
|
|
39
|
-
Requires-Dist:
|
|
42
|
+
Requires-Dist: tokenize-rt~=6.1; extra == "tokens"
|
|
40
43
|
Provides-Extra: wheel
|
|
41
44
|
Requires-Dist: wheel~=0.44; extra == "wheel"
|
|
@@ -7,20 +7,33 @@ problematic empty string is added, so a sys.meta_path hook is prepended.
|
|
|
7
7
|
|
|
8
8
|
See:
|
|
9
9
|
https://github.com/python/cpython/blob/da1e5526aee674bb33c17a498aa3781587b9850c/Python/sysmodule.c#L3939
|
|
10
|
+
https://github.com/python/cpython/blob/db0a1b8c1291bf1aa9e016e43bc2f7ed0acf83bd/Modules/getpath.py
|
|
11
|
+
https://github.com/python/cpython/blob/db0a1b8c1291bf1aa9e016e43bc2f7ed0acf83bd/Modules/getpath.c
|
|
12
|
+
https://github.com/python/cpython/blob/db0a1b8c1291bf1aa9e016e43bc2f7ed0acf83bd/Doc/library/sys_path_init.rst
|
|
10
13
|
"""
|
|
11
14
|
import os.path
|
|
12
15
|
import site
|
|
13
16
|
import sys
|
|
14
17
|
|
|
15
18
|
|
|
16
|
-
def _remove_empty_from_sys_path() -> None:
|
|
17
|
-
while '' in sys.path:
|
|
18
|
-
sys.path.remove('')
|
|
19
|
-
|
|
20
|
-
|
|
21
19
|
class _PathHackMetaFinder:
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
removed_paths=None, # type: list[str] | None
|
|
23
|
+
) -> None:
|
|
24
|
+
super().__init__()
|
|
25
|
+
if removed_paths is None:
|
|
26
|
+
removed_paths = ['', '.', os.getcwd()]
|
|
27
|
+
self._removed_paths = removed_paths
|
|
28
|
+
self.remove_paths()
|
|
29
|
+
|
|
30
|
+
def remove_paths(self) -> None:
|
|
31
|
+
for p in self._removed_paths:
|
|
32
|
+
while p in sys.path:
|
|
33
|
+
sys.path.remove(p)
|
|
34
|
+
|
|
22
35
|
def find_spec(self, fullname, path, target=None):
|
|
23
|
-
|
|
36
|
+
self.remove_paths()
|
|
24
37
|
return None # noqa
|
|
25
38
|
|
|
26
39
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# ruff: noqa: F401
|
|
2
|
+
# flake8: noqa: F401
|
|
3
|
+
|
|
4
|
+
from prompt_toolkit import Application
|
|
5
|
+
from prompt_toolkit.key_binding import KeyBindings
|
|
6
|
+
from prompt_toolkit.key_binding import KeyPressEvent
|
|
7
|
+
from prompt_toolkit.layout import Layout
|
|
8
|
+
from prompt_toolkit.layout.containers import Window
|
|
9
|
+
from prompt_toolkit.styles import Style
|
|
10
|
+
from prompt_toolkit.widgets import Frame
|
|
11
|
+
from prompt_toolkit.widgets import TextArea
|
|
File without changes
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import dataclasses as dc
|
|
2
|
+
import os
|
|
3
|
+
import typing as ta
|
|
4
|
+
|
|
5
|
+
from omlish.lite.strings import format_num_bytes
|
|
6
|
+
|
|
7
|
+
from ... import prompttoolkit as ptk
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_directory_size(path: str) -> int:
|
|
11
|
+
total_size = 0
|
|
12
|
+
for dirpath, _, filenames in os.walk(path):
|
|
13
|
+
for f in filenames:
|
|
14
|
+
fp = os.path.join(dirpath, f)
|
|
15
|
+
try:
|
|
16
|
+
total_size += os.path.getsize(fp)
|
|
17
|
+
except OSError:
|
|
18
|
+
pass
|
|
19
|
+
return total_size
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dc.dataclass(frozen=True)
|
|
23
|
+
class Entry:
|
|
24
|
+
name: str
|
|
25
|
+
size: int
|
|
26
|
+
type: ta.Literal['dir', 'file']
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def scan_directory(path: str) -> list[Entry]:
|
|
30
|
+
entries: list[Entry] = []
|
|
31
|
+
|
|
32
|
+
with os.scandir(path) as it:
|
|
33
|
+
for entry in it:
|
|
34
|
+
if entry.is_dir(follow_symlinks=False):
|
|
35
|
+
size = get_directory_size(entry.path)
|
|
36
|
+
entries.append(Entry(entry.name + '/', size, 'dir'))
|
|
37
|
+
|
|
38
|
+
elif entry.is_file(follow_symlinks=False):
|
|
39
|
+
size = entry.stat().st_size
|
|
40
|
+
entries.append(Entry(entry.name, size, 'file'))
|
|
41
|
+
|
|
42
|
+
entries.sort(key=lambda x: x.size, reverse=True)
|
|
43
|
+
return entries
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class NcduApp:
|
|
47
|
+
def __init__(self, root_path: str) -> None:
|
|
48
|
+
super().__init__()
|
|
49
|
+
|
|
50
|
+
self._root_path = root_path
|
|
51
|
+
self._current_path = root_path
|
|
52
|
+
self._entries = scan_directory(root_path)
|
|
53
|
+
self._cursor = 0
|
|
54
|
+
|
|
55
|
+
self._text_area = ptk.TextArea(focusable=True)
|
|
56
|
+
self.update_display()
|
|
57
|
+
|
|
58
|
+
self._kb = ptk.KeyBindings()
|
|
59
|
+
self._kb.add('q')(self.exit_app)
|
|
60
|
+
for k in ['up', 'p']:
|
|
61
|
+
self._kb.add(k)(self.move_up)
|
|
62
|
+
for k in ['down', 'n']:
|
|
63
|
+
self._kb.add(k)(self.move_down)
|
|
64
|
+
self._kb.add('enter')(self.enter_directory)
|
|
65
|
+
self._kb.add('backspace')(self.go_back)
|
|
66
|
+
|
|
67
|
+
self._layout = ptk.Layout(ptk.Frame(self._text_area))
|
|
68
|
+
|
|
69
|
+
self._style = ptk.Style.from_dict({
|
|
70
|
+
'frame': 'bg:#008800 bold',
|
|
71
|
+
'text-area': 'bg:#000000 fg:#ffffff',
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
self._app: ptk.Application = ptk.Application(
|
|
75
|
+
layout=self._layout,
|
|
76
|
+
key_bindings=self._kb,
|
|
77
|
+
style=self._style,
|
|
78
|
+
full_screen=True,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
#
|
|
82
|
+
|
|
83
|
+
def update_display(self) -> None:
|
|
84
|
+
display_text = f'Current Directory: {self._current_path}\n\n'
|
|
85
|
+
for i, e in enumerate(self._entries):
|
|
86
|
+
indicator = '>' if i == self._cursor else ' '
|
|
87
|
+
display_text += f'{indicator} {e.name:<40} {format_num_bytes(e.size):>10}\n'
|
|
88
|
+
self._text_area.text = display_text
|
|
89
|
+
|
|
90
|
+
#
|
|
91
|
+
|
|
92
|
+
def move_up(self, event: ptk.KeyPressEvent) -> None:
|
|
93
|
+
if self._cursor > 0:
|
|
94
|
+
self._cursor -= 1
|
|
95
|
+
self.update_display()
|
|
96
|
+
|
|
97
|
+
def move_down(self, event: ptk.KeyPressEvent) -> None:
|
|
98
|
+
if self._cursor < len(self._entries) - 1:
|
|
99
|
+
self._cursor += 1
|
|
100
|
+
self.update_display()
|
|
101
|
+
|
|
102
|
+
def enter_directory(self, event: ptk.KeyPressEvent) -> None:
|
|
103
|
+
selected_entry = self._entries[self._cursor]
|
|
104
|
+
if selected_entry.type == 'dir':
|
|
105
|
+
self._current_path = os.path.join(self._current_path, selected_entry.name[:-1])
|
|
106
|
+
self._entries = scan_directory(self._current_path)
|
|
107
|
+
self._cursor = 0
|
|
108
|
+
self.update_display()
|
|
109
|
+
|
|
110
|
+
def go_back(self, event: ptk.KeyPressEvent) -> None:
|
|
111
|
+
if self._current_path != self._root_path:
|
|
112
|
+
self._current_path = os.path.dirname(self._current_path)
|
|
113
|
+
self._entries = scan_directory(self._current_path)
|
|
114
|
+
self._cursor = 0
|
|
115
|
+
self.update_display()
|
|
116
|
+
|
|
117
|
+
def exit_app(self, event: ptk.KeyPressEvent) -> None:
|
|
118
|
+
event.app.exit()
|
|
119
|
+
|
|
120
|
+
#
|
|
121
|
+
|
|
122
|
+
def run(self) -> None:
|
|
123
|
+
self._app.run()
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _main() -> None:
|
|
127
|
+
import argparse
|
|
128
|
+
|
|
129
|
+
parser = argparse.ArgumentParser()
|
|
130
|
+
|
|
131
|
+
parser.add_argument('dir', default='.', nargs='?')
|
|
132
|
+
|
|
133
|
+
args = parser.parse_args()
|
|
134
|
+
|
|
135
|
+
ncdu_app = NcduApp(args.dir)
|
|
136
|
+
ncdu_app.run()
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
if __name__ == '__main__':
|
|
140
|
+
_main()
|
|
@@ -626,6 +626,9 @@ def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
|
|
|
626
626
|
# ../../../omlish/lite/strings.py
|
|
627
627
|
|
|
628
628
|
|
|
629
|
+
##
|
|
630
|
+
|
|
631
|
+
|
|
629
632
|
def camel_case(name: str, lower: bool = False) -> str:
|
|
630
633
|
if not name:
|
|
631
634
|
return ''
|
|
@@ -640,6 +643,9 @@ def snake_case(name: str) -> str:
|
|
|
640
643
|
return '_'.join([name[l:r].lower() for l, r in zip([None, *uppers], [*uppers, None])]).strip('_')
|
|
641
644
|
|
|
642
645
|
|
|
646
|
+
##
|
|
647
|
+
|
|
648
|
+
|
|
643
649
|
def is_dunder(name: str) -> bool:
|
|
644
650
|
return (
|
|
645
651
|
name[:2] == name[-2:] == '__' and
|
|
@@ -658,10 +664,31 @@ def is_sunder(name: str) -> bool:
|
|
|
658
664
|
)
|
|
659
665
|
|
|
660
666
|
|
|
667
|
+
##
|
|
668
|
+
|
|
669
|
+
|
|
661
670
|
def attr_repr(obj: ta.Any, *attrs: str) -> str:
|
|
662
671
|
return f'{type(obj).__name__}({", ".join(f"{attr}={getattr(obj, attr)!r}" for attr in attrs)})'
|
|
663
672
|
|
|
664
673
|
|
|
674
|
+
##
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
FORMAT_NUM_BYTES_SUFFIXES: ta.Sequence[str] = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB']
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
def format_num_bytes(num_bytes: int) -> str:
|
|
681
|
+
for i, suffix in enumerate(FORMAT_NUM_BYTES_SUFFIXES):
|
|
682
|
+
value = num_bytes / 1024 ** i
|
|
683
|
+
if num_bytes < 1024 ** (i + 1):
|
|
684
|
+
if value.is_integer():
|
|
685
|
+
return f'{int(value)}{suffix}'
|
|
686
|
+
else:
|
|
687
|
+
return f'{value:.2f}{suffix}'
|
|
688
|
+
|
|
689
|
+
return f'{num_bytes / 1024 ** (len(FORMAT_NUM_BYTES_SUFFIXES) - 1):.2f}{FORMAT_NUM_BYTES_SUFFIXES[-1]}'
|
|
690
|
+
|
|
691
|
+
|
|
665
692
|
########################################
|
|
666
693
|
# ../../packaging/specifiers.py
|
|
667
694
|
# Copyright (c) Donald Stufft and individual contributors.
|
|
@@ -2014,6 +2014,9 @@ def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
|
|
|
2014
2014
|
# ../../../omlish/lite/strings.py
|
|
2015
2015
|
|
|
2016
2016
|
|
|
2017
|
+
##
|
|
2018
|
+
|
|
2019
|
+
|
|
2017
2020
|
def camel_case(name: str, lower: bool = False) -> str:
|
|
2018
2021
|
if not name:
|
|
2019
2022
|
return ''
|
|
@@ -2028,6 +2031,9 @@ def snake_case(name: str) -> str:
|
|
|
2028
2031
|
return '_'.join([name[l:r].lower() for l, r in zip([None, *uppers], [*uppers, None])]).strip('_')
|
|
2029
2032
|
|
|
2030
2033
|
|
|
2034
|
+
##
|
|
2035
|
+
|
|
2036
|
+
|
|
2031
2037
|
def is_dunder(name: str) -> bool:
|
|
2032
2038
|
return (
|
|
2033
2039
|
name[:2] == name[-2:] == '__' and
|
|
@@ -2046,10 +2052,31 @@ def is_sunder(name: str) -> bool:
|
|
|
2046
2052
|
)
|
|
2047
2053
|
|
|
2048
2054
|
|
|
2055
|
+
##
|
|
2056
|
+
|
|
2057
|
+
|
|
2049
2058
|
def attr_repr(obj: ta.Any, *attrs: str) -> str:
|
|
2050
2059
|
return f'{type(obj).__name__}({", ".join(f"{attr}={getattr(obj, attr)!r}" for attr in attrs)})'
|
|
2051
2060
|
|
|
2052
2061
|
|
|
2062
|
+
##
|
|
2063
|
+
|
|
2064
|
+
|
|
2065
|
+
FORMAT_NUM_BYTES_SUFFIXES: ta.Sequence[str] = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB']
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
def format_num_bytes(num_bytes: int) -> str:
|
|
2069
|
+
for i, suffix in enumerate(FORMAT_NUM_BYTES_SUFFIXES):
|
|
2070
|
+
value = num_bytes / 1024 ** i
|
|
2071
|
+
if num_bytes < 1024 ** (i + 1):
|
|
2072
|
+
if value.is_integer():
|
|
2073
|
+
return f'{int(value)}{suffix}'
|
|
2074
|
+
else:
|
|
2075
|
+
return f'{value:.2f}{suffix}'
|
|
2076
|
+
|
|
2077
|
+
return f'{num_bytes / 1024 ** (len(FORMAT_NUM_BYTES_SUFFIXES) - 1):.2f}{FORMAT_NUM_BYTES_SUFFIXES[-1]}'
|
|
2078
|
+
|
|
2079
|
+
|
|
2053
2080
|
########################################
|
|
2054
2081
|
# ../../packaging/specifiers.py
|
|
2055
2082
|
# Copyright (c) Donald Stufft and individual contributors.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev91
|
|
4
4
|
Summary: omdev
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -10,9 +10,9 @@ Classifier: Development Status :: 2 - Pre-Alpha
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
|
-
Requires-Python:
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omlish==0.0.0.dev91
|
|
16
16
|
Provides-Extra: all
|
|
17
17
|
Requires-Dist: black~=24.10; extra == "all"
|
|
18
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
@@ -21,7 +21,8 @@ Requires-Dist: pcpp~=1.30; extra == "all"
|
|
|
21
21
|
Requires-Dist: docutils~=0.21; extra == "all"
|
|
22
22
|
Requires-Dist: mypy~=1.11; extra == "all"
|
|
23
23
|
Requires-Dist: gprof2dot~=2024.6; extra == "all"
|
|
24
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: prompt-toolkit~=3.0; extra == "all"
|
|
25
|
+
Requires-Dist: tokenize-rt~=6.1; extra == "all"
|
|
25
26
|
Requires-Dist: wheel~=0.44; extra == "all"
|
|
26
27
|
Provides-Extra: black
|
|
27
28
|
Requires-Dist: black~=24.10; extra == "black"
|
|
@@ -35,7 +36,9 @@ Provides-Extra: mypy
|
|
|
35
36
|
Requires-Dist: mypy~=1.11; extra == "mypy"
|
|
36
37
|
Provides-Extra: prof
|
|
37
38
|
Requires-Dist: gprof2dot~=2024.6; extra == "prof"
|
|
39
|
+
Provides-Extra: prompttoolkit
|
|
40
|
+
Requires-Dist: prompt-toolkit~=3.0; extra == "prompttoolkit"
|
|
38
41
|
Provides-Extra: tokens
|
|
39
|
-
Requires-Dist:
|
|
42
|
+
Requires-Dist: tokenize-rt~=6.1; extra == "tokens"
|
|
40
43
|
Provides-Extra: wheel
|
|
41
44
|
Requires-Dist: wheel~=0.44; extra == "wheel"
|
|
@@ -108,6 +108,9 @@ omdev/precheck/lite.py
|
|
|
108
108
|
omdev/precheck/main.py
|
|
109
109
|
omdev/precheck/manifests.py
|
|
110
110
|
omdev/precheck/scripts.py
|
|
111
|
+
omdev/prompttoolkit/__init__.py
|
|
112
|
+
omdev/prompttoolkit/apps/__init__.py
|
|
113
|
+
omdev/prompttoolkit/apps/ncdu.py
|
|
111
114
|
omdev/pyproject/__init__.py
|
|
112
115
|
omdev/pyproject/__main__.py
|
|
113
116
|
omdev/pyproject/cexts.py
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
omlish==0.0.0.
|
|
1
|
+
omlish==0.0.0.dev91
|
|
2
2
|
|
|
3
3
|
[all]
|
|
4
4
|
black~=24.10
|
|
@@ -8,7 +8,8 @@ pcpp~=1.30
|
|
|
8
8
|
docutils~=0.21
|
|
9
9
|
mypy~=1.11
|
|
10
10
|
gprof2dot~=2024.6
|
|
11
|
-
|
|
11
|
+
prompt-toolkit~=3.0
|
|
12
|
+
tokenize-rt~=6.1
|
|
12
13
|
wheel~=0.44
|
|
13
14
|
|
|
14
15
|
[black]
|
|
@@ -28,8 +29,11 @@ mypy~=1.11
|
|
|
28
29
|
[prof]
|
|
29
30
|
gprof2dot~=2024.6
|
|
30
31
|
|
|
32
|
+
[prompttoolkit]
|
|
33
|
+
prompt-toolkit~=3.0
|
|
34
|
+
|
|
31
35
|
[tokens]
|
|
32
|
-
|
|
36
|
+
tokenize-rt~=6.1
|
|
33
37
|
|
|
34
38
|
[wheel]
|
|
35
39
|
wheel~=0.44
|
|
@@ -11,8 +11,8 @@ authors = [
|
|
|
11
11
|
]
|
|
12
12
|
urls = {source = 'https://github.com/wrmsr/omlish'}
|
|
13
13
|
license = {text = 'BSD-3-Clause'}
|
|
14
|
-
requires-python = '
|
|
15
|
-
version = '0.0.0.
|
|
14
|
+
requires-python = '>=3.12'
|
|
15
|
+
version = '0.0.0.dev91'
|
|
16
16
|
classifiers = [
|
|
17
17
|
'License :: OSI Approved :: BSD License',
|
|
18
18
|
'Development Status :: 2 - Pre-Alpha',
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
]
|
|
23
23
|
description = 'omdev'
|
|
24
24
|
dependencies = [
|
|
25
|
-
'omlish == 0.0.0.
|
|
25
|
+
'omlish == 0.0.0.dev91',
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.optional-dependencies]
|
|
@@ -34,7 +34,8 @@ all = [
|
|
|
34
34
|
'docutils ~= 0.21',
|
|
35
35
|
'mypy ~= 1.11',
|
|
36
36
|
'gprof2dot ~= 2024.6',
|
|
37
|
-
'
|
|
37
|
+
'prompt-toolkit ~= 3.0',
|
|
38
|
+
'tokenize-rt ~= 6.1',
|
|
38
39
|
'wheel ~= 0.44',
|
|
39
40
|
]
|
|
40
41
|
black = [
|
|
@@ -54,8 +55,11 @@ mypy = [
|
|
|
54
55
|
prof = [
|
|
55
56
|
'gprof2dot ~= 2024.6',
|
|
56
57
|
]
|
|
58
|
+
prompttoolkit = [
|
|
59
|
+
'prompt-toolkit ~= 3.0',
|
|
60
|
+
]
|
|
57
61
|
tokens = [
|
|
58
|
-
'
|
|
62
|
+
'tokenize-rt ~= 6.1',
|
|
59
63
|
]
|
|
60
64
|
wheel = [
|
|
61
65
|
'wheel ~= 0.44',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|