preparse 1.0.13__tar.gz → 1.0.13.post1.dev0__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 (48) hide show
  1. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/LICENSE.txt +1 -1
  2. preparse-1.0.13.post1.dev0/MANIFEST.in +1 -0
  3. preparse-1.0.13.post1.dev0/PKG-INFO +36 -0
  4. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/README.rst +1 -1
  5. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/docs/v1.0.rst +37 -37
  6. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/pyproject.toml +13 -6
  7. preparse-1.0.13.post1.dev0/src/preparse/__init__.py +33 -0
  8. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_items/Bundle.py +8 -8
  9. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_items/Item.py +7 -7
  10. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_items/Long.py +9 -9
  11. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_items/Option.py +7 -7
  12. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_items/Positional.py +5 -5
  13. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_items/Special.py +5 -5
  14. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_items/__init__.py +9 -0
  15. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_processing/__init__.py +13 -12
  16. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_processing/deparsing.py +1 -3
  17. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_processing/digesting.py +11 -5
  18. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_processing/parsing.py +15 -9
  19. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_processing/pulling.py +6 -5
  20. preparse-1.0.13.post1.dev0/src/preparse/_utils/__init__.py +3 -0
  21. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/_utils/dataprop.py +6 -4
  22. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/core/Click.py +5 -4
  23. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/core/Optdict.py +16 -9
  24. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/core/PreParser.py +20 -13
  25. preparse-1.0.13.post1.dev0/src/preparse/core/__init__.py +26 -0
  26. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/core/enums.py +4 -7
  27. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/core/warnings.py +17 -16
  28. preparse-1.0.13.post1.dev0/src/preparse/py.typed +0 -0
  29. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/__init__.py +3 -3
  30. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/data.toml +282607 -282607
  31. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/test_data_toml.py +29 -12
  32. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/test_enums.py +4 -4
  33. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/test_expit_toml.py +24 -11
  34. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/test_optdict.py +12 -6
  35. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/test_preparser.py +12 -6
  36. preparse-1.0.13.post1.dev0/src/preparse.egg-info/PKG-INFO +36 -0
  37. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse.egg-info/SOURCES.txt +1 -1
  38. preparse-1.0.13/MANIFEST.in +0 -1
  39. preparse-1.0.13/PKG-INFO +0 -57
  40. preparse-1.0.13/src/preparse/__init__.py +0 -2
  41. preparse-1.0.13/src/preparse/_utils/__init__.py +0 -1
  42. preparse-1.0.13/src/preparse/core/__init__.py +0 -5
  43. preparse-1.0.13/src/preparse.egg-info/PKG-INFO +0 -57
  44. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/setup.cfg +0 -0
  45. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse/tests/expit.toml +28 -28
  46. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse.egg-info/dependency_links.txt +0 -0
  47. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse.egg-info/requires.txt +0 -0
  48. {preparse-1.0.13 → preparse-1.0.13.post1.dev0}/src/preparse.egg-info/top_level.txt +0 -0
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ include src/preparse/tests/*.toml
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: preparse
3
+ Version: 1.0.13.post1.dev0
4
+ Summary: This project preparses args for further parsing later on.
5
+ Author-email: Johannes <johannes.programming@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Download, https://pypi.org/project/preparse/#files
8
+ Project-URL: Index, https://pypi.org/project/preparse/
9
+ Project-URL: Source, https://github.com/johannes-programming/preparse/
10
+ Project-URL: Website, https://preparse.johannes-programming.online/
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/x-rst
20
+ License-File: LICENSE.txt
21
+ Requires-Dist: click<9,>=8.2
22
+ Requires-Dist: cmp3<2,>=1.0
23
+ Requires-Dist: copyable<2,>=1.0
24
+ Requires-Dist: datahold<4,>=3.0
25
+ Requires-Dist: datarepr<2,>=1.1
26
+ Requires-Dist: frozendict<3,>=2.4.7
27
+ Requires-Dist: overloadable<2,>=1.1
28
+ Requires-Dist: setdoc<2,>=1.2.10
29
+ Requires-Dist: tofunc<2,>=1.0
30
+ Dynamic: license-file
31
+
32
+ ========
33
+ preparse
34
+ ========
35
+
36
+ Visit the website `https://preparse.johannes-programming.online/ <https://preparse.johannes-programming.online/>`_ for more information.
@@ -2,4 +2,4 @@
2
2
  preparse
3
3
  ========
4
4
 
5
- Visit the website `https://preparse.johannes-programming.online/ <https://preparse.johannes-programming.online/>`_ for more information.
5
+ Visit the website `https://preparse.johannes-programming.online/ <https://preparse.johannes-programming.online/>`_ for more information.
@@ -1,17 +1,9 @@
1
1
  Overview
2
2
  --------
3
3
 
4
- The preparse project allows to preparse arguments before the main parsing.
4
+ The preparse project allows to preparse arguments before the main parsing.
5
5
  Its ability to deabbreviate options is especially useful for use with ``click``.
6
6
 
7
- Links
8
- -----
9
-
10
- - Download: https://pypi.org/project/preparse/#files
11
- - Index: https://pypi.org/project/preparse/
12
- - Source: https://github.com/johannes-programming/preparse/
13
- - Website: https://preparse.johannes-programming.online/
14
-
15
7
  Installation
16
8
  ------------
17
9
 
@@ -64,8 +56,8 @@ Features
64
56
  The PreParser class
65
57
  ~~~~~~~~~~~~~~~~~~~
66
58
 
67
- ``class preparse.PreParser(*, allowslong: Any = True, allowsshort: Any = True, bundling: Any = Tuning.MAINTAIN, expandsabbr: Any = True, expectsabbr: Any = True, expectsposix: Any = False, optdict: Any = (), prog: Any = None, reconcilesorders: Any = True, special: Any = preparse.Tuning.MAINTAIN, warn: Callable = str)``
68
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
+ ``class preparse.PreParser(*, allowslong: Any = True, allowsshort: Any = True, bundling: Any = Tuning.MAINTAIN, expandsabbr: Any = True, expectsabbr: Any = True, expectsposix: Any = False, optdict: Any = (), prog: Any = None, reconcilesorders: Any = True, special: Any = preparse.Tuning.MAINTAIN, warn: Callable[..., Any] = str)``
60
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69
61
 
70
62
  This class is the centerpiece of the preparse. Its behaviour follows the principles of getopt from C.
71
63
 
@@ -112,43 +104,43 @@ This boolean property determines whether the order of arguments to conform to th
112
104
  ``optdict: preparse.Optdict``
113
105
  """""""""""""""""""""""""""""
114
106
 
115
- This property holds a dict-like object.
116
- Its keys are the options.
117
- Its values specify ``preparse.Nargs``.
118
- Options not found within the dictionary
119
- cause a ``preparse.PreparseInvalidOptionWarning``
107
+ This property holds a dict-like object.
108
+ Its keys are the options.
109
+ Its values specify ``preparse.Nargs``.
110
+ Options not found within the dictionary
111
+ cause a ``preparse.PreparseInvalidOptionWarning``
120
112
  and are then assumed to have no arguments.
121
113
 
122
- ``parse_args(args: Optional[Iterable] = None) -> list[str]``
123
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
114
+ ``parse_args(args: Iterable[Any] | None = None) -> list[str]``
115
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
124
116
 
125
- This method is at the core of the class.
126
- It returns a preparsed list of arguments.
127
- If ``None`` is passed as args then ``sys.argv[1:]`` is used.
117
+ This method is at the core of the class.
118
+ It returns a preparsed list of arguments.
119
+ If ``None`` is passed as args then ``sys.argv[1:]`` is used.
128
120
  If the method is applied repeatedly to a list there will be no changes after the first run.
129
121
 
130
122
  ``prog: str``
131
123
  """""""""""""
132
124
 
133
- This ``str`` property represents the name of the program.
125
+ This ``str`` property represents the name of the program.
134
126
  If the value passed to the property is ``None`` then ``str(sys.argv[0])`` is saved.
135
127
 
136
128
  ``reconcilesorders: bool``
137
129
  """"""""""""""""""""""""""
138
130
 
139
- This boolean property determines whether compatibility with both orders,
131
+ This boolean property determines whether compatibility with both orders,
140
132
  POSIX and the interleaving of options with positonal arguments, should be enforced.
141
133
 
142
134
  ``reflectClickCommand(cmd: click.Command) -> None``
143
135
  """""""""""""""""""""""""""""""""""""""""""""""""""
144
136
 
145
- This method alters the current instance to reflect a ``click.Command`` object.
137
+ This method alters the current instance to reflect a ``click.Command`` object.
146
138
  Concretely the optdict property is changed.
147
139
 
148
140
  ``reflectClickContext(ctx: click.Context) -> None``
149
141
  """""""""""""""""""""""""""""""""""""""""""""""""""
150
142
 
151
- This method alters the current instance to reflect a ``click.Context`` object.
143
+ This method alters the current instance to reflect a ``click.Context`` object.
152
144
  Concretely the prog property is changed.
153
145
 
154
146
  ``special: preparse.Tuning``
@@ -156,18 +148,18 @@ Concretely the prog property is changed.
156
148
 
157
149
  This ``preparse.Tuning`` property determines the approach to the special argument ``'--'``.
158
150
 
159
- ``todict() -> dict``
160
- """"""""""""""""""""
151
+ ``todict() -> dict[str, Any]``
152
+ """"""""""""""""""""""""""""""
161
153
 
162
154
  This method a dict representing the current instance.
163
155
 
164
156
  ``warn: types.FunctionType``
165
157
  """"""""""""""""""""""""""""
166
158
 
167
- This property holds a function that is called whenever ``parse_args`` encounters a warning.
168
- The warning is given as the only positional arguments.
169
- No keyword arguments are given.
170
- Its return value is discarded.
159
+ This property holds a function that is called whenever ``parse_args`` encounters a warning.
160
+ The warning is given as the only positional arguments.
161
+ No keyword arguments are given.
162
+ Its return value is discarded.
171
163
  Therefore, ``str`` is used to discard the warnings.
172
164
 
173
165
  The Click class
@@ -215,7 +207,7 @@ It is designed for ``preparse.PreParser.optdict``.
215
207
  The Enums
216
208
  ~~~~~~~~~
217
209
 
218
- These classes are subclasses of ``enum.IntEnum``.
210
+ These classes are subclasses of ``enum.IntEnum``.
219
211
  Any value different from ``0`` (meaning no) and ``1`` (meaning yes) is interpreted as ``2`` (meaning intermediate).
220
212
 
221
213
  ``class preparse.Tuning``
@@ -277,21 +269,29 @@ This class warns about unallowed arguments. This can only happen for long option
277
269
  The Tests
278
270
  ~~~~~~~~~
279
271
 
280
- ``preparse.test() -> unittest.TextTestResult``
281
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
272
+ ``preparse.tests.test() -> unittest.TextTestResult``
273
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
282
274
 
283
275
  This project can be tested through its test function.
284
276
 
285
277
  .. code-block:: python
286
278
 
287
- import preparse
288
- preparse.test()
279
+ import preparse.tests
280
+ preparse.tests.test()
289
281
 
290
282
  License
291
283
  -------
292
284
 
293
285
  This project is licensed under the MIT License.
294
286
 
287
+ Links
288
+ -----
289
+
290
+ - Download: https://pypi.org/project/preparse/#files
291
+ - Index: https://pypi.org/project/preparse/
292
+ - Source: https://github.com/johannes-programming/preparse/
293
+ - Website: https://preparse.johannes-programming.online/
294
+
295
295
  Impressum
296
296
  ---------
297
297
 
@@ -300,4 +300,4 @@ Impressum
300
300
  - Name: Johannes
301
301
  - Email: johannes.programming@gmail.com
302
302
  - Homepage: https://www.johannes-programming.online/
303
- - Gravatar: https://www.johannes-programming.fyi/
303
+ - Gravatar: https://www.johannes-programming.fyi/
@@ -1,7 +1,7 @@
1
1
  [build-system]
2
2
  build-backend = "setuptools.build_meta"
3
3
  requires = [
4
- "setuptools>=64.0",
4
+ "setuptools>=77.0",
5
5
  ]
6
6
 
7
7
  [project]
@@ -10,7 +10,6 @@ authors = [
10
10
  ]
11
11
  classifiers = [
12
12
  "Development Status :: 5 - Production/Stable",
13
- "License :: OSI Approved :: MIT License",
14
13
  "Natural Language :: English",
15
14
  "Operating System :: OS Independent",
16
15
  "Programming Language :: Python",
@@ -31,16 +30,24 @@ dependencies = [
31
30
  ]
32
31
  description = "This project preparses args for further parsing later on."
33
32
  keywords = []
33
+ license = "MIT"
34
+ license-files = [
35
+ "LICENSE.txt",
36
+ ]
34
37
  name = "preparse"
35
38
  readme = "README.rst"
36
39
  requires-python = ">=3.11"
37
- version = "1.0.13"
38
-
39
- [project.license]
40
- file = "LICENSE.txt"
40
+ version = "1.0.13.post1.dev0"
41
41
 
42
42
  [project.urls]
43
43
  Download = "https://pypi.org/project/preparse/#files"
44
44
  Index = "https://pypi.org/project/preparse/"
45
45
  Source = "https://github.com/johannes-programming/preparse/"
46
46
  Website = "https://preparse.johannes-programming.online/"
47
+
48
+ [tool.mypy]
49
+ files = [
50
+ ".",
51
+ ]
52
+ python_version = "3.11"
53
+ strict = true
@@ -0,0 +1,33 @@
1
+ __all__: list[str] = [
2
+ "Click",
3
+ "Nargs",
4
+ "Optdict",
5
+ "PreParser",
6
+ "PreparseAmbiguousOptionWarning",
7
+ "PreparseInvalidOptionWarning",
8
+ "PreparseRequiredArgumentWarning",
9
+ "PreparseUnallowedArgumentWarning",
10
+ "PreparseWarning",
11
+ "Tuning",
12
+ "core",
13
+ "enums",
14
+ "test",
15
+ "tests",
16
+ "warnings",
17
+ ]
18
+
19
+ from preparse.core import (
20
+ Click,
21
+ Nargs,
22
+ Optdict,
23
+ PreparseAmbiguousOptionWarning,
24
+ PreparseInvalidOptionWarning,
25
+ PreParser,
26
+ PreparseRequiredArgumentWarning,
27
+ PreparseUnallowedArgumentWarning,
28
+ PreparseWarning,
29
+ Tuning,
30
+ enums,
31
+ warnings,
32
+ )
33
+ from preparse.tests import test
@@ -1,13 +1,13 @@
1
- from typing import *
1
+ __all__: list[str] = ["Bundle"]
2
+
3
+ from typing import Any, Self
2
4
 
3
5
  import setdoc
4
6
 
5
7
  from preparse._items.Item import Item
6
8
  from preparse._items.Option import Option
7
9
  from preparse._utils.dataprop import dataprop
8
- from preparse.core.enums import *
9
-
10
- __all__ = ["Bundle"]
10
+ from preparse.core.enums import Nargs, Tuning
11
11
 
12
12
 
13
13
  class Bundle(Option):
@@ -15,7 +15,7 @@ class Bundle(Option):
15
15
  chars: str
16
16
  joined: bool
17
17
  nargs: Nargs
18
- right: Optional[str]
18
+ right: str | None
19
19
 
20
20
  __slots__ = ()
21
21
 
@@ -25,14 +25,14 @@ class Bundle(Option):
25
25
  *,
26
26
  chars: str,
27
27
  joined: bool = False,
28
- right: Optional[str] = None,
28
+ right: str | None = None,
29
29
  ) -> None:
30
30
  self.chars = chars
31
31
  self.joined = joined
32
32
  self.right = right
33
33
 
34
34
  @classmethod
35
- def _split_allowslong(cls: type, chars: str) -> list[str]:
35
+ def _split_allowslong(cls: type[Self], chars: str) -> list[str]:
36
36
  ans: list[str]
37
37
  x: str
38
38
  ans = list()
@@ -44,7 +44,7 @@ class Bundle(Option):
44
44
  return ans
45
45
 
46
46
  @classmethod
47
- def _split_shortonly(cls: type, chars: str) -> list[str]:
47
+ def _split_shortonly(cls: type[Self], chars: str) -> list[str]:
48
48
  ans: list[str]
49
49
  x: str
50
50
  ans = list()
@@ -1,12 +1,12 @@
1
+ __all__: list[str] = ["Item"]
2
+
1
3
  import abc
2
- from typing import *
4
+ from typing import Any, Self
3
5
 
4
6
  import setdoc
5
7
  from copyable import Copyable
6
8
 
7
- from preparse.core.enums import *
8
-
9
- __all__ = ["Item"]
9
+ from preparse.core.enums import Nargs, Tuning
10
10
 
11
11
 
12
12
  class Item(Copyable):
@@ -21,11 +21,11 @@ class Item(Copyable):
21
21
 
22
22
  @classmethod
23
23
  @abc.abstractmethod
24
- def sortkey(cls: type) -> int: ...
24
+ def sortkey(cls: type[Self]) -> int: ...
25
25
 
26
- def todict(self: Self) -> dict:
26
+ def todict(self: Self) -> dict[str, Any]:
27
27
  "This method returns a dict representing the current instance."
28
- ans: dict
28
+ ans: dict[str, Any]
29
29
  try:
30
30
  ans = self._data
31
31
  except AttributeError:
@@ -1,23 +1,23 @@
1
+ __all__: list[str] = ["Long"]
2
+
1
3
  import operator
2
- from typing import *
4
+ from typing import Any, Self, SupportsIndex
3
5
 
4
6
  import setdoc
5
7
 
6
8
  from preparse._items.Option import Option
7
9
  from preparse._utils.dataprop import dataprop
8
- from preparse.core.enums import *
9
-
10
- __all__ = ["Long"]
10
+ from preparse.core.enums import Nargs, Tuning
11
11
 
12
12
 
13
13
  class Long(Option):
14
14
 
15
15
  abbr: str
16
- abbrlen: Optional[int]
16
+ abbrlen: int | None
17
17
  fullkey: str
18
18
  joined: bool
19
19
  nargs: Nargs
20
- right: Optional[str]
20
+ right: str | None
21
21
 
22
22
  __slots__ = ()
23
23
 
@@ -25,10 +25,10 @@ class Long(Option):
25
25
  def __init__(
26
26
  self: Self,
27
27
  *,
28
+ abbrlen: int | None = None,
28
29
  fullkey: str,
29
- abbrlen: Optional[int] = None,
30
30
  joined: bool | str = False,
31
- right: Optional[str] = None,
31
+ right: str | None = None,
32
32
  ) -> None:
33
33
  self.fullkey = fullkey
34
34
  self.abbrlen = abbrlen
@@ -40,7 +40,7 @@ class Long(Option):
40
40
  return self.fullkey[: self.abbrlen]
41
41
 
42
42
  @dataprop
43
- def abbrlen(self: Self, x: Optional[SupportsIndex]) -> Optional[int]:
43
+ def abbrlen(self: Self, x: SupportsIndex | None) -> int | None:
44
44
  if x is not None:
45
45
  return operator.index(x)
46
46
 
@@ -1,18 +1,18 @@
1
+ __all__: list[str] = ["Option"]
2
+
1
3
  import operator
2
- from typing import *
4
+ from typing import Any, Self, SupportsIndex
3
5
 
4
6
  from preparse._items.Item import Item
5
7
  from preparse._utils.dataprop import dataprop
6
- from preparse.core.enums import *
7
-
8
- __all__ = ["Option"]
8
+ from preparse.core.enums import Nargs, Tuning
9
9
 
10
10
 
11
11
  class Option(Item):
12
12
 
13
13
  joined: bool
14
14
  nargs: Nargs
15
- right: Optional[str]
15
+ right: str | None
16
16
 
17
17
  __slots__ = ()
18
18
 
@@ -28,10 +28,10 @@ class Option(Item):
28
28
  return Nargs(x)
29
29
 
30
30
  @dataprop
31
- def right(self: Self, x: Any) -> Optional[str]:
31
+ def right(self: Self, x: Any) -> str | None:
32
32
  if x is not None:
33
33
  return str(x)
34
34
 
35
35
  @classmethod
36
- def sortkey(cls: type) -> int:
36
+ def sortkey(cls: type[Self]) -> int:
37
37
  return 0
@@ -1,12 +1,12 @@
1
- from typing import *
1
+ __all__: list[str] = ["Positional"]
2
+
3
+ from typing import Any, Self
2
4
 
3
5
  import setdoc
4
6
 
5
7
  from preparse._items.Item import Item
6
8
  from preparse._utils.dataprop import dataprop
7
- from preparse.core.enums import *
8
-
9
- __all__ = ["Positional"]
9
+ from preparse.core.enums import Nargs, Tuning
10
10
 
11
11
 
12
12
  class Positional(Item):
@@ -26,7 +26,7 @@ class Positional(Item):
26
26
  return self.value == "-" or not self.value.startswith("-")
27
27
 
28
28
  @classmethod
29
- def sortkey(cls: type) -> int:
29
+ def sortkey(cls: type[Self]) -> int:
30
30
  return 2
31
31
 
32
32
  @dataprop
@@ -1,9 +1,9 @@
1
- from typing import *
1
+ __all__: list[str] = ["Special"]
2
2
 
3
- from preparse._items.Item import Item
4
- from preparse.core.enums import *
3
+ from typing import Self
5
4
 
6
- __all__ = ["Special"]
5
+ from preparse._items.Item import Item
6
+ from preparse.core.enums import Nargs, Tuning
7
7
 
8
8
 
9
9
  class Special(Item):
@@ -14,5 +14,5 @@ class Special(Item):
14
14
  return ["--"]
15
15
 
16
16
  @classmethod
17
- def sortkey(cls: type) -> int:
17
+ def sortkey(cls: type[Self]) -> int:
18
18
  return 1
@@ -1,3 +1,12 @@
1
+ __all__: list[str] = [
2
+ "Bundle",
3
+ "Item",
4
+ "Long",
5
+ "Option",
6
+ "Positional",
7
+ "Special",
8
+ ]
9
+
1
10
  from preparse._items.Bundle import Bundle
2
11
  from preparse._items.Item import Item
3
12
  from preparse._items.Long import Long
@@ -1,19 +1,20 @@
1
- from types import FunctionType
2
- from typing import *
1
+ __all__: list[str] = ["process"]
3
2
 
4
- from preparse._items import *
5
- from preparse._processing.deparsing import *
6
- from preparse._processing.digesting import *
7
- from preparse._processing.parsing import *
8
- from preparse._processing.pulling import *
9
- from preparse._utils import *
10
- from preparse.core.enums import *
3
+ from collections.abc import Iterable
4
+ from types import FunctionType
5
+ from typing import Any
11
6
 
12
- __all__ = ["process"]
7
+ from preparse._items import Bundle, Item, Long, Option, Positional, Special
8
+ from preparse._processing.deparsing import deparse
9
+ from preparse._processing.digesting import digest
10
+ from preparse._processing.parsing import parse
11
+ from preparse._processing.pulling import pull
12
+ from preparse._utils import dataprop
13
+ from preparse.core.enums import Nargs, Tuning
13
14
 
14
15
 
15
16
  def process(
16
- args: Optional[Iterable] = None,
17
+ args: Iterable[Any] | None = None,
17
18
  *,
18
19
  allowslong: bool,
19
20
  allowsshort: bool,
@@ -21,7 +22,7 @@ def process(
21
22
  expandsabbr: bool,
22
23
  expectsabbr: bool,
23
24
  expectsposix: bool,
24
- optdict: dict,
25
+ optdict: dict[str, Nargs],
25
26
  prog: str,
26
27
  reconcilesorders: bool,
27
28
  special: Tuning,
@@ -1,9 +1,7 @@
1
- from typing import *
1
+ __all__: list[str] = ["deparse"]
2
2
 
3
3
  from preparse._items.Item import Item
4
4
 
5
- __all__ = ["deparse"]
6
-
7
5
 
8
6
  def deparse(items: list[Item]) -> list[str]:
9
7
  ans: list[str]
@@ -1,4 +1,6 @@
1
- from typing import *
1
+ __all__: list[str] = ["digest"]
2
+
3
+ from typing import Any
2
4
 
3
5
  from preparse._items.Bundle import Bundle
4
6
  from preparse._items.Item import Item
@@ -6,10 +8,14 @@ from preparse._items.Long import Long
6
8
  from preparse._items.Option import Option
7
9
  from preparse._items.Positional import Positional
8
10
  from preparse._items.Special import Special
9
- from preparse.core.enums import *
10
- from preparse.core.warnings import *
11
-
12
- __all__ = ["digest"]
11
+ from preparse.core.enums import Nargs, Tuning
12
+ from preparse.core.warnings import (
13
+ PreparseAmbiguousOptionWarning,
14
+ PreparseInvalidOptionWarning,
15
+ PreparseRequiredArgumentWarning,
16
+ PreparseUnallowedArgumentWarning,
17
+ PreparseWarning,
18
+ )
13
19
 
14
20
 
15
21
  def digest(