preparse 1.0.13.post1.dev0__tar.gz → 1.0.13.post1.dev1__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.13.post1.dev0 → preparse-1.0.13.post1.dev1}/PKG-INFO +1 -1
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/pyproject.toml +1 -1
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_items/Bundle.py +8 -4
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_items/Long.py +18 -7
- preparse-1.0.13.post1.dev1/src/preparse/_items/Option.py +53 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_items/Positional.py +8 -4
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/__init__.py +0 -1
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/core/PreParser.py +92 -36
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/core/warnings.py +32 -14
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/PKG-INFO +1 -1
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/SOURCES.txt +0 -2
- preparse-1.0.13.post1.dev0/src/preparse/_items/Option.py +0 -37
- preparse-1.0.13.post1.dev0/src/preparse/_utils/__init__.py +0 -3
- preparse-1.0.13.post1.dev0/src/preparse/_utils/dataprop.py +0 -23
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/LICENSE.txt +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/MANIFEST.in +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/README.rst +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/docs/v1.0.rst +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/setup.cfg +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/__init__.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_items/Item.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_items/Special.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_items/__init__.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/deparsing.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/digesting.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/parsing.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/pulling.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/core/Click.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/core/Optdict.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/core/__init__.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/core/enums.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/py.typed +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/__init__.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/data.toml +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/expit.toml +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_data_toml.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_enums.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_expit_toml.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_optdict.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_preparser.py +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/dependency_links.txt +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/requires.txt +0 -0
- {preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/top_level.txt +0 -0
|
@@ -6,7 +6,6 @@ import setdoc
|
|
|
6
6
|
|
|
7
7
|
from preparse._items.Item import Item
|
|
8
8
|
from preparse._items.Option import Option
|
|
9
|
-
from preparse._utils.dataprop import dataprop
|
|
10
9
|
from preparse.core.enums import Nargs, Tuning
|
|
11
10
|
|
|
12
11
|
|
|
@@ -61,9 +60,14 @@ class Bundle(Option):
|
|
|
61
60
|
x = x[:-1]
|
|
62
61
|
return ans
|
|
63
62
|
|
|
64
|
-
@
|
|
65
|
-
def chars(self: Self
|
|
66
|
-
return
|
|
63
|
+
@property
|
|
64
|
+
def chars(self: Self) -> str:
|
|
65
|
+
return self._data["chars"]
|
|
66
|
+
|
|
67
|
+
@chars.setter
|
|
68
|
+
def chars(self: Self, x: Any) -> None:
|
|
69
|
+
self._data = getattr(self, "_data", dict())
|
|
70
|
+
self._data["chars"] = str(x)
|
|
67
71
|
|
|
68
72
|
def deparse(self: Self) -> list[str]:
|
|
69
73
|
if self.right is None:
|
|
@@ -6,7 +6,6 @@ from typing import Any, Self, SupportsIndex
|
|
|
6
6
|
import setdoc
|
|
7
7
|
|
|
8
8
|
from preparse._items.Option import Option
|
|
9
|
-
from preparse._utils.dataprop import dataprop
|
|
10
9
|
from preparse.core.enums import Nargs, Tuning
|
|
11
10
|
|
|
12
11
|
|
|
@@ -39,10 +38,17 @@ class Long(Option):
|
|
|
39
38
|
def abbr(self: Self) -> str:
|
|
40
39
|
return self.fullkey[: self.abbrlen]
|
|
41
40
|
|
|
42
|
-
@
|
|
43
|
-
def abbrlen(self: Self
|
|
41
|
+
@property
|
|
42
|
+
def abbrlen(self: Self) -> int | None:
|
|
43
|
+
return self._data["abbrlen"]
|
|
44
|
+
|
|
45
|
+
@abbrlen.setter
|
|
46
|
+
def abbrlen(self: Self, x: SupportsIndex | None) -> None:
|
|
47
|
+
self._data = getattr(self, "_data", dict())
|
|
44
48
|
if x is not None:
|
|
45
|
-
|
|
49
|
+
self._data["abbrlen"] = operator.index(x)
|
|
50
|
+
else:
|
|
51
|
+
self._data["abbrlen"] = None
|
|
46
52
|
|
|
47
53
|
def deparse(self: Self) -> list[str]:
|
|
48
54
|
if self.right is None:
|
|
@@ -52,6 +58,11 @@ class Long(Option):
|
|
|
52
58
|
else:
|
|
53
59
|
return [self.abbr, self.right]
|
|
54
60
|
|
|
55
|
-
@
|
|
56
|
-
def fullkey(self: Self
|
|
57
|
-
return
|
|
61
|
+
@property
|
|
62
|
+
def fullkey(self: Self) -> str:
|
|
63
|
+
return self._data["fullkey"]
|
|
64
|
+
|
|
65
|
+
@fullkey.setter
|
|
66
|
+
def fullkey(self: Self, x: Any) -> None:
|
|
67
|
+
self._data = getattr(self, "_data", dict())
|
|
68
|
+
self._data["fullkey"] = str(x)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
__all__: list[str] = ["Option"]
|
|
2
|
+
|
|
3
|
+
import operator
|
|
4
|
+
from typing import Any, Self, SupportsIndex
|
|
5
|
+
|
|
6
|
+
from preparse._items.Item import Item
|
|
7
|
+
from preparse.core.enums import Nargs, Tuning
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Option(Item):
|
|
11
|
+
|
|
12
|
+
joined: bool
|
|
13
|
+
nargs: Nargs
|
|
14
|
+
right: str | None
|
|
15
|
+
|
|
16
|
+
__slots__ = ()
|
|
17
|
+
|
|
18
|
+
def ishungry(self: Self) -> bool:
|
|
19
|
+
return (self.right is None) and (self.nargs == Nargs.REQUIRED_ARGUMENT)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def joined(self: Self) -> bool:
|
|
23
|
+
return self._data["joined"]
|
|
24
|
+
|
|
25
|
+
@joined.setter
|
|
26
|
+
def joined(self: Self, x: SupportsIndex) -> None:
|
|
27
|
+
self._data = getattr(self, "_data", dict())
|
|
28
|
+
self._data["joined"] = bool(operator.index(x))
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def nargs(self: Self) -> Nargs:
|
|
32
|
+
return self._data["nargs"]
|
|
33
|
+
|
|
34
|
+
@nargs.setter
|
|
35
|
+
def nargs(self: Self, x: Any) -> None:
|
|
36
|
+
self._data = getattr(self, "_data", dict())
|
|
37
|
+
self._data["nargs"] = Nargs(x)
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def right(self: Self) -> str | None:
|
|
41
|
+
return self._data["right"]
|
|
42
|
+
|
|
43
|
+
@right.setter
|
|
44
|
+
def right(self: Self, x: Any) -> None:
|
|
45
|
+
self._data = getattr(self, "_data", dict())
|
|
46
|
+
if x is not None:
|
|
47
|
+
self._data["right"] = str(x)
|
|
48
|
+
else:
|
|
49
|
+
self._data["right"] = None
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def sortkey(cls: type[Self]) -> int:
|
|
53
|
+
return 0
|
|
@@ -5,7 +5,6 @@ from typing import Any, Self
|
|
|
5
5
|
import setdoc
|
|
6
6
|
|
|
7
7
|
from preparse._items.Item import Item
|
|
8
|
-
from preparse._utils.dataprop import dataprop
|
|
9
8
|
from preparse.core.enums import Nargs, Tuning
|
|
10
9
|
|
|
11
10
|
|
|
@@ -29,6 +28,11 @@ class Positional(Item):
|
|
|
29
28
|
def sortkey(cls: type[Self]) -> int:
|
|
30
29
|
return 2
|
|
31
30
|
|
|
32
|
-
@
|
|
33
|
-
def value(self: Self
|
|
34
|
-
return
|
|
31
|
+
@property
|
|
32
|
+
def value(self: Self) -> str:
|
|
33
|
+
return self._data["value"]
|
|
34
|
+
|
|
35
|
+
@value.setter
|
|
36
|
+
def value(self: Self, x: Any) -> None:
|
|
37
|
+
self._data = getattr(self, "_data", dict())
|
|
38
|
+
self._data["value"] = str(x)
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/__init__.py
RENAMED
|
@@ -9,7 +9,6 @@ from preparse._processing.deparsing import deparse
|
|
|
9
9
|
from preparse._processing.digesting import digest
|
|
10
10
|
from preparse._processing.parsing import parse
|
|
11
11
|
from preparse._processing.pulling import pull
|
|
12
|
-
from preparse._utils import dataprop
|
|
13
12
|
from preparse.core.enums import Nargs, Tuning
|
|
14
13
|
|
|
15
14
|
|
|
@@ -15,7 +15,6 @@ from datarepr import datarepr
|
|
|
15
15
|
from tofunc import tofunc
|
|
16
16
|
|
|
17
17
|
from preparse._processing import process
|
|
18
|
-
from preparse._utils.dataprop import dataprop
|
|
19
18
|
from preparse.core.Click import Click
|
|
20
19
|
from preparse.core.enums import Nargs, Tuning
|
|
21
20
|
from preparse.core.Optdict import Optdict
|
|
@@ -76,18 +75,33 @@ class PreParser(Copyable):
|
|
|
76
75
|
def __repr__(self: Self) -> str:
|
|
77
76
|
return datarepr(type(self).__name__, **self.todict())
|
|
78
77
|
|
|
79
|
-
@
|
|
80
|
-
def allowslong(self: Self
|
|
81
|
-
return
|
|
78
|
+
@property
|
|
79
|
+
def allowslong(self: Self) -> bool:
|
|
80
|
+
return self._data["allowslong"]
|
|
82
81
|
|
|
83
|
-
@
|
|
84
|
-
def
|
|
85
|
-
|
|
82
|
+
@allowslong.setter
|
|
83
|
+
def allowslong(self: Self, value: Any) -> None:
|
|
84
|
+
self._data = getattr(self, "_data", dict())
|
|
85
|
+
self._data["allowslong"] = bool(value)
|
|
86
86
|
|
|
87
|
-
@
|
|
88
|
-
def
|
|
87
|
+
@property
|
|
88
|
+
def allowsshort(self: Self) -> bool:
|
|
89
|
+
return self._data["allowsshort"]
|
|
90
|
+
|
|
91
|
+
@allowsshort.setter
|
|
92
|
+
def allowsshort(self: Self, value: Any) -> None:
|
|
93
|
+
self._data = getattr(self, "_data", dict())
|
|
94
|
+
self._data["allowsshort"] = bool(value)
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def bundling(self: Self) -> Tuning:
|
|
89
98
|
"This property decides how to approach the bundling of short options."
|
|
90
|
-
return
|
|
99
|
+
return self._data["bundling"]
|
|
100
|
+
|
|
101
|
+
@bundling.setter
|
|
102
|
+
def bundling(self: Self, value: Any) -> None:
|
|
103
|
+
self._data = getattr(self, "_data", dict())
|
|
104
|
+
self._data["bundling"] = Tuning(value)
|
|
91
105
|
|
|
92
106
|
def click(self: Self, cmd: Any = True, ctx: Any = True) -> Click:
|
|
93
107
|
"This method returns a decorator that infuses the current instance into parse_args."
|
|
@@ -97,31 +111,53 @@ class PreParser(Copyable):
|
|
|
97
111
|
def copy(self: Self) -> Self:
|
|
98
112
|
return type(self)(**self.todict())
|
|
99
113
|
|
|
100
|
-
@
|
|
101
|
-
def expandsabbr(self: Self
|
|
102
|
-
return
|
|
114
|
+
@property
|
|
115
|
+
def expandsabbr(self: Self) -> bool:
|
|
116
|
+
return self._data["expandsabbr"]
|
|
117
|
+
|
|
118
|
+
@expandsabbr.setter
|
|
119
|
+
def expandsabbr(self: Self, value: Any) -> None:
|
|
120
|
+
self._data = getattr(self, "_data", dict())
|
|
121
|
+
self._data["expandsabbr"] = bool(value)
|
|
103
122
|
|
|
104
|
-
@
|
|
105
|
-
def expectsabbr(self: Self
|
|
106
|
-
return
|
|
123
|
+
@property
|
|
124
|
+
def expectsabbr(self: Self) -> bool:
|
|
125
|
+
return self._data["expectsabbr"]
|
|
107
126
|
|
|
108
|
-
@
|
|
109
|
-
def
|
|
127
|
+
@expectsabbr.setter
|
|
128
|
+
def expectsabbr(self: Self, value: Any) -> None:
|
|
129
|
+
self._data = getattr(self, "_data", dict())
|
|
130
|
+
self._data["expectsabbr"] = bool(value)
|
|
131
|
+
|
|
132
|
+
@property
|
|
133
|
+
def expectsposix(self: Self) -> bool:
|
|
134
|
+
return self._data["expectsposix"]
|
|
135
|
+
|
|
136
|
+
@expectsposix.setter
|
|
137
|
+
def expectsposix(self: Self, value: Any) -> None:
|
|
138
|
+
self._data = getattr(self, "_data", dict())
|
|
110
139
|
if value == "infer":
|
|
111
|
-
|
|
140
|
+
self._data["expectsposix"] = bool(
|
|
141
|
+
os.environ.get("POSIXLY_CORRECT")
|
|
142
|
+
)
|
|
112
143
|
else:
|
|
113
|
-
|
|
144
|
+
self._data["expectsposix"] = bool(value)
|
|
114
145
|
|
|
115
|
-
@
|
|
116
|
-
def optdict(self: Self
|
|
146
|
+
@property
|
|
147
|
+
def optdict(self: Self) -> Optdict:
|
|
117
148
|
"This property gives a dictionary of options."
|
|
149
|
+
return self._data["optdict"]
|
|
150
|
+
|
|
151
|
+
@optdict.setter
|
|
152
|
+
def optdict(self: Self, value: Any) -> None:
|
|
118
153
|
dataA: Optdict
|
|
154
|
+
self._data = getattr(self, "_data", dict())
|
|
119
155
|
if "optdict" not in self._data.keys():
|
|
120
156
|
self._data["optdict"] = Optdict()
|
|
121
157
|
dataA = Optdict(value)
|
|
122
158
|
self._data["optdict"].clear()
|
|
123
159
|
self._data["optdict"].update(dataA)
|
|
124
|
-
|
|
160
|
+
self._data["optdict"] = self._data["optdict"]
|
|
125
161
|
|
|
126
162
|
def parse_args(
|
|
127
163
|
self: Self,
|
|
@@ -130,17 +166,27 @@ class PreParser(Copyable):
|
|
|
130
166
|
"This method parses args."
|
|
131
167
|
return process(args, **self.todict())
|
|
132
168
|
|
|
133
|
-
@
|
|
134
|
-
def prog(self: Self
|
|
169
|
+
@property
|
|
170
|
+
def prog(self: Self) -> str:
|
|
135
171
|
"This property represents the name of the program."
|
|
172
|
+
return self._data["prog"]
|
|
173
|
+
|
|
174
|
+
@prog.setter
|
|
175
|
+
def prog(self: Self, value: Any) -> None:
|
|
176
|
+
self._data = getattr(self, "_data", dict())
|
|
136
177
|
if value is None:
|
|
137
|
-
|
|
178
|
+
self._data["prog"] = str(os.path.basename(sys.argv[0]))
|
|
138
179
|
else:
|
|
139
|
-
|
|
180
|
+
self._data["prog"] = str(value)
|
|
140
181
|
|
|
141
|
-
@
|
|
142
|
-
def reconcilesorders(self: Self
|
|
143
|
-
return
|
|
182
|
+
@property
|
|
183
|
+
def reconcilesorders(self: Self) -> bool:
|
|
184
|
+
return self._data["reconcilesorders"]
|
|
185
|
+
|
|
186
|
+
@reconcilesorders.setter
|
|
187
|
+
def reconcilesorders(self: Self, value: Any) -> None:
|
|
188
|
+
self._data = getattr(self, "_data", dict())
|
|
189
|
+
self._data["reconcilesorders"] = bool(value)
|
|
144
190
|
|
|
145
191
|
def reflectClickCommand(self: Self, cmd: cl.Command) -> None:
|
|
146
192
|
"This method causes the current instance to reflect a click.Command object."
|
|
@@ -167,10 +213,15 @@ class PreParser(Copyable):
|
|
|
167
213
|
"This method causes the current instance to reflect a click.Context object."
|
|
168
214
|
self.prog = ctx.info_name
|
|
169
215
|
|
|
170
|
-
@
|
|
171
|
-
def special(self: Self
|
|
216
|
+
@property
|
|
217
|
+
def special(self: Self) -> Tuning:
|
|
172
218
|
"This Tuning property determines the approach towards the special argument."
|
|
173
|
-
return
|
|
219
|
+
return self._data["special"]
|
|
220
|
+
|
|
221
|
+
@special.setter
|
|
222
|
+
def special(self: Self, value: Any) -> None:
|
|
223
|
+
self._data = getattr(self, "_data", dict())
|
|
224
|
+
self._data["special"] = Tuning(value)
|
|
174
225
|
|
|
175
226
|
def todict(self: Self) -> dict[str, Any]:
|
|
176
227
|
"This method returns a dict representing the current instance."
|
|
@@ -183,7 +234,12 @@ class PreParser(Copyable):
|
|
|
183
234
|
else:
|
|
184
235
|
return dict(ans)
|
|
185
236
|
|
|
186
|
-
@
|
|
187
|
-
def warn(self: Self
|
|
237
|
+
@property
|
|
238
|
+
def warn(self: Self) -> types.FunctionType:
|
|
188
239
|
"This property gives a function that takes in the warnings."
|
|
189
|
-
return
|
|
240
|
+
return self._data["warn"]
|
|
241
|
+
|
|
242
|
+
@warn.setter
|
|
243
|
+
def warn(self: Self, value: Callable[..., Any]) -> None:
|
|
244
|
+
self._data = getattr(self, "_data", dict())
|
|
245
|
+
self._data["warn"] = tofunc(value)
|
|
@@ -14,8 +14,6 @@ import setdoc
|
|
|
14
14
|
from copyable import Copyable
|
|
15
15
|
from datarepr import datarepr
|
|
16
16
|
|
|
17
|
-
from preparse._utils import dataprop
|
|
18
|
-
|
|
19
17
|
|
|
20
18
|
class PreparseWarning(Warning, Copyable):
|
|
21
19
|
args: tuple[str]
|
|
@@ -42,13 +40,23 @@ class PreparseWarning(Warning, Copyable):
|
|
|
42
40
|
@abstractmethod
|
|
43
41
|
def getmsg(self: Self) -> str: ...
|
|
44
42
|
|
|
45
|
-
@
|
|
46
|
-
def option(self: Self
|
|
47
|
-
return
|
|
43
|
+
@property
|
|
44
|
+
def option(self: Self) -> str:
|
|
45
|
+
return self._data["option"]
|
|
46
|
+
|
|
47
|
+
@option.setter
|
|
48
|
+
def option(self: Self, value: Any) -> None:
|
|
49
|
+
self._data = getattr(self, "_data", dict())
|
|
50
|
+
self._data["option"] = str(value)
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def prog(self: Self) -> str:
|
|
54
|
+
return self._data["prog"]
|
|
48
55
|
|
|
49
|
-
@
|
|
50
|
-
def prog(self: Self, value: Any) ->
|
|
51
|
-
|
|
56
|
+
@prog.setter
|
|
57
|
+
def prog(self: Self, value: Any) -> None:
|
|
58
|
+
self._data = getattr(self, "_data", dict())
|
|
59
|
+
self._data["prog"] = str(value)
|
|
52
60
|
|
|
53
61
|
def todict(self: Self) -> dict[str, Any]:
|
|
54
62
|
"This method returns a dict representing the current instance."
|
|
@@ -81,9 +89,14 @@ class PreparseDualWarning(PreparseWarning):
|
|
|
81
89
|
else:
|
|
82
90
|
return type(self)._shortmsg % self.option
|
|
83
91
|
|
|
84
|
-
@
|
|
85
|
-
def islong(self: Self
|
|
86
|
-
return
|
|
92
|
+
@property
|
|
93
|
+
def islong(self: Self) -> bool:
|
|
94
|
+
return self._data["islong"]
|
|
95
|
+
|
|
96
|
+
@islong.setter
|
|
97
|
+
def islong(self: Self, value: Any) -> None:
|
|
98
|
+
self._data = getattr(self, "_data", dict())
|
|
99
|
+
self._data["islong"] = bool(value)
|
|
87
100
|
|
|
88
101
|
|
|
89
102
|
class PreparseInvalidOptionWarning(PreparseDualWarning):
|
|
@@ -132,9 +145,14 @@ class PreparseAmbiguousOptionWarning(PreparseLongonlyWarning):
|
|
|
132
145
|
ans += " '%s'" % x
|
|
133
146
|
return ans
|
|
134
147
|
|
|
135
|
-
@
|
|
136
|
-
def possibilities(self: Self
|
|
137
|
-
return
|
|
148
|
+
@property
|
|
149
|
+
def possibilities(self: Self) -> tuple[str, ...]:
|
|
150
|
+
return self._data["possibilities"]
|
|
151
|
+
|
|
152
|
+
@possibilities.setter
|
|
153
|
+
def possibilities(self: Self, value: Iterable[Any]) -> None:
|
|
154
|
+
self._data = getattr(self, "_data", dict())
|
|
155
|
+
self._data["possibilities"] = tuple(map(str, value))
|
|
138
156
|
|
|
139
157
|
|
|
140
158
|
class PreparseUnallowedArgumentWarning(PreparseLongonlyWarning):
|
|
@@ -23,8 +23,6 @@ src/preparse/_processing/deparsing.py
|
|
|
23
23
|
src/preparse/_processing/digesting.py
|
|
24
24
|
src/preparse/_processing/parsing.py
|
|
25
25
|
src/preparse/_processing/pulling.py
|
|
26
|
-
src/preparse/_utils/__init__.py
|
|
27
|
-
src/preparse/_utils/dataprop.py
|
|
28
26
|
src/preparse/core/Click.py
|
|
29
27
|
src/preparse/core/Optdict.py
|
|
30
28
|
src/preparse/core/PreParser.py
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
__all__: list[str] = ["Option"]
|
|
2
|
-
|
|
3
|
-
import operator
|
|
4
|
-
from typing import Any, Self, SupportsIndex
|
|
5
|
-
|
|
6
|
-
from preparse._items.Item import Item
|
|
7
|
-
from preparse._utils.dataprop import dataprop
|
|
8
|
-
from preparse.core.enums import Nargs, Tuning
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Option(Item):
|
|
12
|
-
|
|
13
|
-
joined: bool
|
|
14
|
-
nargs: Nargs
|
|
15
|
-
right: str | None
|
|
16
|
-
|
|
17
|
-
__slots__ = ()
|
|
18
|
-
|
|
19
|
-
def ishungry(self: Self) -> bool:
|
|
20
|
-
return (self.right is None) and (self.nargs == Nargs.REQUIRED_ARGUMENT)
|
|
21
|
-
|
|
22
|
-
@dataprop
|
|
23
|
-
def joined(self: Self, x: SupportsIndex) -> bool:
|
|
24
|
-
return bool(operator.index(x))
|
|
25
|
-
|
|
26
|
-
@dataprop
|
|
27
|
-
def nargs(self: Self, x: Any) -> Nargs:
|
|
28
|
-
return Nargs(x)
|
|
29
|
-
|
|
30
|
-
@dataprop
|
|
31
|
-
def right(self: Self, x: Any) -> str | None:
|
|
32
|
-
if x is not None:
|
|
33
|
-
return str(x)
|
|
34
|
-
|
|
35
|
-
@classmethod
|
|
36
|
-
def sortkey(cls: type[Self]) -> int:
|
|
37
|
-
return 0
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
__all__: list[str] = ["dataprop"]
|
|
2
|
-
|
|
3
|
-
from collections.abc import Callable
|
|
4
|
-
from typing import Any, Self
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def dataprop(func: Callable[..., Any]) -> property:
|
|
8
|
-
"This magic method implements calling the current instance."
|
|
9
|
-
|
|
10
|
-
kwargs: dict[str, Any]
|
|
11
|
-
|
|
12
|
-
def fget(self: Self) -> Any:
|
|
13
|
-
return self._data[func.__name__]
|
|
14
|
-
|
|
15
|
-
def fset(self: Self, value: Any) -> None:
|
|
16
|
-
self._data = getattr(self, "_data", dict())
|
|
17
|
-
self._data[func.__name__] = func(self, value)
|
|
18
|
-
|
|
19
|
-
kwargs = dict()
|
|
20
|
-
kwargs["doc"] = func.__doc__
|
|
21
|
-
kwargs["fget"] = fget
|
|
22
|
-
kwargs["fset"] = fset
|
|
23
|
-
return property(**kwargs)
|
|
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
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/deparsing.py
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/digesting.py
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/parsing.py
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/_processing/pulling.py
RENAMED
|
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
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_data_toml.py
RENAMED
|
File without changes
|
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_expit_toml.py
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_optdict.py
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse/tests/test_preparser.py
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/requires.txt
RENAMED
|
File without changes
|
{preparse-1.0.13.post1.dev0 → preparse-1.0.13.post1.dev1}/src/preparse.egg-info/top_level.txt
RENAMED
|
File without changes
|