preparse 1.1.4__tar.gz → 1.1.5__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.
Files changed (45) hide show
  1. {preparse-1.1.4 → preparse-1.1.5}/PKG-INFO +3 -3
  2. {preparse-1.1.4 → preparse-1.1.5}/docs/v1.1.rst +2 -2
  3. {preparse-1.1.4 → preparse-1.1.5}/pyproject.toml +3 -3
  4. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/core/Click.py +2 -1
  5. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/core/Optdict.py +17 -10
  6. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/core/PreParser.py +9 -7
  7. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/core/enums.py +2 -3
  8. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/core/warnings.py +4 -3
  9. {preparse-1.1.4 → preparse-1.1.5}/src/preparse.egg-info/PKG-INFO +3 -3
  10. {preparse-1.1.4 → preparse-1.1.5}/src/preparse.egg-info/requires.txt +2 -2
  11. {preparse-1.1.4 → preparse-1.1.5}/LICENSE.txt +0 -0
  12. {preparse-1.1.4 → preparse-1.1.5}/MANIFEST.in +0 -0
  13. {preparse-1.1.4 → preparse-1.1.5}/README.rst +0 -0
  14. {preparse-1.1.4 → preparse-1.1.5}/docs/v1.0.rst +0 -0
  15. {preparse-1.1.4 → preparse-1.1.5}/setup.cfg +0 -0
  16. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/__init__.py +0 -0
  17. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_items/Bundle.py +0 -0
  18. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_items/Item.py +0 -0
  19. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_items/Long.py +0 -0
  20. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_items/Option.py +0 -0
  21. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_items/Positional.py +0 -0
  22. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_items/Special.py +0 -0
  23. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_items/__init__.py +0 -0
  24. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_processing/__init__.py +0 -0
  25. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_processing/deparsing.py +0 -0
  26. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_processing/digesting.py +0 -0
  27. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_processing/parsing.py +0 -0
  28. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_processing/pulling.py +0 -0
  29. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_tests/__init__.py +0 -0
  30. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_tests/expit.py +0 -0
  31. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_utils/__init__.py +0 -0
  32. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/_utils/dataprop.py +0 -0
  33. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/core/__init__.py +0 -0
  34. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/py.typed +0 -0
  35. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/__init__.py +0 -0
  36. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/data.toml +0 -0
  37. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/expit.toml +0 -0
  38. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/test_data_toml.py +0 -0
  39. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/test_enums.py +0 -0
  40. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/test_expit_toml.py +0 -0
  41. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/test_optdict.py +0 -0
  42. {preparse-1.1.4 → preparse-1.1.5}/src/preparse/tests/test_preparser.py +0 -0
  43. {preparse-1.1.4 → preparse-1.1.5}/src/preparse.egg-info/SOURCES.txt +0 -0
  44. {preparse-1.1.4 → preparse-1.1.5}/src/preparse.egg-info/dependency_links.txt +0 -0
  45. {preparse-1.1.4 → preparse-1.1.5}/src/preparse.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: preparse
3
- Version: 1.1.4
3
+ Version: 1.1.5
4
4
  Summary: This project preparses args for further parsing later on.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
@@ -19,9 +19,9 @@ Requires-Python: >=3.11
19
19
  Description-Content-Type: text/x-rst
20
20
  License-File: LICENSE.txt
21
21
  Requires-Dist: click<9,>=8.2
22
- Requires-Dist: cmp3<2,>=1.0
22
+ Requires-Dist: cmp3<2,>=1.1
23
23
  Requires-Dist: copyable<2,>=1.1
24
- Requires-Dist: datahold<4,>=3.0.34.dev1
24
+ Requires-Dist: datahold<4,>=3.0
25
25
  Requires-Dist: datarepr<2,>=1.2
26
26
  Requires-Dist: frozendict<3,>=2.4.7
27
27
  Requires-Dist: setdoc<2,>=1.3
@@ -172,8 +172,8 @@ This ``property`` determines the approach to the special argument ``'--'``.
172
172
 
173
173
  This method a ``dict`` representing the current instance.
174
174
 
