omdev 0.0.0.dev370__py3-none-any.whl → 0.0.0.dev372__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.
@@ -25,12 +25,12 @@ TODO (old):
25
25
  - version generators - one for ast
26
26
  - configurable serde - marshal vs pickle? marshal w/ override for ndarray to write to file?
27
27
  - ok:
28
- - @fn - version, passive=False, deps=[Objectable, ]
28
+ - @fn - version, passive=False, deps=[Objectable, ...]
29
29
  - it no version use ast - specifically {'ast': <md5>}
30
30
  - but if present just use literal they gave, probably int
31
31
  - idiom: Version can be a frozendict, conventionally of str -> ta.Hashable
32
32
  - auto deps - fn can get containing Packages
33
- - Module, Resource,
33
+ - Module, Resource, ...
34
34
  - hrm.. LiteralVersion, MapVersion? + custom Marshal? need to deser as frozendict
35
35
  - storage
36
36
  - object table? w/ versions? strictly one row per object, evict objects with diff versions than those encountered
omdev/precheck/imports.py CHANGED
@@ -66,11 +66,11 @@ class RootRelativeImportPrecheck(Precheck['RootRelativeImportPrecheck.Config']):
66
66
  if f.endswith('.py')
67
67
  ]
68
68
 
69
- for py_file in py_files:
69
+ for py_file in sorted(py_files):
70
70
  async for v in self._run_py_file(py_file, src_root):
71
71
  yield v
72
72
 
73
73
  async def run(self) -> ta.AsyncGenerator[Precheck.Violation]:
74
- for src_root in self._context.src_roots:
74
+ for src_root in sorted(self._context.src_roots):
75
75
  async for v in self._run_src_root(src_root):
76
76
  yield v
omdev/precheck/main.py CHANGED
@@ -40,6 +40,7 @@ from .imports import RootRelativeImportPrecheck
40
40
  from .lite import LitePython8Precheck
41
41
  from .manifests import ManifestsPrecheck
42
42
  from .scripts import ScriptDepsPrecheck
43
+ from .unicode import UnicodePrecheck
43
44
 
44
45
 
45
46
  log = logging.getLogger(__name__)
@@ -92,6 +93,7 @@ def _check_cmd(args) -> None:
92
93
  ManifestsPrecheck.Config(),
93
94
  RootRelativeImportPrecheck.Config(),
94
95
  ScriptDepsPrecheck.Config(),
96
+ UnicodePrecheck.Config(),
95
97
  ]
96
98
 
