Skip to content

Commit

Permalink
2025-01-09T22:45:04Z
Browse files Browse the repository at this point in the history
  • Loading branch information
wrmsr committed Jan 9, 2025
1 parent 8499b6c commit 04aa500
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .pkg/omdev-cext/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
urls = {source = 'https://github.com/wrmsr/omlish'}
license = {text = 'BSD-3-Clause'}
requires-python = '>=3.12'
version = '0.0.0.dev203'
version = '0.0.0.dev204'
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 2 - Pre-Alpha',
Expand All @@ -22,7 +22,7 @@ classifiers = [
]
description = 'omdev'
dependencies = [
'omdev == 0.0.0.dev203',
'omdev == 0.0.0.dev204',
]

[tool.setuptools]
Expand Down
4 changes: 2 additions & 2 deletions .pkg/omdev-cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
urls = {source = 'https://github.com/wrmsr/omlish'}
license = {text = 'BSD-3-Clause'}
requires-python = '>=3.12'
version = '0.0.0.dev203'
version = '0.0.0.dev204'
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 2 - Pre-Alpha',
Expand All @@ -22,7 +22,7 @@ classifiers = [
]
description = 'omdev'
dependencies = [
'omdev == 0.0.0.dev203',
'omdev == 0.0.0.dev204',
]

[project.scripts]
Expand Down
4 changes: 2 additions & 2 deletions .pkg/omdev/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
urls = {source = 'https://github.com/wrmsr/omlish'}
license = {text = 'BSD-3-Clause'}
requires-python = '>=3.12'
version = '0.0.0.dev203'
version = '0.0.0.dev204'
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 2 - Pre-Alpha',
Expand All @@ -22,7 +22,7 @@ classifiers = [
]
description = 'omdev'
dependencies = [
'omlish == 0.0.0.dev203',
'omlish == 0.0.0.dev204',
]

[project.optional-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions .pkg/ominfra/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
urls = {source = 'https://github.com/wrmsr/omlish'}
license = {text = 'BSD-3-Clause'}
requires-python = '>=3.12'
version = '0.0.0.dev203'
version = '0.0.0.dev204'
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 2 - Pre-Alpha',
Expand All @@ -22,9 +22,9 @@ classifiers = [
]
description = 'ominfra'
dependencies = [
'omdev == 0.0.0.dev203',
'omlish == 0.0.0.dev203',
'omserv == 0.0.0.dev203',
'omdev == 0.0.0.dev204',
'omlish == 0.0.0.dev204',
'omserv == 0.0.0.dev204',
]

[project.optional-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion .pkg/omlish/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
urls = {source = 'https://github.com/wrmsr/omlish'}
license = {text = 'BSD-3-Clause'}
requires-python = '>=3.12'
version = '0.0.0.dev203'
version = '0.0.0.dev204'
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 2 - Pre-Alpha',
Expand Down
6 changes: 3 additions & 3 deletions .pkg/ommlx/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
urls = {source = 'https://github.com/wrmsr/omlish'}
license = {text = 'BSD-3-Clause'}
requires-python = '>=3.12'
version = '0.0.0.dev203'
version = '0.0.0.dev204'
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 2 - Pre-Alpha',
Expand All @@ -22,8 +22,8 @@ classifiers = [
]
description = 'ommlx'
dependencies = [
'omdev == 0.0.0.dev203',
'omlish == 0.0.0.dev203',
'omdev == 0.0.0.dev204',
'omlish == 0.0.0.dev204',
]

[project.optional-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions .pkg/omserv/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
urls = {source = 'https://github.com/wrmsr/omlish'}
license = {text = 'BSD-3-Clause'}
requires-python = '>=3.12'
version = '0.0.0.dev203'
version = '0.0.0.dev204'
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 2 - Pre-Alpha',
Expand All @@ -22,7 +22,7 @@ classifiers = [
]
description = 'omserv'
dependencies = [
'omlish == 0.0.0.dev203',
'omlish == 0.0.0.dev204',
]

[project.optional-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion omlish/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.0.0.dev203'
__version__ = '0.0.0.dev204'
__revision__ = None


Expand Down
7 changes: 3 additions & 4 deletions ommlx/wiki/utils/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import typing as ta
import xml.etree.ElementTree as ET

from omlish import check
from omlish import lang
from omlish.formats.xml import strip_ns

Expand Down Expand Up @@ -71,7 +70,7 @@ def yield_root_children(
@dc.dataclass(frozen=True, kw_only=True)
class ElementToKwargs:
attrs: ta.Mapping[str, tuple[str, ta.Callable[[str], ta.Any]] | str | None] = dc.field(default_factory=dict)
scalars: ta.Mapping[str, tuple[str, ta.Callable[[str], ta.Any]] | str | None] = dc.field(default_factory=dict)
scalars: ta.Mapping[str, tuple[str, ta.Callable[[str | None], ta.Any]] | str | None] = dc.field(default_factory=dict) # noqa
single_children: ta.Mapping[str, tuple[str, ta.Callable[[Element], ta.Any]]] = dc.field(default_factory=dict)
list_children: ta.Mapping[str, tuple[str, ta.Callable[[Element], ta.Any]]] = dc.field(default_factory=dict)
text: str | None = None
Expand Down Expand Up @@ -109,8 +108,8 @@ def set_kw(k: str, v: ta.Any) -> None:
if isinstance(t, str):
set_kw(t, cel.text)
else:
sk, fn = t
set_kw(sk, fn(check.not_none(cel.text)))
sk, sfn = t
set_kw(sk, sfn(cel.text))

elif k in self.single_children:
ck, fn = self.single_children[k]
Expand Down
18 changes: 12 additions & 6 deletions ommlx/wiki/xml.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import typing as ta

from omlish import check

from . import models as mdl
from .utils import xml as xu

Expand All @@ -14,6 +16,10 @@ def symm_dct(*ks: T) -> ta.Mapping[T, T]:
return {k: k for k in ks}


def parse_int(s: str | None) -> int:
return int(check.non_empty_str(s))


##


Expand Down Expand Up @@ -83,7 +89,7 @@ def _parse_deleted(s: str) -> bool:
'username',
'ip',
),
'id': ('id', int),
'id': ('id', parse_int),
},
),
)
Expand All @@ -106,9 +112,9 @@ def _parse_deleted(s: str) -> bool:
mdl.Revision,
xu.ElementToKwargs(
scalars={
'id': ('id', int),
'parentid': ('parentid', int),
'origin': ('origin', int),
'id': ('id', parse_int),
'parentid': ('parentid', parse_int),
'origin': ('origin', parse_int),
'minor': ('minor', lambda _: True),
**symm_dct(
'timestamp',
Expand All @@ -132,8 +138,8 @@ def _parse_deleted(s: str) -> bool:
mdl.Page,
xu.ElementToKwargs(
scalars={
'ns': ('ns', int),
'id': ('id', int),
'ns': ('ns', parse_int),
'id': ('id', parse_int),
**symm_dct(
'title',
'restrictions',
Expand Down

0 comments on commit 04aa500

Please sign in to comment.