preparse 1.1.8__tar.gz → 1.1.9__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 (56) hide show
  1. {preparse-1.1.8 → preparse-1.1.9}/PKG-INFO +1 -1
  2. {preparse-1.1.8 → preparse-1.1.9}/docs/v1.1.rst +61 -41
  3. {preparse-1.1.8 → preparse-1.1.9}/pyproject.toml +1 -1
  4. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_items/Bundle.py +2 -2
  5. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_items/Long.py +1 -1
  6. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_processing/digesting.py +2 -2
  7. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/core/PreParser.py +5 -2
  8. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/PreparseAmbiguousOptionWarning.py +3 -3
  9. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/PreparseDualWarning.py +6 -2
  10. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/PreparseUnallowedArgumentWarning.py +1 -1
  11. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/PreparseWarning.py +2 -2
  12. {preparse-1.1.8 → preparse-1.1.9}/src/preparse.egg-info/PKG-INFO +1 -1
  13. {preparse-1.1.8 → preparse-1.1.9}/src/preparse.egg-info/SOURCES.txt +0 -1
  14. preparse-1.1.8/src/preparse/typing/Parser.py +0 -5
  15. {preparse-1.1.8 → preparse-1.1.9}/LICENSE.txt +0 -0
  16. {preparse-1.1.8 → preparse-1.1.9}/MANIFEST.in +0 -0
  17. {preparse-1.1.8 → preparse-1.1.9}/README.rst +0 -0
  18. {preparse-1.1.8 → preparse-1.1.9}/docs/v1.0.rst +0 -0
  19. {preparse-1.1.8 → preparse-1.1.9}/setup.cfg +0 -0
  20. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/__init__.py +0 -0
  21. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_items/Item.py +0 -0
  22. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_items/Option.py +0 -0
  23. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_items/Positional.py +0 -0
  24. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_items/Special.py +0 -0
  25. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_items/__init__.py +0 -0
  26. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_processing/__init__.py +0 -0
  27. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_processing/deparsing.py +0 -0
  28. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_processing/parsing.py +0 -0
  29. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_processing/pulling.py +0 -0
  30. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_tests/__init__.py +0 -0
  31. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/_tests/expit.py +0 -0
  32. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/core/Click.py +0 -0
  33. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/core/Optdict.py +0 -0
  34. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/core/__init__.py +0 -0
  35. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/enums/BaseEnum.py +0 -0
  36. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/enums/Nargs.py +0 -0
  37. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/enums/Tuning.py +0 -0
  38. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/enums/__init__.py +0 -0
  39. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/py.typed +0 -0
  40. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/__init__.py +0 -0
  41. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/data.toml +0 -0
  42. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/expit.toml +0 -0
  43. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/test_data_toml.py +0 -0
  44. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/test_enums.py +0 -0
  45. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/test_expit_toml.py +0 -0
  46. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/test_optdict.py +0 -0
  47. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/tests/test_preparser.py +0 -0
  48. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/typing/SupportsKeysAndGetitem.py +0 -0
  49. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/typing/__init__.py +0 -0
  50. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/PreparseInvalidOptionWarning.py +0 -0
  51. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/PreparseLongonlyWarning.py +0 -0
  52. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/PreparseRequiredArgumentWarning.py +0 -0
  53. {preparse-1.1.8 → preparse-1.1.9}/src/preparse/warnings/__init__.py +0 -0
  54. {preparse-1.1.8 → preparse-1.1.9}/src/preparse.egg-info/dependency_links.txt +0 -0
  55. {preparse-1.1.8 → preparse-1.1.9}/src/preparse.egg-info/requires.txt +0 -0
  56. {preparse-1.1.8 → preparse-1.1.9}/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.8
3
+ Version: 1.1.9
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
@@ -76,8 +76,8 @@ Features
76
76
 
77
77
  This dataclass provides decorators for embedding a ``PreParser`` object.
78
78
 
79
- ``__call__(target: types.FunctionType) -> types.FunctionType`` ``__call__(target: types.MethodType) -> types.MethodType`` ``__call__(target: types.TargetParser) -> types.TargetParser``
80
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
79
+ ``__call__(target: types.FunctionType) -> types.FunctionType`` ``__call__(target: types.MethodType) -> types.MethodType`` ``__call__(target: typing.Any) -> typing.Any``
80
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
81
81
 
