omdev 0.0.0.dev364__py3-none-any.whl → 0.0.0.dev365__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/cc/cli.py CHANGED
@@ -17,8 +17,11 @@ Freestanding options:
17
17
 
18
18
  TODO:
19
19
  - cext interop
20
- - gen cmake
20
+ - cc cmake
21
+ - shlex shebang to extract opts
21
22
  - nanobind
23
+ - 2 dep mechanisms? not necessarily bad
24
+ - cc ij, based off of cmake
22
25
  - fix CFLAGS/CCFLAGS/CPPFLAGS/CXXFLAGS
23
26
  - jit-gen cmake mode? multi-src builds
24
27
  """
@@ -44,7 +44,7 @@ class Section(ta.NamedTuple):
44
44
  type: SectionType
45
45
 
46
46
 
47
- _GOOGLE_TYPED_ARG_PAT = re.compile(r'\s*(.+?)\s*\(\s*(.*[^\s]+)\s*\)')
47
+ _GOOGLE_TYPED_ARG_PAT = re.compile(r'\s*(.+?)\s*\(\s*(.*\S+)\s*\)')
48
48
  _GOOGLE_ARG_DESC_PAT = re.compile(r'.*\. Defaults to (.+)\.')
49
49
  _MULTIPLE_PATTERN = re.compile(r'(\s*[^:\s]+:)|([^:]*\]:.*)')
50
50
 
@@ -70,7 +70,9 @@ class GoogleParser:
70
70
  def __init__(
71
71
  self,
72
72
  sections: list[Section] | None = None,
73
+ *,
73
74
  title_colon: bool = True,
75
+ meta_separators: ta.Sequence[str] = ':-',
74
76
  ) -> None:
75
77
  """
76
78
  Setup sections.
@@ -85,6 +87,7 @@ class GoogleParser:
85
87
  sections = DEFAULT_SECTIONS
86
88
  self.sections = {s.title: s for s in sections}
87
89
  self.title_colon = title_colon
90
+ self.meta_separators = meta_separators
88
91
  self._setup()
89
92
 
90
93
  def _setup(self) -> None:
@@ -94,11 +97,11 @@ class GoogleParser:
94
97
  colon = ''
95
98
 
96
99
  self.titles_re = re.compile(
97
- '^('
98
- + '|'.join(f'({t})' for t in self.sections)
99
- + ')'
100
- + colon
101
- + '[ \t\r\f\v]*$',
100
+ '^(' +
101
+ '|'.join(f'({t})' for t in self.sections) +
102
+ ')' +
103
+ colon +
104
+ '[ \t\r\f\v]*$',
102
105
  flags=re.MULTILINE,
103
106
  )
104
107
 
@@ -122,19 +125,23 @@ class GoogleParser:
122
125
  ):
123
126
  return self._build_single_meta(section, text)
124
127
 
125
- if ':' not in text:
126
- raise ParseError(f'Expected a colon in {text!r}.')
128
+ seps = self.meta_separators
129
+ for sep in seps:
130
+ if sep not in text:
131
+ continue
132
+
133
+ # Split spec and description
134
+ before, desc = text.split(sep, 1)
135
+ if desc:
136
+ desc = desc[1:] if desc[0] == ' ' else desc
137
+ if '\n' in desc:
138
+ first_line, rest = desc.split('\n', 1)
139
+ desc = first_line + '\n' + inspect.cleandoc(rest)
140
+ desc = desc.strip('\n')
127
141
 
128
- # Split spec and description
129
- before, desc = text.split(':', 1)
130
- if desc:
131
- desc = desc[1:] if desc[0] == ' ' else desc
132
- if '\n' in desc:
133
- first_line, rest = desc.split('\n', 1)
134
- desc = first_line + '\n' + inspect.cleandoc(rest)
135
- desc = desc.strip('\n')
142
+ return self._build_multi_meta(section, before, desc)
136
143
 
