preparse 1.0.14.dev0__tar.gz → 1.0.14.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.
- {preparse-1.0.14.dev0/src/preparse.egg-info → preparse-1.0.14.dev2}/PKG-INFO +1 -1
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/pyproject.toml +1 -1
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_processing/parsing.py +27 -14
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/test_data_toml.py +16 -2
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2/src/preparse.egg-info}/PKG-INFO +1 -1
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/LICENSE.txt +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/MANIFEST.in +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/README.rst +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/docs/v1.0.rst +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/setup.cfg +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/__init__.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_items/Bundle.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_items/Item.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_items/Long.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_items/Option.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_items/Positional.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_items/Special.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_items/__init__.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_processing/__init__.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_processing/deparsing.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_processing/digesting.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_processing/pulling.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_utils/__init__.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/_utils/dataprop.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/core/Click.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/core/Optdict.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/core/PreParser.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/core/__init__.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/core/enums.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/core/warnings.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/__init__.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/data.toml +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/expit.toml +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/test_enums.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/test_expit_toml.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/test_optdict.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse/tests/test_preparser.py +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse.egg-info/SOURCES.txt +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse.egg-info/dependency_links.txt +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse.egg-info/requires.txt +0 -0
- {preparse-1.0.14.dev0 → preparse-1.0.14.dev2}/src/preparse.egg-info/top_level.txt +0 -0
|
@@ -18,8 +18,26 @@ PUAW = warnings.PreparseUnallowedArgumentWarning
|
|
|
18
18
|
PRAW = warnings.PreparseRequiredArgumentWarning
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def parse(
|
|
22
|
-
|
|
21
|
+
def parse(
|
|
22
|
+
args: list[str],
|
|
23
|
+
expandsabbr: bool,
|
|
24
|
+
expectsabbr: bool,
|
|
25
|
+
**kwargs: Any,
|
|
26
|
+
) -> list[Item]:
|
|
27
|
+
abbr: Optional[Tuning]
|
|
28
|
+
if not expectsabbr:
|
|
29
|
+
abbr = None
|
|
30
|
+
elif expandsabbr:
|
|
31
|
+
abbr = Tuning.MINIMIZE
|
|
32
|
+
else:
|
|
33
|
+
abbr = Tuning.MAINTAIN
|
|
34
|
+
return list(
|
|
35
|
+
parse_generator(
|
|
36
|
+
args,
|
|
37
|
+
abbr=abbr,
|
|
38
|
+
**kwargs,
|
|
39
|
+
)
|
|
40
|
+
)
|
|
23
41
|
|
|
24
42
|
|
|
25
43
|
def parse_bundling(
|
|
@@ -64,10 +82,9 @@ def parse_cause(
|
|
|
64
82
|
def parse_generator(
|
|
65
83
|
items: list[Positional],
|
|
66
84
|
*,
|
|
85
|
+
abbr: Optional[Tuning],
|
|
67
86
|
allowslong: bool,
|
|
68
87
|
allowsshort: bool,
|
|
69
|
-
expandsabbr: bool,
|
|
70
|
-
expectsabbr: bool,
|
|
71
88
|
expectsposix: bool,
|
|
72
89
|
optdict: dict,
|
|
73
90
|
prog: str,
|
|
@@ -103,11 +120,10 @@ def parse_generator(
|
|
|
103
120
|
continue
|
|
104
121
|
last = parse_option(
|
|
105
122
|
item.value,
|
|
123
|
+
abbr=abbr,
|
|
106
124
|
allowslong=allowslong,
|
|
107
125
|
allowsshort=allowsshort,
|
|
108
126
|
cause=cause,
|
|
109
|
-
expandsabbr=expandsabbr,
|
|
110
|
-
expectsabbr=expectsabbr,
|
|
111
127
|
optdict=optdict,
|
|
112
128
|
)
|
|
113
129
|
if not last.ishungry():
|
|
@@ -138,9 +154,8 @@ def parse_islong(
|
|
|
138
154
|
def parse_long(
|
|
139
155
|
arg: str,
|
|
140
156
|
*,
|
|
157
|
+
abbr: Optional[Tuning],
|
|
141
158
|
cause: FunctionType,
|
|
142
|
-
expandsabbr: bool,
|
|
143
|
-
expectsabbr: bool,
|
|
144
159
|
optdict: dict,
|
|
145
160
|
) -> Long:
|
|
146
161
|
ans: Long
|
|
@@ -153,7 +168,7 @@ def parse_long(
|
|
|
153
168
|
ans.abbrlen = len(ans.fullkey)
|
|
154
169
|
if ans.fullkey in optdict.keys():
|
|
155
170
|
parts = [ans.fullkey]
|
|
156
|
-
elif
|
|
171
|
+
elif abbr is not None:
|
|
157
172
|
parts = parse_long_startswith(ans.abbr, keys=optdict.keys())
|
|
158
173
|
else:
|
|
159
174
|
parts = list() # can be assumed
|
|
@@ -166,7 +181,7 @@ def parse_long(
|
|
|
166
181
|
cause(PAOW, option=arg, possibilities=parts)
|
|
167
182
|
return ans
|
|
168
183
|
(ans.fullkey,) = parts
|
|
169
|
-
if
|
|
184
|
+
if abbr == Tuning.MINIMIZE:
|
|
170
185
|
ans.abbrlen = len(ans.fullkey)
|
|
171
186
|
ans.nargs = optdict[ans.fullkey]
|
|
172
187
|
if (ans.nargs == Nargs.NO_ARGUMENT) and (ans.right is not None):
|
|
@@ -191,18 +206,16 @@ def parse_long_startswith(
|
|
|
191
206
|
def parse_option(
|
|
192
207
|
arg: str,
|
|
193
208
|
*,
|
|
209
|
+
abbr: Optional[Tuning],
|
|
194
210
|
cause: FunctionType,
|
|
195
|
-
expandsabbr: bool,
|
|
196
|
-
expectsabbr: bool,
|
|
197
211
|
optdict: dict,
|
|
198
212
|
**kwargs: Any,
|
|
199
213
|
) -> Option:
|
|
200
214
|
if parse_islong(arg, **kwargs):
|
|
201
215
|
return parse_long(
|
|
202
216
|
arg,
|
|
217
|
+
abbr=abbr,
|
|
203
218
|
cause=cause,
|
|
204
|
-
expandsabbr=expandsabbr,
|
|
205
|
-
expectsabbr=expectsabbr,
|
|
206
219
|
optdict=optdict,
|
|
207
220
|
)
|
|
208
221
|
else:
|
|
@@ -31,10 +31,24 @@ class TestDataToml(unittest.TestCase):
|
|
|
31
31
|
data: dict[str, Any]
|
|
32
32
|
name: str
|
|
33
33
|
kwargs: dict
|
|
34
|
+
kwargs_: dict
|
|
34
35
|
data = utils.get_data()
|
|
35
36
|
for name, kwargs in data.items():
|
|
36
37
|
with self.subTest(msg=name, **kwargs):
|
|
37
|
-
self.
|
|
38
|
+
kwargs_ = self.convert(**kwargs)
|
|
39
|
+
self.parse(**kwargs_)
|
|
40
|
+
|
|
41
|
+
def convert(self: Self, **kwargs: Any) -> dict:
|
|
42
|
+
ans: dict
|
|
43
|
+
x: str
|
|
44
|
+
y: Any
|
|
45
|
+
ans = dict()
|
|
46
|
+
for x, y in kwargs.items():
|
|
47
|
+
if utils.istestable(y):
|
|
48
|
+
ans[x] = y
|
|
49
|
+
else:
|
|
50
|
+
ans[x] = None
|
|
51
|
+
return ans
|
|
38
52
|
|
|
39
53
|
def parse(
|
|
40
54
|
self: Self,
|
|
@@ -74,7 +88,7 @@ class TestDataToml(unittest.TestCase):
|
|
|
74
88
|
self.assertEqual(answer, superanswer, msg=msg)
|
|
75
89
|
msg = "\n\ndata=%s,\nanswer=%s,\nsolution=%s,\n\n" % (data, answer, solution)
|
|
76
90
|
self.assertEqual(answer, solution, msg=msg)
|
|
77
|
-
if
|
|
91
|
+
if warnings is None:
|
|
78
92
|
return
|
|
79
93
|
msg = "\n\ndata=%s,\nerranswer=%s,\nwarnings=%s,\n\n" % (
|
|
80
94
|
data,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|