omdev 0.0.0.dev443__py3-none-any.whl → 0.0.0.dev445__py3-none-any.whl
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.
- omdev/cexts/_boilerplate.cc +2 -3
- omdev/precheck/unicode.py +39 -15
- {omdev-0.0.0.dev443.dist-info → omdev-0.0.0.dev445.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev443.dist-info → omdev-0.0.0.dev445.dist-info}/RECORD +8 -8
- {omdev-0.0.0.dev443.dist-info → omdev-0.0.0.dev445.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev443.dist-info → omdev-0.0.0.dev445.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev443.dist-info → omdev-0.0.0.dev445.dist-info}/licenses/LICENSE +0 -0
- {omdev-0.0.0.dev443.dist-info → omdev-0.0.0.dev445.dist-info}/top_level.txt +0 -0
omdev/cexts/_boilerplate.cc
CHANGED
@@ -54,9 +54,8 @@ static PyMethodDef boilerplate_methods[] = {
|
|
54
54
|
|
55
55
|
static struct PyModuleDef_Slot boilerplate_slots[] = {
|
56
56
|
{Py_mod_exec, (void *) boilerplate_exec},
|
57
|
-
|
58
|
-
|
59
|
-
// #endif
|
57
|
+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
|
58
|
+
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED},
|
60
59
|
{0, NULL}
|
61
60
|
};
|
62
61
|
|
omdev/precheck/unicode.py
CHANGED
@@ -29,6 +29,18 @@ class UnicodePrecheck(Precheck['UnicodePrecheck.Config']):
|
|
29
29
|
|
30
30
|
permitted_categories: ta.AbstractSet[str] = DEFAULT_PERMITTED_CATEGORIES
|
31
31
|
|
32
|
+
DEFAULT_FILE_EXTENSIONS: ta.ClassVar[ta.AbstractSet[str]] = frozenset([
|
33
|
+
'py',
|
34
|
+
|
35
|
+
'c',
|
36
|
+
'cc',
|
37
|
+
'cu',
|
38
|
+
'h',
|
39
|
+
'hh',
|
40
|
+
])
|
41
|
+
|
42
|
+
file_extensions: ta.AbstractSet[str] = DEFAULT_FILE_EXTENSIONS
|
43
|
+
|
32
44
|
def __init__(
|
33
45
|
self,
|
34
46
|
context: PrecheckContext,
|
@@ -46,19 +58,15 @@ class UnicodePrecheck(Precheck['UnicodePrecheck.Config']):
|
|
46
58
|
self._text_file_cache = text_file_cache
|
47
59
|
self._headers_cache = headers_cache
|
48
60
|
|
49
|
-
async def
|
50
|
-
if
|
51
|
-
|
52
|
-
if any(hl.src.strip() == '# @omlish-precheck-allow-any-unicode' for hl in header_lines):
|
53
|
-
return
|
54
|
-
|
55
|
-
src = self._text_file_cache.get_entry(py_file).text()
|
61
|
+
async def _run_file(self, file: str, src: str | None = None) -> ta.AsyncGenerator[Precheck.Violation]:
|
62
|
+
if src is None:
|
63
|
+
src = self._text_file_cache.get_entry(file).text()
|
56
64
|
|
57
65
|
illegal_chars = {
|
58
66
|
ch
|
59
67
|
for ch in src
|
60
|
-
if ord(ch) > 255
|
61
|
-
unicodedata.category(ch) not in self._config.permitted_categories
|
68
|
+
if ord(ch) > 255
|
69
|
+
and unicodedata.category(ch) not in self._config.permitted_categories
|
62
70
|
}
|
63
71
|
|
64
72
|
if illegal_chars:
|
@@ -66,16 +74,32 @@ class UnicodePrecheck(Precheck['UnicodePrecheck.Config']):
|
|
66
74
|
f'({ch!r}, {unicodedata.category(ch)})'
|
67
75
|
for ch in sorted(illegal_chars)
|
68
76
|
]
|
69
|
-
yield Precheck.Violation(self, f'source file {
|
77
|
+
yield Precheck.Violation(self, f'source file {file} has illegal unicode characters: {", ".join(sl)}')
|
78
|
+
|
79
|
+
async def _run_py_file(self, py_file: str) -> ta.AsyncGenerator[Precheck.Violation]:
|
80
|
+
if isinstance(header_lines := self._headers_cache.get_file_headers(py_file), Exception):
|
81
|
+
return
|
82
|
+
if any(hl.src.strip() == '# @omlish-precheck-allow-any-unicode' for hl in header_lines):
|
83
|
+
return
|
84
|
+
|
85
|
+
async for v in self._run_file(py_file):
|
86
|
+
yield v
|
70
87
|
|
71
88
|
async def run(self) -> ta.AsyncGenerator[Precheck.Violation]:
|
72
|
-
|
89
|
+
files = [
|
73
90
|
os.path.join(e.root, f)
|
74
91
|
for src_root in self._context.src_roots
|
75
92
|
for e in self._dir_walk_cache.list_dir(src_root)
|
76
93
|
for f in e.files
|
77
|
-
if
|
94
|
+
if '.' in f
|
95
|
+
and any(f.endswith('.' + ext) for ext in self._config.file_extensions)
|
78
96
|
]
|
79
|
-
|
80
|
-
|
81
|
-
|
97
|
+
|
98
|
+
for file in sorted(files):
|
99
|
+
if file.endswith('.py'):
|
100
|
+
async for v in self._run_py_file(file):
|
101
|
+
yield v
|
102
|
+
|
103
|
+
else:
|
104
|
+
async for v in self._run_file(file):
|
105
|
+
yield v
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: omdev
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev445
|
4
4
|
Summary: omdev
|
5
5
|
Author: wrmsr
|
6
6
|
License-Expression: BSD-3-Clause
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
14
14
|
Requires-Python: >=3.13
|
15
15
|
Description-Content-Type: text/markdown
|
16
16
|
License-File: LICENSE
|
17
|
-
Requires-Dist: omlish==0.0.0.
|
17
|
+
Requires-Dist: omlish==0.0.0.dev445
|
18
18
|
Provides-Extra: all
|
19
19
|
Requires-Dist: black~=25.1; extra == "all"
|
20
20
|
Requires-Dist: pycparser~=2.23; extra == "all"
|
@@ -50,7 +50,7 @@ omdev/cc/cdeps.toml,sha256=MqZ1OQHQ2JPvQpHRL32GpRgQWQRtzjPI2EWl4EqSm-I,1004
|
|
50
50
|
omdev/cc/cli.py,sha256=WkA39T1sG2NOXDxImapE4BU7Bg_ZijjErk7HvTfV-6E,6427
|
51
51
|
omdev/cc/srclangs.py,sha256=3u_APHgknuc-BPRQSDISwSzouluKsnLlBxodp-XCl_E,728
|
52
52
|
omdev/cexts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
|
-
omdev/cexts/_boilerplate.cc,sha256=
|
53
|
+
omdev/cexts/_boilerplate.cc,sha256=tUTFKyMpammFj-7bF8DbN6jv67Vn7qrwCFDoAgarof8,1753
|
54
54
|
omdev/cexts/build.py,sha256=JxEuqSpspnY6kWn8eB89FjcSjF4bpNgVYNeIvwmWehY,2659
|
55
55
|
omdev/cexts/cmake.py,sha256=7CSL9AsWaJnad94dw9QxbZLirtxdlg7Au7EQ1g7H74g,10050
|
56
56
|
omdev/cexts/importhook.py,sha256=GZ04bE6tMQ8uQUUzGr22Rt9cwyI6kkoK4t7xpLP2Lrs,3562
|
@@ -223,7 +223,7 @@ omdev/precheck/lite.py,sha256=sseaKHMZgMhIEuifZvPJm0-wuRqRUrnyySJfHBMItOM,4737
|
|
223
223
|
omdev/precheck/main.py,sha256=nbTXR7d2vVMOyrXBVKFyQfmTm1H5tpk7Pe2Zphk-LqI,4365
|
224
224
|
omdev/precheck/manifests.py,sha256=dxl7GSJHKjQrR6mbwvj6j92XDGHOpxxEEQ6smJkBEe4,810
|
225
225
|
omdev/precheck/scripts.py,sha256=6nb_lDgyX7u9kdF_BU6ubY01q_jGk96VH9q9gpOieng,1753
|
226
|
-
omdev/precheck/unicode.py,sha256=
|
226
|
+
omdev/precheck/unicode.py,sha256=vMxGb4Kqg1NhFlw1kbgsPtXOnswjREH0ZPZExrrTwCU,3260
|
227
227
|
omdev/ptk/__init__.py,sha256=dpX3wJhkkamPutosBwy90C0E9WHv-sE48FE09_FaDQw,5196
|
228
228
|
omdev/ptk/confirm.py,sha256=98KHM00G1iU78BweFfVGFSZWWmB7MKH8-8fUKPmttRM,1591
|
229
229
|
omdev/ptk/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -323,9 +323,9 @@ omdev/tools/jsonview/resources/jsonview.js,sha256=faDvXDOXKvEvjOuIlz4D3F2ReQXb_b
|
|
323
323
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
324
324
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
325
325
|
omdev/tools/pawk/pawk.py,sha256=ao5mdrpiSU4AZ8mBozoEaV3UVlmVTnRG9wD9XP70MZE,11429
|
326
|
-
omdev-0.0.0.
|
327
|
-
omdev-0.0.0.
|
328
|
-
omdev-0.0.0.
|
329
|
-
omdev-0.0.0.
|
330
|
-
omdev-0.0.0.
|
331
|
-
omdev-0.0.0.
|
326
|
+
omdev-0.0.0.dev445.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
327
|
+
omdev-0.0.0.dev445.dist-info/METADATA,sha256=Vnyg_CxpqRVbnUYlgHAJ4R5wDzBweJhuGjIJj-UmoSQ,5100
|
328
|
+
omdev-0.0.0.dev445.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
329
|
+
omdev-0.0.0.dev445.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
330
|
+
omdev-0.0.0.dev445.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
331
|
+
omdev-0.0.0.dev445.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|