137
- return self._build_multi_meta(section, before, desc)
144
+ raise ParseError(f'Expected some separator {seps!r} in {text!r}.')
138
145
 
139
146
  @staticmethod
140
147
  def _build_single_meta(section: Section, desc: str) -> DocstringMeta:
@@ -161,7 +168,7 @@ class GoogleParser:
161
168
  )
162
169
 
163
170
  if section.key in PARAM_KEYWORDS:
164
- raise ParseError('Expected paramenter name.')
171
+ raise ParseError('Expected parameter name.')
165
172
 
166
173
  return DocstringMeta(args=[section.key], description=desc)
167
174
 
omdev/scripts/ci.py CHANGED
@@ -1975,6 +1975,31 @@ def unlinking_if_exists(path: str) -> ta.Iterator[None]:
1975
1975
  ##
1976
1976
 
1977
1977
 
1978
+ @ta.overload
1979
+ def path_dirname(p: str, n: int = 1) -> str:
1980
+ ...
1981
+
1982
+
1983
+ @ta.overload
1984
+ def path_dirname(p: bytes, n: int = 1) -> bytes:
1985
+ ...
1986
+
1987
+
1988
+ def path_dirname(p, n=1):
1989
+ if isinstance(p, bytes):
1990
+ sep: ta.Any = b'/'
1991
+ else:
1992
+ sep = '/'
1993
+ p = os.fspath(p)
1994
+ i = -1
1995
+ for _ in range(n):
1996
+ i = p.rindex(sep, 0, i)
1997
+ head = p[:i + 1]
1998
+ if head and head != sep * len(head):
1999
+ head = head.rstrip(sep)
2000
+ return head
2001
+
2002
+
1978
2003
  def abs_real_path(p: str) -> str:
1979
2004
  return os.path.abspath(os.path.realpath(p))
1980
2005
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omdev
3
- Version: 0.0.0.dev364
3
+ Version: 0.0.0.dev365
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.dev364
15
+ Requires-Dist: omlish==0.0.0.dev365
16
16
  Provides-Extra: all
17
17
  Requires-Dist: black~=25.1; extra == "all"
18
18
  Requires-Dist: pycparser~=2.22; extra == "all"
@@ -36,7 +36,7 @@ omdev/cc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  omdev/cc/__main__.py,sha256=n7gxSRYZ1QZOUxQPCT0_n9Xl26zi2UIvCwyGW_m67nA,166
37
37
  omdev/cc/cdeps.py,sha256=Uou-V1qcwWhe14iTu39W7yxOlDdr_P96Ai8wQjAp3zQ,1535
38
38
  omdev/cc/cdeps.toml,sha256=MqZ1OQHQ2JPvQpHRL32GpRgQWQRtzjPI2EWl4EqSm-I,1004
39
- omdev/cc/cli.py,sha256=qmBLyq7dz85Sv4xZ_YR2S4UehCGKrf7-ZIWL0RwnLIY,4918
39
+ omdev/cc/cli.py,sha256=B-_FIEjox1O9vhlvgVVO4X6Qo4acWIm-eW5kAwSwFUc,5022
40
40
  omdev/cc/srclangs.py,sha256=3u_APHgknuc-BPRQSDISwSzouluKsnLlBxodp-XCl_E,728
41
41
  omdev/cexts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  omdev/cexts/_boilerplate.cc,sha256=sbpXEgdFrkdzZXgaNWFFNN27fL9TZu6VrwvMY4-nnFM,1726
@@ -228,7 +228,7 @@ omdev/py/docstrings/__init__.py,sha256=HFzqco1oj6M7KQ80i48W9gYABVJU8oM_1wpl9ndBN
228
228
  omdev/py/docstrings/attrdoc.py,sha256=xo-AFqEPfz1XppsCMJS80pG1Vdd2TiBsoxZ7YP6ZHC4,4269
229
229
  omdev/py/docstrings/common.py,sha256=7YUu5-RxhbCEKHMvfUNxXhTd9lcGTC8CGAmWeXZTta4,6378