82
82
  This magic method implements ``self(target)``.
83
83
  It works as a decorator that embeds its parser into a given target from the library ``click``.
@@ -90,25 +90,27 @@ This ``property`` determines if the ``reflectClickCommand`` method of parser is
90
90
  ``copy() -> Self``
91
91
  """"""""""""""""""
92
92
 
93
+ This method returns a shallow copy of the current decorator.
94
+
93
95
  ``ctx: object``
94
96
  """""""""""""""
95
97
 
96
98
  This ``property`` determines if the ``reflectClickContext`` method of parser is to be called.
97
99
 
98
- ``parser: preparse.PreParser``
99
- """"""""""""""""""""""""""""""
100
+ ``parser: preparse.core.PreParser.PreParser``
101
+ """""""""""""""""""""""""""""""""""""""""""""
100
102
 
101
103
  This ``property`` holds the parser to be embedded.
102
104
 
103
- ``class preparse.core.Optdict.Optdict``
104
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105
+ ``class preparse.core.Optdict.Optdict(data: preparse.typing.SupportsKeysAndGetitem.SupportsKeysAndGetitem | Iterable[tuple[Hashable, object]] = (), /)``
106
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105
107
 
106
108
  This class is a subclass of ``datahold.HoldDict[str, preparse.Nargs]``
107
109
  with strings as keys and with ``preparse.Nargs`` as values.
108
110
  It is designed for ``preparse.PreParser.optdict``.
109
111
 
110
- ``class preparse.core.PreParser.PreParser(*, allowslong: object = True, allowsshort: object = True, bundling: int = Tuning.MAINTAIN, expandsabbr: object = True, expectsabbr: object = True, expectsposix: object = False, optdict: Any = (), prog: object = None, reconcilesorders: object = True, special: int = preparse.Tuning.MAINTAIN, warn: Callable[[PreparseWarning], Any] = str)``
111
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112
+ ``class preparse.core.PreParser.PreParser(*, allowslong: object = True, allowsshort: object = True, bundling: int = Tuning.MAINTAIN, expandsabbr: object = True, expectsabbr: object = True, expectsposix: object = False, optdict: preparse.typing.SupportsKeysAndGetitem.SupportsKeysAndGetitem | Iterable[tuple[Hashable, object]] = (), prog: object = None, reconcilesorders: object = True, special: int = preparse.Tuning.MAINTAIN, warn: Callable[[PreparseWarning], Any] = str)``
113
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112
114
 
113
115
  This ``class`` is the centerpiece of the ``preparse``.
114
116
  Its behaviour follows the principles of ``getopt`` from ``C``.
@@ -126,7 +128,7 @@ This boolean ``property`` determines whether short options are allowed.
126
128
  ``bundling: preparse.Tuning``
127
129
  """""""""""""""""""""""""""""
128
130
 
129
- This ``property`` determines the approach to bundling of short option.
131
+ This ``property`` determines the approach to bundling of short options.
130
132
 
131
133
  ``click(cmd: object = True, ctx: object = True) -> preparse.Click``
132
134
  """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -152,8 +154,10 @@ This boolean ``property`` determines whether abbreviations of long options are e
152
154
  ``expectsposix: bool``
153
155
  """"""""""""""""""""""
154
156
 
155
- This boolean ``property`` determines whether the order of arguments to conform to the POSIX standard,
156
- i.e. all arguments after the first positional argument also being positonal.
157
+ This boolean ``property`` determines whether the order of arguments conforms to the POSIX standard,
158
+ i.e. all arguments after the first positional argument are also positional.
159
+ If the value passed to the property is ``"infer"``, the value is inferred from
160
+ the ``POSIXLY_CORRECT`` environment variable.
157
161
 
158
162
  ``optdict: preparse.Optdict``
159
163
  """""""""""""""""""""""""""""
@@ -165,8 +169,8 @@ Options not found within the dictionary
165
169
  cause a ``preparse.PreparseInvalidOptionWarning``
166
170
  and are then assumed to have no arguments.
167
171
 
