omdev 0.0.0.dev67__tar.gz → 0.0.0.dev69__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.dev67/omdev.egg-info → omdev-0.0.0.dev69}/PKG-INFO +5 -2
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/.manifests.json +2 -2
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/__about__.py +4 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/clicli.py +4 -0
- omdev-0.0.0.dev69/omdev/tools/nbtools.py +120 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69/omdev.egg-info}/PKG-INFO +5 -2
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev.egg-info/requires.txt +5 -1
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/pyproject.toml +6 -2
- omdev-0.0.0.dev67/omdev/tools/nbtools.py +0 -49
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/LICENSE +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/MANIFEST.in +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/README.rst +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/amalg/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/amalg/__main__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/amalg/amalg.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/antlr/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/antlr/_antlr/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/antlr/consts.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/antlr/gen.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/bracepy.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/cache.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/contexts.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/currents.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/fns.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/resolvers.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/storage.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/compute/types.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/data/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/data/actions.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/data/cache.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/data/consts.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/data/defaults.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/data/manifests.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cache/data/specs.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_boilerplate.cc +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/LICENSE +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/build_ext.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/compilers/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/compilers/ccompiler.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/compilers/options.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/compilers/unixccompiler.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/dir_util.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/errors.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/extension.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/file_util.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/modified.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/spawn.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/sysconfig.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/util.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/_distutils/version.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/build.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/cmake.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/importhook.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/magic.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cexts/scan.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/classdot.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/__main__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/install.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/main.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/managers.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/pathhack.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cli/types.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/cmake.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/findimports.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/findmagic.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/git.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/__main__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/cli.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/inspect.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/providers.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/pyenv.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/resolvers.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/standalone.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/system.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/interp/types.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/manifests/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/manifests/build.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/manifests/load.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/manifests/types.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/mypy/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/mypy/debug.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/packaging/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/packaging/names.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/packaging/requires.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/packaging/specifiers.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/packaging/versions.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/precheck/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/precheck/__main__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/precheck/base.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/precheck/git.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/precheck/lite.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/precheck/precheck.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/precheck/scripts.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/pyproject/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/pyproject/__main__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/pyproject/cexts.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/pyproject/cli.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/pyproject/configs.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/pyproject/pkg.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/pyproject/reqs.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/revisions.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/scripts/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/scripts/bumpversion.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/scripts/execrss.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/scripts/exectime.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/scripts/importtrace.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/scripts/interp.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/scripts/pyproject.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/secrets.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tokens.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/toml/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/toml/parser.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/toml/writer.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/__init__.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/dockertools.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/gittools.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/importscan.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/mkrelimp.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/piptools.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/proftools.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/rst.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/tools/sqlrepl.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev/wheelfile.py +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev.egg-info/SOURCES.txt +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev.egg-info/dependency_links.txt +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev.egg-info/entry_points.txt +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/omdev.egg-info/top_level.txt +0 -0
- {omdev-0.0.0.dev67 → omdev-0.0.0.dev69}/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.dev69
|
|
4
4
|
Summary: omdev
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -12,8 +12,9 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
13
|
Requires-Python: ~=3.12
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omlish==0.0.0.dev69
|
|
16
16
|
Provides-Extra: all
|
|
17
|
+
Requires-Dist: black~=24.10; extra == "all"
|
|
17
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
18
19
|
Requires-Dist: cffi~=1.17; extra == "all"
|
|
19
20
|
Requires-Dist: pcpp~=1.30; extra == "all"
|
|
@@ -21,6 +22,8 @@ Requires-Dist: docutils~=0.21; extra == "all"
|
|
|
21
22
|
Requires-Dist: mypy~=1.11; extra == "all"
|
|
22
23
|
Requires-Dist: tokenize_rt~=6.0; extra == "all"
|
|
23
24
|
Requires-Dist: wheel~=0.44; extra == "all"
|
|
25
|
+
Provides-Extra: black
|
|
26
|
+
Requires-Dist: black~=24.10; extra == "black"
|
|
24
27
|
Provides-Extra: c
|
|
25
28
|
Requires-Dist: pycparser~=2.22; extra == "c"
|
|
26
29
|
Requires-Dist: cffi~=1.17; extra == "c"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"module": ".cli.clicli",
|
|
40
40
|
"attr": "_CLI_MODULE",
|
|
41
41
|
"file": "omdev/cli/clicli.py",
|
|
42
|
-
"line":
|
|
42
|
+
"line": 88,
|
|
43
43
|
"value": {
|
|
44
44
|
"$.cli.types.CliModule": {
|
|
45
45
|
"cmd_name": "cli",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"module": ".tools.nbtools",
|
|
172
172
|
"attr": "_CLI_MODULE",
|
|
173
173
|
"file": "omdev/tools/nbtools.py",
|
|
174
|
-
"line":
|
|
174
|
+
"line": 115,
|
|
175
175
|
"value": {
|
|
176
176
|
"$.cli.types.CliModule": {
|
|
177
177
|
"cmd_name": [
|
|
@@ -25,6 +25,10 @@ class CliCli(ap.Cli):
|
|
|
25
25
|
def print_revision(self) -> None:
|
|
26
26
|
print(__about__.__revision__)
|
|
27
27
|
|
|
28
|
+
@ap.command(name='home')
|
|
29
|
+
def print_home(self) -> None:
|
|
30
|
+
print(sys.prefix)
|
|
31
|
+
|
|
28
32
|
@ap.command(
|
|
29
33
|
ap.arg('--url', default=DEFAULT_REINSTALL_URL),
|
|
30
34
|
ap.arg('--local', action='store_true'),
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import json
|
|
3
|
+
import os.path
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
import urllib.parse
|
|
7
|
+
import urllib.request
|
|
8
|
+
|
|
9
|
+
from omlish import argparse as ap
|
|
10
|
+
from omlish import check
|
|
11
|
+
|
|
12
|
+
from ..cli import CliModule
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Cli(ap.Cli):
|
|
16
|
+
@ap.command(
|
|
17
|
+
ap.arg('file'),
|
|
18
|
+
ap.arg('-w', '--write', action='store_true'),
|
|
19
|
+
ap.arg('-o', '--overwrite', action='store_true'),
|
|
20
|
+
ap.arg('--no-header', action='store_true'),
|
|
21
|
+
ap.arg('--keep-bangs', action='store_true'),
|
|
22
|
+
ap.arg('--black', action='store_true'),
|
|
23
|
+
)
|
|
24
|
+
def strip_code(self) -> None:
|
|
25
|
+
out_file: str | None = None
|
|
26
|
+
out_header: list[str] = []
|
|
27
|
+
|
|
28
|
+
if ':' in self.args.file:
|
|
29
|
+
url = self.args.file
|
|
30
|
+
pu = urllib.parse.urlparse(url)
|
|
31
|
+
check.equal(pu.scheme, 'https')
|
|
32
|
+
|
|
33
|
+
out_header.append(f'# Origin: {url}')
|
|
34
|
+
|
|
35
|
+
if pu.hostname == 'github.com':
|
|
36
|
+
_, user, repo, blob, *rest = pu.path.split('/')
|
|
37
|
+
check.equal(blob, 'blob')
|
|
38
|
+
url = f'https://raw.githubusercontent.com/{user}/{repo}/refs/heads/{"/".join(rest)}'
|
|
39
|
+
|
|
40
|
+
elif pu.hostname == 'raw.githubusercontent.com':
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
else:
|
|
44
|
+
raise ValueError(pu.hostname)
|
|
45
|
+
|
|
46
|
+
file = pu.path.split('/')[-1]
|
|
47
|
+
check.state(file.endswith('.ipynb'))
|
|
48
|
+
|
|
49
|
+
if self.args.write:
|
|
50
|
+
out_file = file.rpartition('.')[0] + '.py'
|
|
51
|
+
|
|
52
|
+
with urllib.request.urlopen(url) as resp: # noqa
|
|
53
|
+
buf = resp.read()
|
|
54
|
+
|
|
55
|
+
dct = json.loads(buf.decode('utf-8'))
|
|
56
|
+
|
|
57
|
+
elif self.args.file == '-':
|
|
58
|
+
if self.args.write:
|
|
59
|
+
raise Exception('Write not supported with stdin')
|
|
60
|
+
|
|
61
|
+
dct = json.load(sys.stdin)
|
|
62
|
+
|
|
63
|
+
else:
|
|
64
|
+
with open(self.args.file) as f:
|
|
65
|
+
dct = json.load(f)
|
|
66
|
+
|
|
67
|
+
if self.args.write:
|
|
68
|
+
out_file = self.args.file.rpartition('.')[0] + '.py'
|
|
69
|
+
|
|
70
|
+
if out_file is not None and os.path.isfile(out_file) and not self.args.overwrite:
|
|
71
|
+
raise OSError(f'File exists: {out_file}')
|
|
72
|
+
|
|
73
|
+
delim = '\n##\n\n'
|
|
74
|
+
|
|
75
|
+
out = io.StringIO()
|
|
76
|
+
if not self.args.no_header and out_header:
|
|
77
|
+
out.write('\n'.join(out_header))
|
|
78
|
+
out.write(delim)
|
|
79
|
+
|
|
80
|
+
code_cells = [c for c in dct['cells'] if c['cell_type'] == 'code']
|
|
81
|
+
for i, c in enumerate(code_cells):
|
|
82
|
+
if i:
|
|
83
|
+
out.write(delim)
|
|
84
|
+
|
|
85
|
+
src = ''.join(c['source'])
|
|
86
|
+
if not self.args.keep_bangs:
|
|
87
|
+
src = ''.join(
|
|
88
|
+
('# ' + l) if l.startswith('!') else l
|
|
89
|
+
for l in src.splitlines(keepends=True)
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
out.write(src)
|
|
93
|
+
out.write('\n')
|
|
94
|
+
|
|
95
|
+
out_src = out.getvalue()
|
|
96
|
+
|
|
97
|
+
if self.args.black:
|
|
98
|
+
proc = subprocess.run(
|
|
99
|
+
[sys.executable, '-m', 'black', '-'],
|
|
100
|
+
input=out_src.encode('utf-8'),
|
|
101
|
+
stdout=subprocess.PIPE,
|
|
102
|
+
check=True,
|
|
103
|
+
)
|
|
104
|
+
out_src = proc.stdout.decode('utf-8')
|
|
105
|
+
|
|
106
|
+
if out_file is not None:
|
|
107
|
+
with open(out_file, 'w') as f:
|
|
108
|
+
f.write(out_src)
|
|
109
|
+
print(f'Wrote {out_file}')
|
|
110
|
+
|
|
111
|
+
else:
|
|
112
|
+
sys.stdout.write(out_src)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# @omlish-manifest
|
|
116
|
+
_CLI_MODULE = CliModule(['notebook', 'nb'], __name__)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
if __name__ == '__main__':
|
|
120
|
+
Cli()()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev69
|
|
4
4
|
Summary: omdev
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -12,8 +12,9 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
13
|
Requires-Python: ~=3.12
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omlish==0.0.0.dev69
|
|
16
16
|
Provides-Extra: all
|
|
17
|
+
Requires-Dist: black~=24.10; extra == "all"
|
|
17
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
18
19
|
Requires-Dist: cffi~=1.17; extra == "all"
|
|
19
20
|
Requires-Dist: pcpp~=1.30; extra == "all"
|
|
@@ -21,6 +22,8 @@ Requires-Dist: docutils~=0.21; extra == "all"
|
|
|
21
22
|
Requires-Dist: mypy~=1.11; extra == "all"
|
|
22
23
|
Requires-Dist: tokenize_rt~=6.0; extra == "all"
|
|
23
24
|
Requires-Dist: wheel~=0.44; extra == "all"
|
|
25
|
+
Provides-Extra: black
|
|
26
|
+
Requires-Dist: black~=24.10; extra == "black"
|
|
24
27
|
Provides-Extra: c
|
|
25
28
|
Requires-Dist: pycparser~=2.22; extra == "c"
|
|
26
29
|
Requires-Dist: cffi~=1.17; extra == "c"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
omlish==0.0.0.
|
|
1
|
+
omlish==0.0.0.dev69
|
|
2
2
|
|
|
3
3
|
[all]
|
|
4
|
+
black~=24.10
|
|
4
5
|
pycparser~=2.22
|
|
5
6
|
cffi~=1.17
|
|
6
7
|
pcpp~=1.30
|
|
@@ -9,6 +10,9 @@ mypy~=1.11
|
|
|
9
10
|
tokenize_rt~=6.0
|
|
10
11
|
wheel~=0.44
|
|
11
12
|
|
|
13
|
+
[black]
|
|
14
|
+
black~=24.10
|
|
15
|
+
|
|
12
16
|
[c]
|
|
13
17
|
pycparser~=2.22
|
|
14
18
|
cffi~=1.17
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
urls = {source = 'https://github.com/wrmsr/omlish'}
|
|
13
13
|
license = {text = 'BSD-3-Clause'}
|
|
14
14
|
requires-python = '~=3.12'
|
|
15
|
-
version = '0.0.0.
|
|
15
|
+
version = '0.0.0.dev69'
|
|
16
16
|
classifiers = [
|
|
17
17
|
'License :: OSI Approved :: BSD License',
|
|
18
18
|
'Development Status :: 2 - Pre-Alpha',
|
|
@@ -22,11 +22,12 @@ classifiers = [
|
|
|
22
22
|
]
|
|
23
23
|
description = 'omdev'
|
|
24
24
|
dependencies = [
|
|
25
|
-
'omlish == 0.0.0.
|
|
25
|
+
'omlish == 0.0.0.dev69',
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.optional-dependencies]
|
|
29
29
|
all = [
|
|
30
|
+
'black ~= 24.10',
|
|
30
31
|
'pycparser ~= 2.22',
|
|
31
32
|
'cffi ~= 1.17',
|
|
32
33
|
'pcpp ~= 1.30',
|
|
@@ -35,6 +36,9 @@ all = [
|
|
|
35
36
|
'tokenize_rt ~= 6.0',
|
|
36
37
|
'wheel ~= 0.44',
|
|
37
38
|
]
|
|
39
|
+
black = [
|
|
40
|
+
'black ~= 24.10',
|
|
41
|
+
]
|
|
38
42
|
c = [
|
|
39
43
|
'pycparser ~= 2.22',
|
|
40
44
|
'cffi ~= 1.17',
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import io
|
|
2
|
-
import json
|
|
3
|
-
import os.path
|
|
4
|
-
import sys
|
|
5
|
-
|
|
6
|
-
from omlish import argparse as ap
|
|
7
|
-
|
|
8
|
-
from ..cli import CliModule
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Cli(ap.Cli):
|
|
12
|
-
@ap.command(
|
|
13
|
-
ap.arg('file'),
|
|
14
|
-
ap.arg('-w', '--write', action='store_true'),
|
|
15
|
-
ap.arg('-o', '--overwrite', action='store_true'),
|
|
16
|
-
)
|
|
17
|
-
def code(self) -> None:
|
|
18
|
-
if self.args.write:
|
|
19
|
-
out_file = self.args.file.rpartition('.')[0] + '.py'
|
|
20
|
-
if os.path.isfile(out_file) and not self.args.overwrite:
|
|
21
|
-
raise OSError(f'File exists: {out_file}')
|
|
22
|
-
else:
|
|
23
|
-
out_file = None
|
|
24
|
-
|
|
25
|
-
with open(self.args.file) as f:
|
|
26
|
-
dct = json.load(f)
|
|
27
|
-
|
|
28
|
-
out = io.StringIO()
|
|
29
|
-
code_cells = [c for c in dct['cells'] if c['cell_type'] == 'code']
|
|
30
|
-
for i, c in enumerate(code_cells):
|
|
31
|
-
if i:
|
|
32
|
-
out.write('\n##\n\n')
|
|
33
|
-
out.write(''.join(c['source']))
|
|
34
|
-
out.write('\n')
|
|
35
|
-
|
|
36
|
-
if out_file is not None:
|
|
37
|
-
with open(out_file, 'w') as f:
|
|
38
|
-
f.write(out.getvalue())
|
|
39
|
-
print(f'Wrote {out_file}')
|
|
40
|
-
else:
|
|
41
|
-
sys.stdout.write(out.getvalue())
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# @omlish-manifest
|
|
45
|
-
_CLI_MODULE = CliModule(['notebook', 'nb'], __name__)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if __name__ == '__main__':
|
|
49
|
-
Cli()()
|
|
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
|