175
- ``warn: types.FunctionType``
176
- """"""""""""""""""""""""""""
175
+ ``warn: Callable[[PreparseWarning], Any]``
176
+ """"""""""""""""""""""""""""""""""""""""""
177
177
 
178
178
  This property holds a function that is called whenever ``parse_args`` encounters a warning.
179
179
  The warning is given as the only positional arguments.
@@ -19,9 +19,9 @@ classifiers = [
19
19
  ]
20
20
  dependencies = [
21
21
  "click>=8.2,<9",
22
- "cmp3>=1.0,<2",
22
+ "cmp3>=1.1,<2",
23
23
  "copyable>=1.1,<2",
24
- "datahold>=3.0.34.dev1,<4",
24
+ "datahold>=3.0,<4",
25
25
  "datarepr>=1.2,<2",
26
26
  "frozendict>=2.4.7,<3",
27
27
  "setdoc>=1.3,<2",
@@ -36,7 +36,7 @@ license-files = [
36
36
  name = "preparse"
37
37
  readme = "README.rst"
38
38
  requires-python = ">=3.11"
39
- version = "1.1.4"
39
+ version = "1.1.5"
40
40
 
41
41
  [project.urls]
42
42
  Download = "https://pypi.org/project/preparse/#files"
@@ -3,7 +3,8 @@ from __future__ import annotations
3
3
  import dataclasses
4
4
  import functools
5
5
  import types
6
- from typing import *
6
+ from collections.abc import Callable
7
+ from typing import TYPE_CHECKING, Any, Self
7
8
 
8
9
  import setdoc
9
10
  from copyable import Copyable
@@ -1,21 +1,28 @@
1
+ from collections.abc import Hashable
1
2
  from typing import Any, Optional, Self
2
3
 
3
- import cmp3 # type: ignore
4
+ import cmp3
4
5
  import datahold
5
6
  import setdoc
6
- from datarepr import datarepr # type: ignore
7
+ from datarepr import datarepr
7
8
  from frozendict import frozendict
8
9
 
9
- from preparse.core.enums import *
10
- from preparse.core.warnings import *
10
+ from preparse.core.enums import Nargs
11
11
 
12
12
  __all__ = ["Optdict"]
13
13
 
14
14
 
15
+ def nargs(value: Any, /) -> Nargs:
16
+ if isinstance(value, int):
17
+ return Nargs(value)
18
+ else:
19
+ return Nargs.OPTIONAL_ARGUMENT
20
+
21
+
15
22
  class Optdict(cmp3.CmpABC, datahold.HoldDict[str, Nargs]):
16
23
  __slots__ = ()
17
24
 
18
- _data: Any
25
+ _data: frozendict[str, Nargs]
19
26
 
20
27
  @setdoc.basic
21
28
  def __cmp__(self: Self, other: Any, /) -> Optional[int]:
@@ -28,7 +35,7 @@ class Optdict(cmp3.CmpABC, datahold.HoldDict[str, Nargs]):
28
35
 
29
36
  @setdoc.basic
30
37
  def __init__(self: Self, data: Any = (), /) -> None:
31
- datahold.HoldDict[str, Nargs].__init__(self, data)
38
+ datahold.HoldDict.__init__(self, data)
32
39
 
33
40
  @setdoc.basic
34
41
  def __repr__(self: Self, /) -> str:
@@ -36,16 +43,16 @@ class Optdict(cmp3.CmpABC, datahold.HoldDict[str, Nargs]):
36
43
 
37
44
  __str__ = object.__str__
38
45
 
39
- @property
46
+ @property # type: ignore[override]
40
47
  def data(self: Self) -> frozendict[str, Nargs]:
41
- return frozendict[str, Nargs](self._data)
48
+ return frozendict(self._data)
42
49
 
43
50
  @data.setter
44
51
  def data(self: Self, value: Any) -> None:
45
- a: frozendict[Any, Any]
52
+ a: frozendict[Hashable, object]
46
53
  x: map
47
54
  y: map
48
55
  a = frozendict(value)
49
56
  x = map(str, a.keys())
50
- y = map(Nargs, a.values())
57
+ y = map(nargs, a.values())
51
58
  self._data = frozendict(zip(x, y, strict=True))
@@ -2,9 +2,8 @@ from __future__ import annotations
2
2
 
3
3
  import os
4
4
  import sys
5
- import types
6
- from collections.abc import Iterable
7
- from typing import Any, Callable, Optional, Self, cast
5
+ from collections.abc import Callable, Iterable
6
+ from typing import Any, Optional, Self, cast
8
7
 
9
8
  import click as cl
10
9
  import setdoc
@@ -17,7 +16,7 @@ from preparse._utils.dataprop import dataprop
17
16
  from preparse.core.Click import Click
18
17
  from preparse.core.enums import *
19
18
  from preparse.core.Optdict import Optdict
20
- from preparse.core.warnings import *
19
+ from preparse.core.warnings import PreparseWarning
21
20
 
22
21
  __all__ = ["PreParser"]
23
22
 
@@ -69,7 +68,7 @@ class PreParser(Copyable):
69
68
  return bool(value)
70
69
 
71
70
  @dataprop
72
- def bundling(self: Self, value: Any) -> Tuning:
71
+ def bundling(self: Self, value: int) -> Tuning:
73
72
  "This property decides how to approach the bundling of short options."
74
73
  return Tuning(value)
75
74
 
@@ -152,7 +151,7 @@ class PreParser(Copyable):
152
151
  self.prog = ctx.info_name
153
152
 
154
153
  @dataprop
155
- def special(self: Self, value: Any) -> Tuning:
154
+ def special(self: Self, value: int) -> Tuning:
156
155
  "This Tuning property determines the approach towards the special argument."
157
156
  return Tuning(value)
158
157
 
@@ -168,6 +167,9 @@ class PreParser(Copyable):
168
167
  return dict(ans)
169
168
 
170
169
  @dataprop
171
- def warn(self: Self, value: Callable) -> types.FunctionType:
170
+ def warn(
171
+ self: Self,
172
+ value: Callable[[PreparseWarning], Any],
173
+ ) -> Callable[[PreparseWarning], Any]:
172
174
  "This property gives a function that takes in the warnings."
173
175
  return tofunc(value)
@@ -5,7 +5,7 @@ between the values zero, meaning no, and one, meaning yes."""
5
5
 