97
99
  with inj.create_managed_injector(bind_main(
@@ -21,7 +21,7 @@ class ManifestsPrecheck(Precheck['ManifestsPrecheck.Config']):
21
21
  self._context = context
22
22
 
23
23
  async def run(self) -> ta.AsyncGenerator[Precheck.Violation]:
24
- for src_root in self._context.src_roots:
24
+ for src_root in sorted(self._context.src_roots):
25
25
  try:
26
26
  MANIFEST_LOADER.load(src_root)
27
27
  except Exception as e: # noqa
omdev/precheck/scripts.py CHANGED
@@ -27,11 +27,11 @@ class ScriptDepsPrecheck(Precheck['ScriptDepsPrecheck.Config']):
27
27
  self._context = context
28
28
 
29
29
  async def run(self) -> ta.AsyncGenerator[Precheck.Violation]:
30
- for fp in magic.find_magic_files(
30
+ for fp in sorted(magic.find_magic_files(
31
31
  magic.PY_MAGIC_STYLE,
32
32
  self._context.src_roots,
33
33
  keys=['@omlish-script'],
34
- ):
34
+ )):
35
35
  if not (stat.S_IXUSR & os.stat(fp).st_mode):
36
36
  yield Precheck.Violation(self, f'script {fp} is not executable')
37
37
 
@@ -0,0 +1,81 @@
1
+ import dataclasses as dc
2
+ import os
3
+ import typing as ta
4
+ import unicodedata
5
+
6
+ from omlish.text.filecache import TextFileCache
7
+
8
+ from .base import Precheck
9
+ from .base import PrecheckContext
10
+ from .caches import DirWalkCache
11
+ from .caches import HeadersCache
12
+
13
+
14
+ ##
15
+
16
+
17
+ class UnicodePrecheck(Precheck['UnicodePrecheck.Config']):
18
+ @dc.dataclass(frozen=True)
19
+ class Config(Precheck.Config):
20
+ DEFAULT_PERMITTED_CATEGORIES: ta.ClassVar[ta.AbstractSet[str]] = frozenset([
21
+ 'Lu', # Letter, uppercase
22
+ 'Ll', # Letter, lowercase
23
+ 'Lt', # Letter, titlecase
24
+ 'Sm', # Symbol, math
25
+ 'Sc', # Symbol, currency
26
+ 'Sk', # Symbol, modifier
27
+ 'So', # Symbol, other
28
+ ])
29
+
30
+ permitted_categories: ta.AbstractSet[str] = DEFAULT_PERMITTED_CATEGORIES
31
+
32
+ def __init__(
33
+ self,
34
+ context: PrecheckContext,
35
+ config: Config = Config(),
36
+ *,
37
+ dir_walk_cache: DirWalkCache,
38
+ text_file_cache: TextFileCache,
39
+ headers_cache: HeadersCache,
40
+ ) -> None:
41
+ super().__init__(config)
42
+
43
+ self._context = context
44
+
45
+ self._dir_walk_cache = dir_walk_cache
46
+ self._text_file_cache = text_file_cache
47
+ self._headers_cache = headers_cache
48
+
49
+ async def _run_py_file(self, py_file: str) -> ta.AsyncGenerator[Precheck.Violation]:
50
+ if isinstance(header_lines := self._headers_cache.get_file_headers(py_file), Exception):
51
+ return
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()
56
+
57
+ illegal_chars = {
58
+ ch
59
+ for ch in src
60
+ if ord(ch) > 255 and
61
+ unicodedata.category(ch) not in self._config.permitted_categories
62
+ }
63
+
64
+ if illegal_chars:
65
+ sl = [
66
+ f'({ch!r}, {unicodedata.category(ch)})'
67
+ for ch in sorted(illegal_chars)
68
+ ]
69
+ yield Precheck.Violation(self, f'source file {py_file} has illegal unicode characters: {", ".join(sl)}')
70
+
71
+ async def run(self) -> ta.AsyncGenerator[Precheck.Violation]:
72
+ py_files = [
73
+ os.path.join(e.root, f)
74
+ for src_root in self._context.src_roots
75
+ for e in self._dir_walk_cache.list_dir(src_root)
76
+ for f in e.files
77
+ if f.endswith('.py')
78
+ ]
79
+ for py_file in sorted(py_files):
80
+ async for v in self._run_py_file(py_file):
81
+ yield v
@@ -1,3 +1,4 @@
1
+ # @omlish-precheck-allow-any-unicode
1
2
  import typing as ta
2
3
 
3
4
  from ... import ptk
@@ -1,3 +1,4 @@
1
+ # @omlish-precheck-allow-any-unicode
1
2
  import enum
2
3
  import typing as ta
3
4
 
omdev/pyproject/cexts.py CHANGED
@@ -12,7 +12,7 @@ name (str) -
12
12
  sources (list[str]) -
13
13
  list of source filenames, relative to the distribution root (where the setup script lives), in Unix form
14
14
  (slash-separated) for portability. Source files may be C, C++, SWIG (.i), platform-specific resource files, or
15
- whatever else is recognized by the build_ext command as source for a Python extension.
15
+ whatever else is recognized by the "build_ext" command as source for a Python extension.
16
16
 
17
17
  include_dirs (list[str]) -
18
18
  list of directories to search for C/C++ header files (in Unix form for portability)
@@ -20,7 +20,7 @@ include_dirs (list[str]) -
20
20
  define_macros (list[tuple[str, str|None]]) -
21
21
  list of macros to define; each macro is defined using a 2-tuple: the first item corresponding to the name of the
22
22
  macro and the second item either a string with its value or None to define it without a particular value (equivalent
23
- of “#define FOO in source or -DFOO on Unix C compiler command line)
23
+ of "#define FOO" in source or -DFOO on Unix C compiler command line)
24
24
 
25
25
  undef_macros (list[str]) -
26
26
  list of macros to undefine explicitly
@@ -41,7 +41,7 @@ extra_objects (list[str]) -
41
41
 
42
42
  extra_compile_args (list[str]) -
43
43
  any extra platform- and compiler-specific information to use when compiling the source files in 'sources'. For
44
- platforms and compilers where command line makes sense, this is typically a list of command-line arguments, but
44
+ platforms and compilers where "command line" makes sense, this is typically a list of command-line arguments, but
45
45
  for other platforms it could be anything.
46
46
 
47
47
  extra_link_args (list[str]) -
@@ -50,7 +50,7 @@ extra_link_args (list[str]) -
50
50
 
51
51
  export_symbols (list[str]) -
52
52
  list of symbols to be exported from a shared extension. Not used on all platforms, and not generally necessary for
53
- Python extensions, which typically export exactly one symbol: init + extension_name.
53
+ Python extensions, which typically export exactly one symbol: "init" + extension_name.
54
54
 
55
55
  swig_opts (list[str]) -
56
56
  any extra options to pass to SWIG if a source file has the .i extension.
@@ -59,7 +59,7 @@ depends (list[str]) -
59
59
  list of files that the extension depends on
60
60
 
61
61
  language (str) -
62
- extension language (i.e. c”, c++”, objc). Will be detected from the source extensions if not provided.
62
+ extension language (i.e. "c", "c++", "objc"). Will be detected from the source extensions if not provided.
63
63
 
64
64
  optional (bool) -
65
65
  specifies that a build failure in the extension should not abort the build process, but simply not install the
omdev/tools/git/cli.py CHANGED
@@ -1,4 +1,5 @@
1
1
  # ruff: noqa: UP006 UP007 UP045
2
+ # @omlish-precheck-allow-any-unicode
2
3
  """
3
4
  TODO:
4
5
  - Handle:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omdev
3
- Version: 0.0.0.dev370
3
+ Version: 0.0.0.dev372
4
4
  Summary: omdev
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: >=3.13
14
14
  License-File: LICENSE
15
- Requires-Dist: omlish==0.0.0.dev370
15
+ Requires-Dist: omlish==0.0.0.dev372
16
16
  Provides-Extra: all
17
17
  Requires-Dist: black~=25.1; extra == "all"
18
18
  Requires-Dist: pycparser~=2.22; extra == "all"
@@ -18,7 +18,7 @@ omdev/amalg/types.py,sha256=BXXJI0VctKTsZv_wXiyMMq3-xShxZ1ak0wxXUK8n9_g,89
18
18
  omdev/amalg/typing.py,sha256=oLlkCnnZQkyKM_xxqm9uxECjn9xj0c4MIwYxxItBdPY,2191
19
19
  omdev/cache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  omdev/cache/compute/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- omdev/cache/compute/cache.py,sha256=IHF1959RS1z-aUuUaFOTjqcIjckbVgNEA7dONfh6y-o,3628
21
+ omdev/cache/compute/cache.py,sha256=7cJmxiHwbnitMZaLZEZVjEq0v1JJN7HKBK-BH_EtVY4,3628
22
22
  omdev/cache/compute/contexts.py,sha256=OKOHOIj8JSEHmCKMY9G_zpKkLAkGuXcFXvzY5SXqCMA,3231
23
23
  omdev/cache/compute/currents.py,sha256=D1Ls5Sd7FX2aPO5wpyEwTSmkz50sxkwCs37Amb0urH8,1425
24
24
  omdev/cache/compute/fns.py,sha256=_1xU7qw1O57OsTp17RFjFTBO1M2t54RL-CGdl-0cTBk,4175
@@ -198,11 +198,12 @@ omdev/precheck/__main__.py,sha256=UEuS4z5-heIrwTtB-ONe1KeXJdqj8tYXMqWMpuO10so,16
198
198
  omdev/precheck/base.py,sha256=fKdrfakq2u1UU1_JZFnl-non9bIAZMsSkVY1SMYn8xQ,662
199
199
  omdev/precheck/caches.py,sha256=OZKP20DIj6OpUzdNwrjCufv1GzndEbsc7tLD-qHNv9g,1736
200
200
  omdev/precheck/git.py,sha256=O8rNQZ_vlHec0pOFbK6LOkbly5ZIUYT_HXRMqQX8GaI,774
201
- omdev/precheck/imports.py,sha256=JS-j1YWi_4YL43053xITl6b35isRW-7ChoYoztufVn0,2549
201
+ omdev/precheck/imports.py,sha256=3loQxHMrpI0ce4-le77NCSxutLac_5vDW4UDX7KWWg8,2565
202
202
  omdev/precheck/lite.py,sha256=qd6nXWEVut8aBSRD_NxnxXGRNa9ue8mu8ND8rGLisE4,4710
203
- omdev/precheck/main.py,sha256=VEPdq9n8Yo_HiDqfCdHH1pj3xuJgOzrXie_vWoNbKqw,4303
204
- omdev/precheck/manifests.py,sha256=EZkChCc9aDlAZswVVvq696p4r3Vy7VBQUSfn6DXhUcc,778
205
- omdev/precheck/scripts.py,sha256=SyHTVUVMTnBoTzcrWywfwxuUoIfpeV_EQcPQZyaht6c,1336
203
+ omdev/precheck/main.py,sha256=_1A5wiu9p2th1dn_17w1ZIFtMmCIOaTFpWyvK0jopEA,4374
204
+ omdev/precheck/manifests.py,sha256=1CG0PG0feagydT-cgxiOBvQKhoILjZVXk4MYf65wkkM,786
205
+ omdev/precheck/scripts.py,sha256=244Jq5xee2QErn0gvpt0hmdYg95TYtuefMDXaE9YPws,1344
206
+ omdev/precheck/unicode.py,sha256=VUNDCrlfUas_U8ugV_q0eFUXuBgKjS8YdCFm0FXREXo,2583
206
207
  omdev/ptk/__init__.py,sha256=IemfBhxxqZe1GeZ2_IMQzqWAB5j0XyARp_aajnonyKY,5142
207
208
  omdev/ptk/confirm.py,sha256=kObMUAu-EZC0vdT9LLwtbNA6YLLNmn-Uy18SQTWBTb8,1471
208
209
  omdev/ptk/apps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -215,8 +216,8 @@ omdev/ptk/markdown/cli.py,sha256=FlV12qpyVWgpfeOzyFg9DlgLkss3rgCet_Jebs6_Xqo,537
215
216
  omdev/ptk/markdown/markdown.py,sha256=wRxCWSV2u71NP_MTi8A8vVLjZ1TmmaWUZMnvW468Ejc,12368
216
217
  omdev/ptk/markdown/parser.py,sha256=UppwouvAYh3qzQMKL-BjcyqBIl2KHcocXlWiKFZ7cBA,990
217
218
  omdev/ptk/markdown/styles.py,sha256=lc17zooXhff5_2tkqLsCmdq2b_rfSAehmHVR-8Lo2qk,777
218
- omdev/ptk/markdown/tags.py,sha256=askGU252Zu8KxG2menVHZHXZ4fGbItgy0G4UW9F3mFI,6983
219
- omdev/ptk/markdown/utils.py,sha256=tzbYAZ-sloEoIguXvhaOC4w2y7AKh0vtC4_a2Ovf1D8,10476
219
+ omdev/ptk/markdown/tags.py,sha256=6wF9lbqbpf_WCxEJ_tJP_QtaDCcQKCKYS1CMzHTQg2U,7020
220
+ omdev/ptk/markdown/utils.py,sha256=bwhmV-L4wjLuNLZc-ieWioL1G-EmonmhB031pvpIejw,10513
220
221
  omdev/py/__init__.py,sha256=u7tLEfRTnPVtWPmKK_ZIvnFkZwTe1q44UQ53cvsix3k,41
221
222
  omdev/py/attrdocs.py,sha256=FcMSUFw8_zyNYducsWnZKEKi_WDox3-b3Xjw0DrHUcs,5180
222
223
  omdev/py/bracepy.py,sha256=PPPoTMj4FJ5Lk3GGPEEWBGU7Kl1eCJBApSJnRvRj2Ms,2753
@@ -241,7 +242,7 @@ omdev/py/tools/importscan.py,sha256=4dCH0coX0OqNwesteKaTE8GxuSfLhgXYQlzNUXLiSNY,
241
242
  omdev/py/tools/mkrelimp.py,sha256=kuzfS4GWcGi-ItyhEHSW4hV9ZcfDJL6inDMhDp1V2lE,4049
242
243
  omdev/pyproject/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
243
244
  omdev/pyproject/__main__.py,sha256=gn3Rl1aYPYdiTtEqa9ifi0t-e4ZwPY0vhJ4UXvYdJDY,165
244
- omdev/pyproject/cexts.py,sha256=4xYt1aw2FqcPEpdr1clJnEmp3sbEQXnSWl1sm-4d9NE,4292
245
+ omdev/pyproject/cexts.py,sha256=GLD4fe61M_fHhdMcKlcQNUoCb7MeVXY6Fw-grKH4hTU,4264
245
246
  omdev/pyproject/cli.py,sha256=Umsu2bcJUYeeVXICaZFhKckUBT6VWuYDL4htgCGGQIs,8749
246
247
  omdev/pyproject/configs.py,sha256=baNRwHtUW8S8DKCxuKlMbV3Gduujd1PyNURxQ48Nnxk,2813
247
248
  omdev/pyproject/inject.py,sha256=Von8_8ofkITLoCEwDHNRAwY0AEdFQg7r2ILS8kcTMuY,325
@@ -283,7 +284,7 @@ omdev/tools/antlr/consts.py,sha256=4xH4jyNE5czXRWCn65jFF0MrAodMPe_kYMWpgMxWmpo,2
283
284
  omdev/tools/antlr/gen.py,sha256=spYfyfX_r_1YT4uZ_bEhtGwANenUtZvSOFck5eiNHhQ,5122
284
285
  omdev/tools/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
285
286
  omdev/tools/git/__main__.py,sha256=gI87SBUgTkKUcUM-RtZWnei-UUDDqzbr5aPztb-gvbE,168
286
- omdev/tools/git/cli.py,sha256=6YG-punGydpaB65waHowMkGGH6Ded8GXi-0pZ_M3lpQ,15454
287
+ omdev/tools/git/cli.py,sha256=UxxyQcYF2--Q7UcLJFWXew8_rwLJJNENACplwdFEEKM,15491
287
288
  omdev/tools/git/consts.py,sha256=JuXivUNDkNhM4pe97icjRVAKM8cNRbrODquHINNKqOE,40
288
289
  omdev/tools/git/messages.py,sha256=NWztIK0nAKJIOVzuVQcR_5LHZUgqyVkrOlpl7dFLMdU,2424
289
290
  omdev/tools/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -303,9 +304,9 @@ omdev/tools/jsonview/resources/jsonview.js,sha256=faDvXDOXKvEvjOuIlz4D3F2ReQXb_b
303
304
  omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
304
305
  omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
305
306
  omdev/tools/pawk/pawk.py,sha256=ao5mdrpiSU4AZ8mBozoEaV3UVlmVTnRG9wD9XP70MZE,11429
306
- omdev-0.0.0.dev370.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
307
- omdev-0.0.0.dev370.dist-info/METADATA,sha256=UjeIHRSOXiCxWy2H7h6dN8UboN0247bGKM8y4by7gyc,1674
308
- omdev-0.0.0.dev370.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
309
- omdev-0.0.0.dev370.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
310
- omdev-0.0.0.dev370.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
311
- omdev-0.0.0.dev370.dist-info/RECORD,,
307
+ omdev-0.0.0.dev372.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
308
+ omdev-0.0.0.dev372.dist-info/METADATA,sha256=MQ778T7dZ0Qmc0WSp9cqsPqVYnSPZE5GE97jij-hyEo,1674
309
+ omdev-0.0.0.dev372.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
310
+ omdev-0.0.0.dev372.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
311
+ omdev-0.0.0.dev372.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
312
+ omdev-0.0.0.dev372.dist-info/RECORD,,