168
- ``parse_args(args: Optional[Iterable] = None) -> list[str]``
169
- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
172
+ ``parse_args(args: Optional[Iterable[object]] = None) -> list[str]``
173
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
170
174
 
171
175
  This method is at the core of the class.
172
176
  It returns a preparsed list of arguments.
@@ -178,19 +182,21 @@ there will be no changes after the first run.
178
182
  """""""""""""
179
183
 
180
184
  This ``str`` property represents the name of the program.
181
- If the value passed to the property is ``None`` then ``str(sys.argv[0])`` is saved.
185
+ If the value passed to the property is ``None`` then ``str(os.path.basename(sys.argv[0]))`` is saved.
182
186
 
183
187
  ``reconcilesorders: bool``
184
188
  """"""""""""""""""""""""""
185
189
 
186
- This boolean ``property`` determines whether compatibility with both orders,
187
- POSIX and the interleaving of options with positonal arguments, should be enforced.
190
+ This boolean ``property`` determines whether compatibility with both POSIX ordering
191
+ and interleaving options with positional arguments should be enforced.
188
192
 
189
193
  ``reflectClickCommand(cmd: click.Command) -> None``
190
194
  """""""""""""""""""""""""""""""""""""""""""""""""""
191
195
 
192
196
  This method alters the current instance to reflect a ``click.Command`` object.
193
197
  Concretely the ``optdict`` property is changed.
198
+ Only entries in each Click option's ``opts`` are reflected; secondary option names
199
+ are not added.
194
200
 
195
201
  ``reflectClickContext(ctx: click.Context) -> None``
196
202
  """""""""""""""""""""""""""""""""""""""""""""""""""
@@ -206,13 +212,13 @@ This ``property`` determines the approach to the special argument ``'--'``.
206
212
  ``todict() -> dict[str, Any]``
207
213
  """"""""""""""""""""""""""""""
208
214
 
209
- This method a ``dict`` representing the current instance.
215
+ This method returns a ``dict`` representing the current instance.
210
216
 
211
217
  ``warn: Callable[[PreparseWarning], Any]``
212
218
  """"""""""""""""""""""""""""""""""""""""""
213
219
 
214
220
  This property holds a function that is called whenever ``parse_args`` encounters a warning.
215
- The warning is given as the only positional arguments.
221
+ The warning is given as the only positional argument.
216
222
  No keyword arguments are given.
217
223
  Its return value is discarded.
218
224
  Therefore, ``str`` is used to discard the warnings.
@@ -249,49 +255,63 @@ Any value different from ``0`` (meaning no) and ``1`` (meaning yes) is interpret
249
255
  | OPTIONAL_ARGUMENT | ``2`` | The option may take an argument. |
250
256
  +-------------------+-------+----------------------------------------------+
251
257
 