230
230
  omdev/py/docstrings/epydoc.py,sha256=Z6Dg6ImKOY3hP-mZoiwU3nGOReap5vt_T_3LIGnpess,6177
231
- omdev/py/docstrings/google.py,sha256=D0KHXPRsf3HFKZmMXdBnfkVGclnjQX7ae9wMqsMVeqs,10301
231
+ omdev/py/docstrings/google.py,sha256=zWrhzQ_QGOtH6s9SfmZGCduKv3JJVe6rJlDe-kAdUW8,10552
232
232
  omdev/py/docstrings/numpydoc.py,sha256=SLyIoPR5U5HtXJ18yeQf4HlYHtcro3THh9CqeWDDDH4,12266
233
233
  omdev/py/docstrings/parser.py,sha256=umJEgQBkSXLwWIKZrBbFCfNrz847vpTNDqTTEwlvHpA,2324
234
234
  omdev/py/docstrings/rest.py,sha256=c2xPYg_W01W9eYY_KLKX69E4qu4jpkgUshi5K5EyVv8,5221
@@ -252,7 +252,7 @@ omdev/pyproject/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
252
252
  omdev/pyproject/resources/docker-dev.sh,sha256=DHkz5D18jok_oDolfg2mqrvGRWFoCe9GQo04dR1czcc,838
253
253
  omdev/pyproject/resources/python.sh,sha256=rFaN4SiJ9hdLDXXsDTwugI6zsw6EPkgYMmtacZeTbvw,749
254
254
  omdev/scripts/__init__.py,sha256=MKCvUAEQwsIvwLixwtPlpBqmkMXLCnjjXyAXvVpDwVk,91
255
- omdev/scripts/ci.py,sha256=9yDySeJ4tU63Zf8jSL2QdM1jkCEQ3T8VCTc3pHOTUFo,357984
255
+ omdev/scripts/ci.py,sha256=eaxyndzJcHoXh1jbsP67QbtMgVzOgr2RvN0ysAoAOyI,358433
256
256
  omdev/scripts/interp.py,sha256=T8EdNxuncwqCXfIBfCLoUcsYNqEhOrOE8V1hC9vTzqI,158095
257
257
  omdev/scripts/pyproject.py,sha256=qBBXmbdKMYzqxnb0zEWYhCOg9Cy0pWno3wjulICFj_o,267626
258
258
  omdev/scripts/slowcat.py,sha256=lssv4yrgJHiWfOiHkUut2p8E8Tq32zB-ujXESQxFFHY,2728
@@ -303,9 +303,9 @@ omdev/tools/jsonview/resources/jsonview.js,sha256=faDvXDOXKvEvjOuIlz4D3F2ReQXb_b
303
303
  omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
304
304
  omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
305
305
  omdev/tools/pawk/pawk.py,sha256=ao5mdrpiSU4AZ8mBozoEaV3UVlmVTnRG9wD9XP70MZE,11429
306
- omdev-0.0.0.dev364.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
307
- omdev-0.0.0.dev364.dist-info/METADATA,sha256=3g4HotiW-zDtGxF8cJ5YxL_6gfz2hZHGmsZEh5mSppk,1674
308
- omdev-0.0.0.dev364.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
309
- omdev-0.0.0.dev364.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
310
- omdev-0.0.0.dev364.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
311
- omdev-0.0.0.dev364.dist-info/RECORD,,
306
+ omdev-0.0.0.dev365.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
307
+ omdev-0.0.0.dev365.dist-info/METADATA,sha256=kQICG8LA3JGKzBdHFee2vJVQP5hh1R-racMDhIO7CQU,1674
308
+ omdev-0.0.0.dev365.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
309
+ omdev-0.0.0.dev365.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
310
+ omdev-0.0.0.dev365.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
311
+ omdev-0.0.0.dev365.dist-info/RECORD,,