preparse 2.0.0.dev0__tar.gz → 2.0.0.dev2__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 (49) hide show
  1. {preparse-2.0.0.dev0/src/preparse.egg-info → preparse-2.0.0.dev2}/PKG-INFO +1 -1
  2. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/docs/v1.0.rst +6 -6
  3. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/pyproject.toml +1 -1
  4. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_items/Bundle.py +1 -1
  5. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_items/Item.py +1 -1
  6. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_items/Long.py +1 -1
  7. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_items/Option.py +1 -1
  8. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_items/Positional.py +1 -1
  9. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_items/Special.py +1 -1
  10. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_processing/__init__.py +3 -3
  11. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_processing/digesting.py +1 -1
  12. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_processing/parsing.py +13 -13
  13. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/core/Optdict.py +3 -3
  14. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/core/PreParser.py +18 -18
  15. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/core/__init__.py +2 -2
  16. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/data.toml +35328 -35328
  17. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/test_enums.py +1 -1
  18. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/test_optdict.py +6 -6
  19. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/test_preparser.py +3 -3
  20. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2/src/preparse.egg-info}/PKG-INFO +1 -1
  21. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse.egg-info/SOURCES.txt +1 -1
  22. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/LICENSE.txt +0 -0
  23. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/MANIFEST.in +0 -0
  24. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/README.rst +0 -0
  25. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/setup.cfg +0 -0
  26. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/__init__.py +0 -0
  27. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_items/__init__.py +0 -0
  28. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_processing/deparsing.py +0 -0
  29. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_processing/pulling.py +0 -0
  30. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_utils/__init__.py +0 -0
  31. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/_utils/dataprop.py +0 -0
  32. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/core/Click.py +0 -0
  33. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/core/PreparseWarning.py +0 -0
  34. /preparse-2.0.0.dev0/src/preparse/core/enums.py → /preparse-2.0.0.dev2/src/preparse/enums/__init__.py +0 -0
  35. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/__init__.py +0 -0
  36. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/expit.toml +0 -0
  37. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/test_data_toml.py +0 -0
  38. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/tests/test_expit_toml.py +0 -0
  39. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/AmbiguousOptionWarner.py +0 -0
  40. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/DualWarner.py +0 -0
  41. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/InvalidOptionWarner.py +0 -0
  42. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/LongonlyWarner.py +0 -0
  43. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/RequiredArgumentWarner.py +0 -0
  44. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/UnallowedArgumentWarner.py +0 -0
  45. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/WarnerABC.py +0 -0
  46. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse/warners/__init__.py +0 -0
  47. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse.egg-info/dependency_links.txt +0 -0
  48. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/src/preparse.egg-info/requires.txt +0 -0
  49. {preparse-2.0.0.dev0 → preparse-2.0.0.dev2}/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: 2.0.0.dev0
3
+ Version: 2.0.0.dev2
4
4
  Summary: This project preparses args for further parsing later on.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -64,7 +64,7 @@ Features
64
64
  The PreParser class
65
65
  ~~~~~~~~~~~~~~~~~~~
66
66
 
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)``
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
68
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69
69
 
70
70
  This class is the centerpiece of the preparse. Its behaviour follows the principles of getopt from C.
@@ -109,7 +109,7 @@ This boolean property determines whether abbreviations of long options are expec
109
109
 
110
110
  This boolean property determines whether the order of arguments to conform to the POSIX standard, i.e. all arguments after the first positional argument also being positonal.
111
111
 
112
- ``optdict: preparse.Optdict``
112
+ ``optDict: preparse.OptDict``
113
113
  """""""""""""""""""""""""""""
114
114
 
115
115
  This property holds a dict-like object.
@@ -143,7 +143,7 @@ POSIX and the interleaving of options with positonal arguments, should be enforc
143
143
  """""""""""""""""""""""""""""""""""""""""""""""""""
144
144
 
145
145
  This method alters the current instance to reflect a ``click.Command`` object.
146
- Concretely the optdict property is changed.
146
+ Concretely the optDict property is changed.
147
147
 
148
148
  ``reflectClickContext(ctx: click.Context) -> None``