258
+ ``preparse.tests``
259
+ ~~~~~~~~~~~~~~~~~~
260
+
261
+ ``preparse.tests.test() -> unittest.TextTestResult``
262
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
263
+
264
+ This project can be tested through its ``test`` function.
265
+
266
+ .. code-block:: python
267
+
268
+ import preparse.tests
269
+ preparse.tests.test()
270
+
271
+ ``preparse.typing``
272
+ ~~~~~~~~~~~~~~~~~~~
273
+
274
+ ``class preparse.typing.SupportsKeysAndGetitem.SupportsKeysAndGetitem``
275
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
276
+
277
+ This protocol is included in the project for type annotation.
278
+
279
+ ``__getitem__(key: Hashable, /) -> object``
280
+ """""""""""""""""""""""""""""""""""""""""""
281
+
282
+ ``keys() -> tuple[Hashable, ...]``
283
+ """"""""""""""""""""""""""""""""""
284
+
252
285
  ``preparse.warnings``
253
286
  ~~~~~~~~~~~~~~~~~~~~~
254
287
 
255
288
  These classes are subclasses of ``Warning`` that are specifically designed to communicate issues with parsing.
256
289
 
257
- ``class preparse.warnings.PreparseWarning.PreparseWarning``
258
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
290
+ ``class preparse.warnings.PreparseWarning.PreparseWarning(**kwargs: Any)``
291
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
259
292
 
260
293
  This abstract base ``class`` is the base for all other warning types.
261
294
 
262
- ``class preparse.warnings.PreparseAmbiguousOptionWarning.PreparseAmbiguousOptionWarning(prog: Any, option: Any, possibilities: Any)``
263
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
295
+ ``class preparse.warnings.PreparseAmbiguousOptionWarning.PreparseAmbiguousOptionWarning(*, prog: Any, option: Any, possibilities: Any)``
296
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
264
297
 
265
298
  This ``class`` warns about ambiguous options. This can only happen for long options.
266
299
 
267
- ``class preparse.warnings.PreparseInvalidOptionWarning.PreparseInvalidOptionWarning(prog: Any, option: Any, islong: Any)``
268
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
300
+ ``class preparse.warnings.PreparseInvalidOptionWarning.PreparseInvalidOptionWarning(*, prog: object, option: object, islong: object)``
301
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
269
302
 
270
303
  This ``class`` warns about invalid options.
271
304
 
272
- ``class preparse.warnings.PreparseRequiredArgumentWarning.PreparseRequiredArgumentWarning(prog: Any, option: Any, islong: Any)``
273
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
305
+ ``class preparse.warnings.PreparseRequiredArgumentWarning.PreparseRequiredArgumentWarning(*, prog: object, option: object, islong: object)``
306
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274
307
 
275
308
  This ``class`` warns about missing required arguments.
276
309
 
277
- ``class preparse.warnings.PreparseUnallowedArgumentWarning.PreparseUnallowedArgumentWarning(prog: Any, option: Any)``
278
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
310
+ ``class preparse.warnings.PreparseUnallowedArgumentWarning.PreparseUnallowedArgumentWarning(*, prog: object, option: object)``
311
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
279
312
 
280
313
  This ``class`` warns about unallowed arguments. This can only happen for long options.
281
314
 
282
- ``preparse.tests``
283
- ~~~~~~~~~~~~~~~~~~
284
-
285
- ``preparse.tests.test() -> unittest.TextTestResult``
286
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
287
-
288
- This project can be tested through its ``test`` function.
289
-
290
- .. code-block:: python
291
-
292
- import preparse.tests
293
- preparse.tests.test()
294
-
295
315
  License
296
316
  -------
297
317
 
@@ -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.8"
39
+ version = "1.1.9"
40
40
 
41
41
  [project.urls]
42
42
  Download = "https://pypi.org/project/preparse/#files"
@@ -32,7 +32,7 @@ class Bundle(Option):
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()
@@ -60,7 +60,7 @@ class Long(Option):
60
60
  return self._fullkey
61
61
 
62
62
  @fullkey.setter
63
- def fullkey(self: Self, x: Any) -> None:
63
+ def fullkey(self: Self, x: object) -> None:
64
64
  self._fullkey = str(x)
65
65
 
66
66
  @classmethod
@@ -1,4 +1,4 @@
1
- from typing import Any
1
+ from typing import Any, cast
2
2
 
3
3
  from preparse._items.Bundle import Bundle
4
4
  from preparse._items.Item import Item
@@ -154,7 +154,7 @@ def digest_special(
154
154
  items: list[Item],
155
155
  *,
156
156
  special: Tuning,
157
- **kwargs: Any,
157
+ **kwargs: bool,
158
158
  ) -> list[Item]:
159
159
  if special == Tuning.MINIMIZE:
160
160
  return digest_special_min(items, **kwargs)
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import os
4
4
  import sys
5
- from collections.abc import Callable, Iterable
5
+ from collections.abc import Callable, Hashable, Iterable
6
6
  from typing import Any, Optional, Self, cast
7
7
 
8
8
  import click as cl
@@ -16,6 +16,7 @@ from preparse.core.Click import Click
16
16
  from preparse.core.Optdict import Optdict
17
17
  from preparse.enums.Nargs import Nargs
18
18
  from preparse.enums.Tuning import Tuning
19
+ from preparse.typing.SupportsKeysAndGetitem import SupportsKeysAndGetitem
19
20
  from preparse.warnings.PreparseWarning import PreparseWarning
20
21
 
21
22
  __all__ = ["PreParser"]
@@ -35,7 +36,9 @@ class PreParser(Copyable):
35
36
  expandsabbr: object = True,
36
37
  expectsabbr: object = True,
37
38
  expectsposix: object = False,
38
- optdict: Any = (),
39
+ optdict: (
40
+ SupportsKeysAndGetitem | Iterable[tuple[Hashable, object]]
41
+ ) = (),
39
42
  prog: object = None,
40
43
  reconcilesorders: object = True,
41
44
  special: int = Tuning.MAINTAIN,
@@ -14,8 +14,8 @@ class PreparseAmbiguousOptionWarning(PreparseLongonlyWarning):
14
14
  def __post_init__(
15
15
  self: Self,
16
16
  *,
17
- prog: Any,
18
- option: Any,
17
+ prog: object,
18
+ option: object,
19
19
  possibilities: Iterable[object],
20
20
  ) -> None:
21
21
  self.prog = prog
@@ -36,5 +36,5 @@ class PreparseAmbiguousOptionWarning(PreparseLongonlyWarning):
36
36
  return cast(tuple[str, ...], self._data["possibilities"])
37
37
 
38
38
  @possibilities.setter
39
- def possibilities(self: Self, value: Iterable[object]) -> None:
39
+ def possibilities(self: Self, value: Iterable[object], /) -> None:
40
40
  self._data["possibilities"] = tuple(map(str, value))
@@ -12,7 +12,11 @@ class PreparseDualWarning(PreparseWarning):
12
12
 
13
13
  @setdoc.basic
14
14
  def __post_init__(
15
- self: Self, *, prog: Any, option: Any, islong: Any
15
+ self: Self,
16
+ *,
17
+ prog: object,
18
+ option: object,
19
+ islong: object,
16
20
  ) -> None:
17
21
  self.prog = prog
18
22
  self.option = option
@@ -38,5 +42,5 @@ class PreparseDualWarning(PreparseWarning):
38
42
  return cast(bool, self._data["islong"])
39
43
 
40
44
  @islong.setter
41
- def islong(self: Self, value: Any) -> None:
45
+ def islong(self: Self, value: object, /) -> None:
42
46
  self._data["islong"] = bool(value)
@@ -12,7 +12,7 @@ class PreparseUnallowedArgumentWarning(PreparseLongonlyWarning):
12
12
  # option is always full key without value
13
13
 
14
14
  @setdoc.basic
15
- def __post_init__(self: Self, *, prog: Any, option: Any) -> None:
15
+ def __post_init__(self: Self, *, prog: object, option: object) -> None:
16
16
  self.prog = prog
17
17
  self.option = option
18
18
 
@@ -42,7 +42,7 @@ class PreparseWarning(Warning, Copyable):
42
42
  return cast(str, self._data["option"])
43
43
 
44
44
  @option.setter
45
- def option(self: Self, value: object) -> None:
45
+ def option(self: Self, value: object, /) -> None:
46
46
  self._data["option"] = str(value)
47
47
 
48
48
  @property
@@ -50,7 +50,7 @@ class PreparseWarning(Warning, Copyable):
50
50
  return cast(str, self._data["prog"])
51
51
 
52
52
  @prog.setter
53
- def prog(self: Self, value: object) -> None:
53
+ def prog(self: Self, value: object, /) -> None:
54
54
  self._data["prog"] = str(value)
55
55
 
56
56
  def todict(self: Self) -> dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: preparse
3
- Version: 1.1.8
3
+ Version: 1.1.9
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
@@ -42,7 +42,6 @@ src/preparse/tests/test_enums.py
42
42
  src/preparse/tests/test_expit_toml.py
43
43
  src/preparse/tests/test_optdict.py
44
44
  src/preparse/tests/test_preparser.py
45
- src/preparse/typing/Parser.py
46
45
  src/preparse/typing/SupportsKeysAndGetitem.py
47
46
  src/preparse/typing/__init__.py
48
47
  src/preparse/warnings/PreparseAmbiguousOptionWarning.py
@@ -1,5 +0,0 @@
1
- from typing import Any, Callable, Protocol
2
-
3
-
4
- class Parser(Protocol):
5
- parse_args: Callable[..., Any]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes