preparse 2.0.0.dev3__tar.gz → 2.0.0.dev4__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-2.0.0.dev3/src/preparse.egg-info → preparse-2.0.0.dev4}/PKG-INFO +1 -1
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/pyproject.toml +1 -1
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_items/Bundle.py +4 -4
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_processing/__init__.py +7 -7
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_processing/digesting.py +13 -13
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_processing/parsing.py +9 -9
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/core/PreParser.py +12 -12
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/data.toml +105984 -105984
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/test_expit_toml.py +1 -1
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4/src/preparse.egg-info}/PKG-INFO +1 -1
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/LICENSE.txt +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/MANIFEST.in +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/README.rst +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/docs/v1.0.rst +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/setup.cfg +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/__init__.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_items/Item.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_items/Long.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_items/Option.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_items/Positional.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_items/Special.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_items/__init__.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_processing/deparsing.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_processing/pulling.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_utils/__init__.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/_utils/dataprop.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/core/Click.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/core/Optdict.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/core/PreparseWarning.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/core/__init__.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/enums/__init__.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/__init__.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/expit.toml +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/test_data_toml.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/test_enums.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/test_optdict.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/tests/test_preparser.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/AmbiguousOptionWarner.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/DualWarner.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/InvalidOptionWarner.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/LongonlyWarner.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/RequiredArgumentWarner.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/UnallowedArgumentWarner.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/WarnerABC.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse/warners/__init__.py +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse.egg-info/SOURCES.txt +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse.egg-info/dependency_links.txt +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse.egg-info/requires.txt +0 -0
- {preparse-2.0.0.dev3 → preparse-2.0.0.dev4}/src/preparse.egg-info/top_level.txt +0 -0
|
@@ -32,7 +32,7 @@ class Bundle(Option):
|
|
|
32
32
|
self.right = right
|
|
33
33
|
|
|
34
34
|
@classmethod
|
|
35
|
-
def
|
|
35
|
+
def _split_allowsLong(cls: type, chars: str) -> list[str]:
|
|
36
36
|
ans: list[str]
|
|
37
37
|
x: str
|
|
38
38
|
ans = list()
|
|
@@ -73,12 +73,12 @@ class Bundle(Option):
|
|
|
73
73
|
else:
|
|
74
74
|
return ["-" + self.chars, self.right]
|
|
75
75
|
|
|
76
|
-
def split(self: Self, *,
|
|
76
|
+
def split(self: Self, *, allowsLong: bool) -> list[Item]:
|
|
77
77
|
ans: list[Self]
|
|
78
78
|
parts: list[str]
|
|
79
79
|
x: str
|
|
80
|
-
if
|
|
81
|
-
parts = self.
|
|
80
|
+
if allowsLong:
|
|
81
|
+
parts = self._split_allowsLong(self.chars)
|
|
82
82
|
else:
|
|
83
83
|
parts = self._split_shortonly(self.chars)
|
|
84
84
|
ans = list()
|
|
@@ -15,15 +15,15 @@ __all__ = ["process"]
|
|
|
15
15
|
def process(
|
|
16
16
|
args: Optional[Iterable] = None,
|
|
17
17
|
*,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
allowsLong: bool,
|
|
19
|
+
allowsShort: bool,
|
|
20
20
|
bundling: Tuning,
|
|
21
21
|
expandsabbr: bool,
|
|
22
22
|
expectsabbr: bool,
|
|
23
23
|
expectsPOSIX: bool,
|
|
24
24
|
optDict: dict,
|
|
25
25
|
prog: str,
|
|
26
|
-
|
|
26
|
+
reconcilesOrders: bool,
|
|
27
27
|
special: Tuning,
|
|
28
28
|
warn: FunctionType,
|
|
29
29
|
) -> list[str]:
|
|
@@ -32,8 +32,8 @@ def process(
|
|
|
32
32
|
items = pull(args)
|
|
33
33
|
items = parse(
|
|
34
34
|
items,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
allowsLong=allowsLong,
|
|
36
|
+
allowsShort=allowsShort,
|
|
37
37
|
expectsabbr=expectsabbr,
|
|
38
38
|
expectsPOSIX=expectsPOSIX,
|
|
39
39
|
optDict=optDict,
|
|
@@ -42,11 +42,11 @@ def process(
|
|
|
42
42
|
)
|
|
43
43
|
items = digest(
|
|
44
44
|
items,
|
|
45
|
-
|
|
45
|
+
allowsLong=allowsLong,
|
|
46
46
|
bundling=bundling,
|
|
47
47
|
expandsabbr=expandsabbr,
|
|
48
48
|
expectsPOSIX=expectsPOSIX,
|
|
49
|
-
|
|
49
|
+
reconcilesOrders=reconcilesOrders,
|
|
50
50
|
special=special,
|
|
51
51
|
)
|
|
52
52
|
return deparse(items)
|
|
@@ -14,11 +14,11 @@ __all__ = ["digest"]
|
|
|
14
14
|
def digest(
|
|
15
15
|
items: list[Item],
|
|
16
16
|
*,
|
|
17
|
-
|
|
17
|
+
allowsLong: bool,
|
|
18
18
|
bundling: Tuning,
|
|
19
19
|
expandsabbr: bool,
|
|
20
20
|
expectsPOSIX: bool,
|
|
21
|
-
|
|
21
|
+
reconcilesOrders: bool,
|
|
22
22
|
special: Tuning,
|
|
23
23
|
) -> list[Item]:
|
|
24
24
|
ans: list[Item]
|
|
@@ -30,18 +30,18 @@ def digest(
|
|
|
30
30
|
ans = digest_special(
|
|
31
31
|
ans,
|
|
32
32
|
expectsPOSIX=expectsPOSIX,
|
|
33
|
-
|
|
33
|
+
reconcilesOrders=reconcilesOrders,
|
|
34
34
|
special=special,
|
|
35
35
|
)
|
|
36
36
|
ans = digest_order(
|
|
37
37
|
ans,
|
|
38
38
|
expectsPOSIX=expectsPOSIX,
|
|
39
|
-
|
|
39
|
+
reconcilesOrders=reconcilesOrders,
|
|
40
40
|
)
|
|
41
41
|
ans = digest_bundling(
|
|
42
42
|
ans,
|
|
43
43
|
bundling=bundling,
|
|
44
|
-
|
|
44
|
+
allowsLong=allowsLong,
|
|
45
45
|
)
|
|
46
46
|
return ans
|
|
47
47
|
|
|
@@ -65,11 +65,11 @@ def digest_abbr(
|
|
|
65
65
|
def digest_bundling(
|
|
66
66
|
items: list[Item],
|
|
67
67
|
*,
|
|
68
|
-
|
|
68
|
+
allowsLong: bool,
|
|
69
69
|
bundling: Tuning,
|
|
70
70
|
) -> list[Item]:
|
|
71
71
|
if bundling == Tuning.MINIMIZE:
|
|
72
|
-
return digest_bundling_min(items,
|
|
72
|
+
return digest_bundling_min(items, allowsLong=allowsLong)
|
|
73
73
|
if bundling == Tuning.MAXIMIZE:
|
|
74
74
|
return digest_bundling_max(items)
|
|
75
75
|
return items
|
|
@@ -78,14 +78,14 @@ def digest_bundling(
|
|
|
78
78
|
def digest_bundling_min(
|
|
79
79
|
items: list[Item],
|
|
80
80
|
*,
|
|
81
|
-
|
|
81
|
+
allowsLong: bool,
|
|
82
82
|
) -> list[Item]:
|
|
83
83
|
ans: list[Item]
|
|
84
84
|
item: Item
|
|
85
85
|
ans = list()
|
|
86
86
|
for item in items:
|
|
87
87
|
if isinstance(item, Bundle):
|
|
88
|
-
ans += item.split(
|
|
88
|
+
ans += item.split(allowsLong=allowsLong)
|
|
89
89
|
else:
|
|
90
90
|
ans.append(item)
|
|
91
91
|
return ans
|
|
@@ -117,13 +117,13 @@ def digest_order(
|
|
|
117
117
|
items: list[Item],
|
|
118
118
|
*,
|
|
119
119
|
expectsPOSIX: bool,
|
|
120
|
-
|
|
120
|
+
reconcilesOrders: bool,
|
|
121
121
|
) -> list[Item]:
|
|
122
122
|
ans: list[Item]
|
|
123
123
|
comp: bool
|
|
124
124
|
index: int
|
|
125
125
|
ans = list(items)
|
|
126
|
-
if not
|
|
126
|
+
if not reconcilesOrders:
|
|
127
127
|
return ans
|
|
128
128
|
if not expectsPOSIX:
|
|
129
129
|
ans.sort(key=digest_order_key)
|
|
@@ -188,7 +188,7 @@ def digest_special_min(
|
|
|
188
188
|
items: list[Item],
|
|
189
189
|
*,
|
|
190
190
|
expectsPOSIX: bool,
|
|
191
|
-
|
|
191
|
+
reconcilesOrders: bool,
|
|
192
192
|
) -> list[Item]:
|
|
193
193
|
ans: list[Item]
|
|
194
194
|
index: int
|
|
@@ -196,7 +196,7 @@ def digest_special_min(
|
|
|
196
196
|
isposix: bool
|
|
197
197
|
ans = list(items)
|
|
198
198
|
isdel = True
|
|
199
|
-
isposix = expectsPOSIX and not
|
|
199
|
+
isposix = expectsPOSIX and not reconcilesOrders
|
|
200
200
|
index = len(items)
|
|
201
201
|
while True:
|
|
202
202
|
index -= 1
|
|
@@ -62,8 +62,8 @@ def parse_cause(
|
|
|
62
62
|
def parse_generator(
|
|
63
63
|
items: list[Positional],
|
|
64
64
|
*,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
allowsLong: bool,
|
|
66
|
+
allowsShort: bool,
|
|
67
67
|
expectsabbr: bool,
|
|
68
68
|
expectsPOSIX: bool,
|
|
69
69
|
optDict: dict,
|
|
@@ -74,7 +74,7 @@ def parse_generator(
|
|
|
74
74
|
cause: FunctionType
|
|
75
75
|
last: Optional[Option]
|
|
76
76
|
item: Positional
|
|
77
|
-
broken = not (
|
|
77
|
+
broken = not (allowsLong or allowsShort)
|
|
78
78
|
cause = parse_cause(prog=prog, warn=warn)
|
|
79
79
|
last = None
|
|
80
80
|
for item in items:
|
|
@@ -100,8 +100,8 @@ def parse_generator(
|
|
|
100
100
|
continue
|
|
101
101
|
last = parse_option(
|
|
102
102
|
item.value,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
allowsLong=allowsLong,
|
|
104
|
+
allowsShort=allowsShort,
|
|
105
105
|
cause=cause,
|
|
106
106
|
expectsabbr=expectsabbr,
|
|
107
107
|
optDict=optDict,
|
|
@@ -122,13 +122,13 @@ def parse_generator(
|
|
|
122
122
|
def parse_islong(
|
|
123
123
|
arg: str,
|
|
124
124
|
*,
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
allowsLong: bool,
|
|
126
|
+
allowsShort: bool,
|
|
127
127
|
) -> bool:
|
|
128
|
-
if
|
|
128
|
+
if allowsLong and allowsShort:
|
|
129
129
|
return arg.startswith("--")
|
|
130
130
|
else:
|
|
131
|
-
return not
|
|
131
|
+
return not allowsShort
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
def parse_long(
|
|
@@ -23,15 +23,15 @@ __all__ = ["PreParser"]
|
|
|
23
23
|
|
|
24
24
|
class PreParser(Copyable):
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
allowsLong: bool
|
|
27
|
+
allowsShort: bool
|
|
28
28
|
bundling: Tuning
|
|
29
29
|
expandsabbr: bool
|
|
30
30
|
expectsabbr: bool
|
|
31
31
|
expectsPOSIX: bool
|
|
32
32
|
optDict: OptDict
|
|
33
33
|
prog: str
|
|
34
|
-
|
|
34
|
+
reconcilesOrders: bool
|
|
35
35
|
special: Tuning
|
|
36
36
|
warn: Callable
|
|
37
37
|
|
|
@@ -41,27 +41,27 @@ class PreParser(Copyable):
|
|
|
41
41
|
def __init__(
|
|
42
42
|
self: Self,
|
|
43
43
|
*,
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
allowsLong: Any = True,
|
|
45
|
+
allowsShort: Any = True,
|
|
46
46
|
bundling: Any = Tuning.MAINTAIN,
|
|
47
47
|
expandsabbr: Any = True,
|
|
48
48
|
expectsabbr: Any = True,
|
|
49
49
|
expectsPOSIX: Any = False,
|
|
50
50
|
optDict: Any = (),
|
|
51
51
|
prog: Any = None,
|
|
52
|
-
|
|
52
|
+
reconcilesOrders: Any = True,
|
|
53
53
|
special: Any = Tuning.MAINTAIN,
|
|
54
54
|
warn: types.FunctionType = str,
|
|
55
55
|
) -> None:
|
|
56
|
-
self.
|
|
57
|
-
self.
|
|
56
|
+
self.allowsLong = allowsLong
|
|
57
|
+
self.allowsShort = allowsShort
|
|
58
58
|
self.bundling = bundling
|
|
59
59
|
self.expandsabbr = expandsabbr
|
|
60
60
|
self.expectsabbr = expectsabbr
|
|
61
61
|
self.expectsPOSIX = expectsPOSIX
|
|
62
62
|
self.optDict = optDict
|
|
63
63
|
self.prog = prog
|
|
64
|
-
self.
|
|
64
|
+
self.reconcilesOrders = reconcilesOrders
|
|
65
65
|
self.special = special
|
|
66
66
|
self.warn = warn
|
|
67
67
|
|
|
@@ -70,11 +70,11 @@ class PreParser(Copyable):
|
|
|
70
70
|
return datarepr(type(self).__name__, **self.todict())
|
|
71
71
|
|
|
72
72
|
@dataprop
|
|
73
|
-
def
|
|
73
|
+
def allowsLong(self: Self, value: Any) -> bool:
|
|
74
74
|
return bool(value)
|
|
75
75
|
|
|
76
76
|
@dataprop
|
|
77
|
-
def
|
|
77
|
+
def allowsShort(self: Self, value: Any) -> bool:
|
|
78
78
|
return bool(value)
|
|
79
79
|
|
|
80
80
|
@dataprop
|
|
@@ -132,7 +132,7 @@ class PreParser(Copyable):
|
|
|
132
132
|
return str(value)
|
|
133
133
|
|
|
134
134
|
@dataprop
|
|
135
|
-
def
|
|
135
|
+
def reconcilesOrders(self: Self, value: Any) -> bool:
|
|
136
136
|
return bool(value)
|
|
137
137
|
|
|
138
138
|
def reflectClickCommand(self: Self, cmd: cl.Command) -> None:
|