149
149
  """""""""""""""""""""""""""""""""""""""""""""""""""
@@ -202,15 +202,15 @@ This property determines if the ``reflectClickContext`` method of parser is to b
202
202
 
203
203
  This property holds the parser to be embedded.
204
204
 
205
- The Optdict class
205
+ The OptDict class
206
206
  ~~~~~~~~~~~~~~~~~
207
207
 
208
- ``class preparse.Optdict``
208
+ ``class preparse.OptDict``
209
209
  ^^^^^^^^^^^^^^^^^^^^^^^^^^
210
210
 
211
211
  This class is a subclass of ``datahold.HoldDict[str, preparse.Nargs]``
212
212
  with strings as keys and with ``preparse.Nargs`` as values.
213
- It is designed for ``preparse.PreParser.optdict``.
213
+ It is designed for ``preparse.PreParser.optDict``.
214
214
 
215
215
  The Enums
216
216
  ~~~~~~~~~
@@ -34,7 +34,7 @@ keywords = []
34
34
  name = "preparse"
35
35
  readme = "README.rst"
36
36
  requires-python = ">=3.11"
37
- version = "2.0.0.dev0"
37
+ version = "2.0.0.dev2"
38
38
 
39
39
  [project.license]
40
40
  file = "LICENSE.txt"
@@ -5,7 +5,7 @@ import setdoc
5
5
  from preparse._items.Item import Item
6
6
  from preparse._items.Option import Option
7
7
  from preparse._utils.dataprop import dataprop
8
- from preparse.core.enums import *
8
+ from preparse.enums import *
9
9
 
10
10
  __all__ = ["Bundle"]
11
11
 
@@ -4,7 +4,7 @@ from typing import *
4
4
  import setdoc
5
5
  from copyable import Copyable
6
6
 
7
- from preparse.core.enums import *
7
+ from preparse.enums import *
8
8
 
9
9
  __all__ = ["Item"]
10
10
 
@@ -5,7 +5,7 @@ import setdoc
5
5
 
6
6
  from preparse._items.Option import Option
7
7
  from preparse._utils.dataprop import dataprop
8
- from preparse.core.enums import *
8
+ from preparse.enums import *
9
9
 
10
10
  __all__ = ["Long"]
11
11
 
@@ -3,7 +3,7 @@ from typing import *
3
3
 
4
4
  from preparse._items.Item import Item
5
5
  from preparse._utils.dataprop import dataprop
6
- from preparse.core.enums import *
6
+ from preparse.enums import *
7
7
 
8
8
  __all__ = ["Option"]
9
9
 
@@ -4,7 +4,7 @@ import setdoc
4
4
 
5
5
  from preparse._items.Item import Item
6
6
  from preparse._utils.dataprop import dataprop
7
- from preparse.core.enums import *
7
+ from preparse.enums import *
8
8
 
9
9
  __all__ = ["Positional"]
10
10
 
@@ -1,7 +1,7 @@
1
1
  from typing import *
2
2
 
3
3
  from preparse._items.Item import Item
4
- from preparse.core.enums import *
4
+ from preparse.enums import *
5
5
 
6
6
  __all__ = ["Special"]
7
7
 
@@ -7,7 +7,7 @@ from preparse._processing.digesting import *
7
7
  from preparse._processing.parsing import *
8
8
  from preparse._processing.pulling import *
9
9
  from preparse._utils import *
10
- from preparse.core.enums import *
10
+ from preparse.enums import *
11
11
 
12
12
  __all__ = ["process"]
13
13
 
@@ -21,7 +21,7 @@ def process(
21
21
  expandsabbr: bool,
22
22
  expectsabbr: bool,
23
23
  expectsposix: bool,
24
- optdict: dict,
24
+ optDict: dict,
25
25
  prog: str,
26
26
  reconcilesorders: bool,
27
27
  special: Tuning,
@@ -36,7 +36,7 @@ def process(
36
36
  allowsshort=allowsshort,
37
37
  expectsabbr=expectsabbr,
38
38
  expectsposix=expectsposix,
39
- optdict=optdict,
39
+ optDict=optDict,
40
40
  prog=prog,
41
41
  warn=warn,
42
42
  )
@@ -6,7 +6,7 @@ from preparse._items.Long import Long
6
6
  from preparse._items.Option import Option
7
7
  from preparse._items.Positional import Positional
8
8
  from preparse._items.Special import Special
9
- from preparse.core.enums import *
9
+ from preparse.enums import *
10
10
 
11
11
  __all__ = ["digest"]
12
12
 
@@ -7,7 +7,7 @@ from preparse._items.Long import Long
7
7
  from preparse._items.Option import Option
8
8
  from preparse._items.Positional import Positional
9
9
  from preparse._items.Special import Special
10
- from preparse.core.enums import *
10
+ from preparse.enums import *
11
11
  from preparse.warners.AmbiguousOptionWarner import AmbiguousOptionWarner as PAOW
12
12
  from preparse.warners.InvalidOptionWarner import InvalidOptionWarner as PIOW
13
13
  from preparse.warners.RequiredArgumentWarner import RequiredArgumentWarner as PRAW
@@ -24,7 +24,7 @@ def parse_bundling(
24
24
  arg: str,
25
25
  *,
26
26
  cause: FunctionType,
27
- optdict: dict,
27
+ optDict: dict,
28
28
  ) -> Bundle:
29
29
  ans: Bundle
30
30
  x: int
@@ -35,7 +35,7 @@ def parse_bundling(
35
35
  continue
36
36
  ans.chars += y
37
37
  try:
38
- ans.nargs = optdict["-" + y]
38
+ ans.nargs = optDict["-" + y]
39
39
  except KeyError:
40
40
  cause(PIOW, option=y, islong=False)
41
41
  ans.nargs = Nargs.NO_ARGUMENT
@@ -66,7 +66,7 @@ def parse_generator(
66
66
  allowsshort: bool,
67
67
  expectsabbr: bool,
68
68
  expectsposix: bool,
69
- optdict: dict,
69
+ optDict: dict,
70
70
  prog: str,
71
71
  warn: FunctionType,
72
72
  ) -> Generator[Any, Any, Any]:
@@ -104,7 +104,7 @@ def parse_generator(
104
104
  allowsshort=allowsshort,
105
105
  cause=cause,
106
106
  expectsabbr=expectsabbr,
107
- optdict=optdict,
107
+ optDict=optDict,
108
108
  )
109
109
  if not last.ishungry():
110
110
  yield last
@@ -136,7 +136,7 @@ def parse_long(
136
136
  *,
137
137
  cause: FunctionType,
138
138
  expectsabbr: bool,
139
- optdict: dict,
139
+ optDict: dict,
140
140
  ) -> Long:
141
141
  ans: Long
142
142
  parts: list[str]
@@ -146,13 +146,13 @@ def parse_long(
146
146
  ans.joined = True
147
147
  ans.right = parts.pop()
148
148
  ans.abbrlen = len(ans.fullkey)
149
- if ans.fullkey in optdict.keys():
150
- ans.nargs = optdict[ans.fullkey]
149
+ if ans.fullkey in optDict.keys():
150
+ ans.nargs = optDict[ans.fullkey]
151
151
  if (ans.nargs == Nargs.NO_ARGUMENT) and (ans.right is not None):
152
152
  cause(PUAW, option=ans.fullkey)
153
153
  return ans
154
154
  if expectsabbr:
155
- parts = parse_long_startswith(ans.abbr, keys=optdict.keys())
155
+ parts = parse_long_startswith(ans.abbr, keys=optDict.keys())
156
156
  else:
157
157
  parts = list() # can be assumed
158
158
  if len(parts) == 0:
@@ -164,7 +164,7 @@ def parse_long(
164
164
  cause(PAOW, option=arg, possibilities=parts)
165
165
  return ans
166
166
  (ans.fullkey,) = parts
167
- ans.nargs = optdict[ans.fullkey]
167
+ ans.nargs = optDict[ans.fullkey]
168
168
  return ans
169
169
 
170
170
 
@@ -187,7 +187,7 @@ def parse_option(
187
187
  *,
188
188
  cause: FunctionType,
189
189
  expectsabbr: bool,
190
- optdict: dict,
190
+ optDict: dict,
191
191
  **kwargs: Any,
192
192
  ) -> Option:
193
193
  if parse_islong(arg, **kwargs):
@@ -195,11 +195,11 @@ def parse_option(
195
195
  arg,
196
196
  cause=cause,
197
197
  expectsabbr=expectsabbr,
198
- optdict=optdict,
198
+ optDict=optDict,
199
199
  )
200
200
  else:
201
201
  return parse_bundling(
202
202
  arg,
203
203
  cause=cause,
204
- optdict=optdict,
204
+ optDict=optDict,
205
205
  )
@@ -6,12 +6,12 @@ import setdoc
6
6
  from datarepr import datarepr
7
7
  from frozendict import frozendict
8
8
 
9
- from preparse.core.enums import *
9
+ from preparse.enums import *
10
10
 
11
- __all__ = ["Optdict"]
11
+ __all__ = ["OptDict"]
12
12
 
13
13
 
14
- class Optdict(cmp3.CmpABC, datahold.HoldDict[str, Nargs]):
14
+ class OptDict(cmp3.CmpABC, datahold.HoldDict[str, Nargs]):
15
15
  __slots__ = ()
16
16
 
17
17
  data: frozendict[str, Nargs]
@@ -14,8 +14,8 @@ from tofunc import tofunc
14
14
  from preparse._processing import *
15
15
  from preparse._utils.dataprop import dataprop
16
16
  from preparse.core.Click import Click
17
- from preparse.core.enums import *
18
- from preparse.core.Optdict import *
17
+ from preparse.core.OptDict import OptDict
18
+ from preparse.enums import *
19
19
  from preparse.warners import *
20
20
 
21
21
  __all__ = ["PreParser"]
@@ -29,7 +29,7 @@ class PreParser(Copyable):
29
29
  expandsabbr: bool
30
30
  expectsabbr: bool
31
31
  expectsposix: bool
32
- optdict: Optdict
32
+ optDict: OptDict
33
33
  prog: str
34
34
  reconcilesorders: bool
35
35
  special: Tuning
@@ -47,7 +47,7 @@ class PreParser(Copyable):
47
47
  expandsabbr: Any = True,
48
48
  expectsabbr: Any = True,
49
49
  expectsposix: Any = False,
50
- optdict: Any = (),
50
+ optDict: Any = (),
51
51
  prog: Any = None,
52
52
  reconcilesorders: Any = True,
53
53
  special: Any = Tuning.MAINTAIN,
@@ -59,7 +59,7 @@ class PreParser(Copyable):
59
59
  self.expandsabbr = expandsabbr
60
60
  self.expectsabbr = expectsabbr
61
61
  self.expectsposix = expectsposix
62
- self.optdict = optdict
62
+ self.optDict = optDict
63
63
  self.prog = prog
64
64
  self.reconcilesorders = reconcilesorders
65
65
  self.special = special
@@ -106,15 +106,15 @@ class PreParser(Copyable):
106
106
  return bool(value)
107
107
 
108
108
  @dataprop
109
- def optdict(self: Self, value: Any) -> Optdict:
109
+ def optDict(self: Self, value: Any) -> OptDict:
110
110
  "This property gives a dictionary of options."
111
- dataA: Optdict
112
- if "optdict" not in self._data.keys():
113
- self._data["optdict"] = Optdict()
114
- dataA = Optdict(value)
115
- self._data["optdict"].clear()
116
- self._data["optdict"].update(dataA)
117
- return self._data["optdict"]
111
+ dataA: OptDict
112
+ if "optDict" not in self._data.keys():
113
+ self._data["optDict"] = OptDict()
114
+ dataA = OptDict(value)
115
+ self._data["optDict"].clear()
116
+ self._data["optDict"].update(dataA)
117
+ return self._data["optDict"]
118
118
 
119
119
  def parse_args(
120
120
  self: Self,
@@ -137,11 +137,11 @@ class PreParser(Copyable):
137
137
 
138
138
  def reflectClickCommand(self: Self, cmd: cl.Command) -> None:
139
139
  "This method causes the current instance to reflect a click.Command object."
140
- optdict: dict[str, Nargs]
140
+ optDict: dict[str, Nargs]
141
141
  nargs: Nargs
142
142
  opt: Any
143
143
  param: Any
144
- optdict = dict()
144
+ optDict = dict()
145
145
  for param in cmd.params:
146
146
  if not isinstance(param, cl.Option):
147
147
  continue
@@ -152,9 +152,9 @@ class PreParser(Copyable):
152
152
  else:
153
153
  nargs = Nargs.OPTIONAL_ARGUMENT
154
154
  for opt in param.opts:
155
- optdict[str(opt)] = nargs
156
- self.optdict.clear()
157
- self.optdict.update(optdict)
155
+ optDict[str(opt)] = nargs
156
+ self.optDict.clear()
157
+ self.optDict.update(optDict)
158
158
 
159
159
  def reflectClickContext(self: Self, ctx: cl.Context) -> None:
160
160
  "This method causes the current instance to reflect a click.Context object."
@@ -1,4 +1,4 @@
1
1
  from preparse.core.Click import *
2
- from preparse.core.enums import *
3
- from preparse.core.Optdict import *
2
+ from preparse.core.OptDict import *
4
3
  from preparse.core.PreParser import *
4
+ from preparse.enums import *