6
6
  import enum
7
7
  import operator
8
- from typing import *
8
+ from typing import Self
9
9
 
10
10
  __all__ = [
11
11
  "Tuning",
@@ -15,8 +15,7 @@ __all__ = [
15
15
 
16
16
  class BaseEnum(enum.IntEnum):
17
17
  @classmethod
18
- def _missing_(cls: type, value: Any) -> Any:
19
- operator.index(value)
18
+ def _missing_(cls: type[Self], value: object) -> Self:
20
19
  return cls(2)
21
20
 
22
21
 
@@ -1,5 +1,6 @@
1
1
  from abc import abstractmethod
2
- from typing import *
2
+ from collections.abc import Iterable
3
+ from typing import Any, Self
3
4
 
4
5
  import setdoc
5
6
  from copyable import Copyable
@@ -113,7 +114,7 @@ class PreparseAmbiguousOptionWarning(PreparseLongonlyWarning):
113
114
 
114
115
  @setdoc.basic
115
116
  def __init__(
116
- self: Self, *, prog: Any, option: Any, possibilities: Iterable
117
+ self: Self, *, prog: Any, option: Any, possibilities: Iterable[object]
117
118
  ) -> None:
118
119
  self.prog = prog
119
120
  self.option = option
@@ -129,7 +130,7 @@ class PreparseAmbiguousOptionWarning(PreparseLongonlyWarning):
129
130
  return ans
130
131
 
131
132
  @dataprop
132
- def possibilities(self: Self, value: Iterable) -> tuple[str, ...]:
133
+ def possibilities(self: Self, value: Iterable[object]) -> tuple[str, ...]:
133
134
  return tuple(map(str, value))
134
135
 
135
136
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: preparse
3
- Version: 1.1.4
3
+ Version: 1.1.5
4
4
  Summary: This project preparses args for further parsing later on.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License-Expression: MIT
@@ -19,9 +19,9 @@ Requires-Python: >=3.11
19
19
  Description-Content-Type: text/x-rst
20
20
  License-File: LICENSE.txt
21
21
  Requires-Dist: click<9,>=8.2
22
- Requires-Dist: cmp3<2,>=1.0
22
+ Requires-Dist: cmp3<2,>=1.1
23
23
  Requires-Dist: copyable<2,>=1.1
24
- Requires-Dist: datahold<4,>=3.0.34.dev1
24
+ Requires-Dist: datahold<4,>=3.0
25
25
  Requires-Dist: datarepr<2,>=1.2
26
26
  Requires-Dist: frozendict<3,>=2.4.7
27
27
  Requires-Dist: setdoc<2,>=1.3
@@ -1,7 +1,7 @@
1
1
  click<9,>=8.2
2
- cmp3<2,>=1.0
2
+ cmp3<2,>=1.1
3
3
  copyable<2,>=1.1
4
- datahold<4,>=3.0.34.dev1
4
+ datahold<4,>=3.0
5
5
  datarepr<2,>=1.2
6
6
  frozendict<3,>=2.4.7
7
7
  setdoc<2,>=1.3
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes