preparse 2.0.0.dev10__py3-none-any.whl → 2.0.0.dev12__py3-none-any.whl
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/_processing/parsing.py +30 -14
- preparse/tests/data.toml +198 -0
- {preparse-2.0.0.dev10.dist-info → preparse-2.0.0.dev12.dist-info}/METADATA +1 -1
- {preparse-2.0.0.dev10.dist-info → preparse-2.0.0.dev12.dist-info}/RECORD +7 -7
- {preparse-2.0.0.dev10.dist-info → preparse-2.0.0.dev12.dist-info}/WHEEL +0 -0
- {preparse-2.0.0.dev10.dist-info → preparse-2.0.0.dev12.dist-info}/licenses/LICENSE.txt +0 -0
- {preparse-2.0.0.dev10.dist-info → preparse-2.0.0.dev12.dist-info}/top_level.txt +0 -0
preparse/_processing/parsing.py
CHANGED
|
@@ -124,22 +124,11 @@ def parse_generator(
|
|
|
124
124
|
yield last
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
def parse_islong(
|
|
128
|
-
arg: str,
|
|
129
|
-
*,
|
|
130
|
-
allowslong: bool,
|
|
131
|
-
allowsshort: bool,
|
|
132
|
-
) -> bool:
|
|
133
|
-
if allowslong and allowsshort:
|
|
134
|
-
return arg.startswith("--")
|
|
135
|
-
else:
|
|
136
|
-
return not allowsshort
|
|
137
|
-
|
|
138
|
-
|
|
139
127
|
def parse_long(
|
|
140
128
|
arg: str,
|
|
141
129
|
*,
|
|
142
130
|
abbr: Optional[Tuning],
|
|
131
|
+
allowsshort: bool,
|
|
143
132
|
cause: FunctionType,
|
|
144
133
|
optdict: dict,
|
|
145
134
|
) -> Long:
|
|
@@ -168,6 +157,15 @@ def parse_long(
|
|
|
168
157
|
(ans.fullkey,) = parts
|
|
169
158
|
if abbr == Tuning.MINIMIZE:
|
|
170
159
|
ans.abbrlen = len(ans.fullkey)
|
|
160
|
+
if abbr == Tuning.MAXIMIZE:
|
|
161
|
+
parts = list(optdict.keys())
|
|
162
|
+
parts.remove(ans.fullkey)
|
|
163
|
+
ans.abbrlen = parse_minlen(
|
|
164
|
+
abbr=ans.abbr,
|
|
165
|
+
allowsshort=allowsshort,
|
|
166
|
+
joined=ans.joined,
|
|
167
|
+
keys=tuple(parts),
|
|
168
|
+
)
|
|
171
169
|
ans.nargs = optdict[ans.fullkey]
|
|
172
170
|
if (ans.nargs == Nargs.NO_ARGUMENT) and (ans.right is not None):
|
|
173
171
|
cause(PUAW, option=ans.fullkey)
|
|
@@ -188,18 +186,36 @@ def parse_long_startswith(
|
|
|
188
186
|
return ans
|
|
189
187
|
|
|
190
188
|
|
|
189
|
+
def parse_minlen(
|
|
190
|
+
*,
|
|
191
|
+
abbr: str,
|
|
192
|
+
allowsshort: bool,
|
|
193
|
+
joined: bool,
|
|
194
|
+
keys: tuple[str, ...],
|
|
195
|
+
) -> int:
|
|
196
|
+
m: int
|
|
197
|
+
n: int
|
|
198
|
+
m = 2 + allowsshort - joined
|
|
199
|
+
n = len(abbr)
|
|
200
|
+
while n >= m and not any(z.startswith(abbr[:n]) for z in keys):
|
|
201
|
+
n -= 1
|
|
202
|
+
return n + 1
|
|
203
|
+
|
|
204
|
+
|
|
191
205
|
def parse_option(
|
|
192
206
|
arg: str,
|
|
193
207
|
*,
|
|
194
208
|
abbr: Optional[Tuning],
|
|
209
|
+
allowslong: bool,
|
|
210
|
+
allowsshort: bool,
|
|
195
211
|
cause: FunctionType,
|
|
196
212
|
optdict: dict,
|
|
197
|
-
**kwargs: Any,
|
|
198
213
|
) -> Option:
|
|
199
|
-
if
|
|
214
|
+
if (allowslong and arg.startswith("--")) or not allowsshort:
|
|
200
215
|
return parse_long(
|
|
201
216
|
arg,
|
|
202
217
|
abbr=abbr,
|
|
218
|
+
allowsshort=allowsshort,
|
|
203
219
|
cause=cause,
|
|
204
220
|
optdict=optdict,
|
|
205
221
|
)
|
preparse/tests/data.toml
CHANGED
|
@@ -1250701,3 +1250701,201 @@ abbr = 2
|
|
|
1250701
1250701
|
|
|
1250702
1250702
|
[run35319go.optdict]
|
|
1250703
1250703
|
--verbose = 0
|
|
1250704
|
+
|
|
1250705
|
+
|
|
1250706
|
+
[run35320go]
|
|
1250707
|
+
bundling = 2
|
|
1250708
|
+
query = [
|
|
1250709
|
+
"--versio",
|
|
1250710
|
+
]
|
|
1250711
|
+
solution = [
|
|
1250712
|
+
"--vers",
|
|
1250713
|
+
]
|
|
1250714
|
+
prog = "run35320go"
|
|
1250715
|
+
expectsposix = false
|
|
1250716
|
+
reconcilesorders = false
|
|
1250717
|
+
allowsshort = true
|
|
1250718
|
+
allowslong = true
|
|
1250719
|
+
special = 2
|
|
1250720
|
+
warnings = []
|
|
1250721
|
+
abbr = 1
|
|
1250722
|
+
|
|
1250723
|
+
[run35320go.optdict]
|
|
1250724
|
+
--verbose = 0
|
|
1250725
|
+
--version = 0
|
|
1250726
|
+
|
|
1250727
|
+
|
|
1250728
|
+
[run35321go]
|
|
1250729
|
+
bundling = 2
|
|
1250730
|
+
query = [
|
|
1250731
|
+
"--verbose",
|
|
1250732
|
+
]
|
|
1250733
|
+
solution = [
|
|
1250734
|
+
"--verb",
|
|
1250735
|
+
]
|
|
1250736
|
+
prog = "run35321go"
|
|
1250737
|
+
expectsposix = false
|
|
1250738
|
+
reconcilesorders = false
|
|
1250739
|
+
allowsshort = true
|
|
1250740
|
+
allowslong = true
|
|
1250741
|
+
special = 2
|
|
1250742
|
+
warnings = []
|
|
1250743
|
+
abbr = 1
|
|
1250744
|
+
|
|
1250745
|
+
[run35321go.optdict]
|
|
1250746
|
+
--verbose = 0
|
|
1250747
|
+
--version = 0
|
|
1250748
|
+
|
|
1250749
|
+
|
|
1250750
|
+
|
|
1250751
|
+
[run35322go]
|
|
1250752
|
+
bundling = 2
|
|
1250753
|
+
query = [
|
|
1250754
|
+
"-verbose",
|
|
1250755
|
+
]
|
|
1250756
|
+
solution = [
|
|
1250757
|
+
"-verb",
|
|
1250758
|
+
]
|
|
1250759
|
+
prog = "run35322go"
|
|
1250760
|
+
expectsposix = false
|
|
1250761
|
+
reconcilesorders = false
|
|
1250762
|
+
allowsshort = false
|
|
1250763
|
+
allowslong = true
|
|
1250764
|
+
special = 2
|
|
1250765
|
+
warnings = []
|
|
1250766
|
+
abbr = 1
|
|
1250767
|
+
|
|
1250768
|
+
[run35322go.optdict]
|
|
1250769
|
+
-verbose = 0
|
|
1250770
|
+
-version = 0
|
|
1250771
|
+
|
|
1250772
|
+
|
|
1250773
|
+
|
|
1250774
|
+
|
|
1250775
|
+
[run35323go]
|
|
1250776
|
+
bundling = 0
|
|
1250777
|
+
query = [
|
|
1250778
|
+
"-verbose",
|
|
1250779
|
+
]
|
|
1250780
|
+
solution = [
|
|
1250781
|
+
"-v",
|
|
1250782
|
+
"-e",
|
|
1250783
|
+
"-r",
|
|
1250784
|
+
"-b",
|
|
1250785
|
+
"-o",
|
|
1250786
|
+
"-s",
|
|
1250787
|
+
"-e",
|
|
1250788
|
+
]
|
|
1250789
|
+
prog = "run35323go"
|
|
1250790
|
+
expectsposix = false
|
|
1250791
|
+
reconcilesorders = false
|
|
1250792
|
+
allowsshort = true
|
|
1250793
|
+
allowslong = true
|
|
1250794
|
+
special = 2
|
|
1250795
|
+
warnings = [
|
|
1250796
|
+
"run35323go: invalid option -- 'v'",
|
|
1250797
|
+
"run35323go: invalid option -- 'e'",
|
|
1250798
|
+
"run35323go: invalid option -- 'r'",
|
|
1250799
|
+
"run35323go: invalid option -- 'b'",
|
|
1250800
|
+
"run35323go: invalid option -- 'o'",
|
|
1250801
|
+
"run35323go: invalid option -- 's'",
|
|
1250802
|
+
"run35323go: invalid option -- 'e'",
|
|
1250803
|
+
]
|
|
1250804
|
+
abbr = 1
|
|
1250805
|
+
|
|
1250806
|
+
[run35323go.optdict]
|
|
1250807
|
+
-verbose = 0
|
|
1250808
|
+
-version = 0
|
|
1250809
|
+
|
|
1250810
|
+
|
|
1250811
|
+
[run35324go]
|
|
1250812
|
+
bundling = 2
|
|
1250813
|
+
query = [
|
|
1250814
|
+
"-verbose",
|
|
1250815
|
+
]
|
|
1250816
|
+
solution = [
|
|
1250817
|
+
"-verbose",
|
|
1250818
|
+
]
|
|
1250819
|
+
prog = "run35324go"
|
|
1250820
|
+
expectsposix = false
|
|
1250821
|
+
reconcilesorders = false
|
|
1250822
|
+
allowsshort = true
|
|
1250823
|
+
allowslong = true
|
|
1250824
|
+
special = 2
|
|
1250825
|
+
warnings = [
|
|
1250826
|
+
"run35324go: invalid option -- 'v'",
|
|
1250827
|
+
"run35324go: invalid option -- 'e'",
|
|
1250828
|
+
"run35324go: invalid option -- 'r'",
|
|
1250829
|
+
"run35324go: invalid option -- 'b'",
|
|
1250830
|
+
"run35324go: invalid option -- 'o'",
|
|
1250831
|
+
"run35324go: invalid option -- 's'",
|
|
1250832
|
+
"run35324go: invalid option -- 'e'",
|
|
1250833
|
+
]
|
|
1250834
|
+
abbr = 1
|
|
1250835
|
+
|
|
1250836
|
+
[run35324go.optdict]
|
|
1250837
|
+
-verbose = 0
|
|
1250838
|
+
-version = 0
|
|
1250839
|
+
|
|
1250840
|
+
[run35325go]
|
|
1250841
|
+
bundling = 2
|
|
1250842
|
+
query = [
|
|
1250843
|
+
"--outfile=../hello.world",
|
|
1250844
|
+
]
|
|
1250845
|
+
solution = [
|
|
1250846
|
+
"--=../hello.world",
|
|
1250847
|
+
]
|
|
1250848
|
+
prog = "run35325go"
|
|
1250849
|
+
expectsposix = false
|
|
1250850
|
+
reconcilesorders = false
|
|
1250851
|
+
allowsshort = true
|
|
1250852
|
+
allowslong = true
|
|
1250853
|
+
special = 2
|
|
1250854
|
+
warnings = []
|
|
1250855
|
+
abbr = 1
|
|
1250856
|
+
|
|
1250857
|
+
[run35325go.optdict]
|
|
1250858
|
+
--outfile = 2
|
|
1250859
|
+
|
|
1250860
|
+
|
|
1250861
|
+
[run35326go]
|
|
1250862
|
+
bundling = 2
|
|
1250863
|
+
query = [
|
|
1250864
|
+
"--outfile=../hello.world",
|
|
1250865
|
+
]
|
|
1250866
|
+
solution = [
|
|
1250867
|
+
"--o=../hello.world",
|
|
1250868
|
+
]
|
|
1250869
|
+
prog = "run35326go"
|
|
1250870
|
+
expectsposix = false
|
|
1250871
|
+
reconcilesorders = false
|
|
1250872
|
+
allowsshort = true
|
|
1250873
|
+
allowslong = true
|
|
1250874
|
+
special = 2
|
|
1250875
|
+
warnings = []
|
|
1250876
|
+
abbr = 1
|
|
1250877
|
+
|
|
1250878
|
+
[run35326go.optdict]
|
|
1250879
|
+
--infile = 2
|
|
1250880
|
+
--outfile = 2
|
|
1250881
|
+
|
|
1250882
|
+
|
|
1250883
|
+
[run35327go]
|
|
1250884
|
+
bundling = 2
|
|
1250885
|
+
query = [
|
|
1250886
|
+
"--outfile",
|
|
1250887
|
+
]
|
|
1250888
|
+
solution = [
|
|
1250889
|
+
"--o",
|
|
1250890
|
+
]
|
|
1250891
|
+
prog = "run35327go"
|
|
1250892
|
+
expectsposix = false
|
|
1250893
|
+
reconcilesorders = false
|
|
1250894
|
+
allowsshort = true
|
|
1250895
|
+
allowslong = true
|
|
1250896
|
+
special = 2
|
|
1250897
|
+
warnings = []
|
|
1250898
|
+
abbr = 1
|
|
1250899
|
+
|
|
1250900
|
+
[run35327go.optdict]
|
|
1250901
|
+
--outfile = 2
|
|
@@ -9,7 +9,7 @@ preparse/_items/__init__.py,sha256=_rfDzOPgUqPZnROBEig35wIw2uAoVtjriFNmcQBuPnI,2
|
|
|
9
9
|
preparse/_processing/__init__.py,sha256=OnT8Zp_n6QDxY6B_VAuSutTzDkVa41pHh36oZKRFvNo,1172
|
|
10
10
|
preparse/_processing/deparsing.py,sha256=wPa1hKda3j8H2Y8K9e8kToekXx0dRcSbpYz23TL9Gdk,249
|
|
11
11
|
preparse/_processing/digesting.py,sha256=rvPwfHXLkTzsCDofH6OlsGqOdy5YCxCuWUns8SPBenU,4450
|
|
12
|
-
preparse/_processing/parsing.py,sha256=
|
|
12
|
+
preparse/_processing/parsing.py,sha256=Ct65zGRvws8YU52vWKiE3jPthBqhy89KsWSE5442ca8,5568
|
|
13
13
|
preparse/_processing/pulling.py,sha256=4zJfOeBr4yLj9ClangXFqZPjXfcAjYn_VSMbLclaZik,350
|
|
14
14
|
preparse/_utils/__init__.py,sha256=KNK6PuqZPkYXY85tM-AfUoS_lrRNAmfJF5Wvk7Wipco,39
|
|
15
15
|
preparse/_utils/dataprop.py,sha256=YgSkJptMshxD5MDhXvDM1m7xHIeac_tt_SpcTZkfdlw,545
|
|
@@ -20,15 +20,15 @@ preparse/core/__init__.py,sha256=YIHjizpgeWuXE_AFPBVZGUXy5Tj_j5oW0EsZYLyNHxA,179
|
|
|
20
20
|
preparse/core/enums.py,sha256=jdkIdfAj2syeSaW2hEnvIXsDmWYX2w6X1Lp8h1ahVME,580
|
|
21
21
|
preparse/core/warnings.py,sha256=xqC-Y7HvWMpZ24K6MJZa8QpBgjt3JL948LQQrDF9m_Q,3793
|
|
22
22
|
preparse/tests/__init__.py,sha256=xudYvSE5tnXSgesYCLp9CQbWeEhC51OeLpNlJ14uPfQ,374
|
|
23
|
-
preparse/tests/data.toml,sha256=
|
|
23
|
+
preparse/tests/data.toml,sha256=iBrlr8dbYfi7FwQ3KUepQPYE8ZJdzcnh2d4G07rOJ7E,16856356
|
|
24
24
|
preparse/tests/expit.toml,sha256=fP0P99hkbRu2vsCKBFLLCscMPo_XFpMBaV-y0MnjVnw,1206
|
|
25
25
|
preparse/tests/test_data_toml.py,sha256=z835Eq8tdiNxZPQBCJeqrN2PWsRQhXw4BNW_wYGgeGU,2560
|
|
26
26
|
preparse/tests/test_enums.py,sha256=MZfmCE-2v_lP6GLqW_b_d5NkN3kUa1lNzQ6JPh26Hmo,383
|
|
27
27
|
preparse/tests/test_expit_toml.py,sha256=R5vsGLRROZv6bzMbn7aSjTEeYfWG_k9FKONwn0v0FpU,2335
|
|
28
28
|
preparse/tests/test_optdict.py,sha256=NuEJp83jsJCq5z0-k6UzT-v4XagT6IgDr45VJZGGKBk,504
|
|
29
29
|
preparse/tests/test_preparser.py,sha256=imEv-Yfh7FI6H-zKo3hvyBJWvMUWUDxWCTvfHB4nnVI,1271
|
|
30
|
-
preparse-2.0.0.
|
|
31
|
-
preparse-2.0.0.
|
|
32
|
-
preparse-2.0.0.
|
|
33
|
-
preparse-2.0.0.
|
|
34
|
-
preparse-2.0.0.
|
|
30
|
+
preparse-2.0.0.dev12.dist-info/licenses/LICENSE.txt,sha256=QwqYepQwTN5xG57cngKt6xxYD9z9hw9d3lcI8zSLiNg,1074
|
|
31
|
+
preparse-2.0.0.dev12.dist-info/METADATA,sha256=LcIYq_WR5QLmCJta6_A639_Dh0-KtJV4CBqlmFhjp3Y,2603
|
|
32
|
+
preparse-2.0.0.dev12.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
33
|
+
preparse-2.0.0.dev12.dist-info/top_level.txt,sha256=YFPuigMoI1m1K63OFDAQ6zN8yqCwAFwC7lNCTIOKj1I,9
|
|
34
|
+
preparse-2.0.0.dev12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|