replbase 0.0.45__tar.gz → 0.0.47__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.
- {replbase-0.0.45 → replbase-0.0.47}/PKG-INFO +1 -1
- {replbase-0.0.45 → replbase-0.0.47}/pyproject.toml +1 -1
- {replbase-0.0.45 → replbase-0.0.47}/replbase/cmd_meta.py +24 -17
- {replbase-0.0.45 → replbase-0.0.47}/LICENSE +0 -0
- {replbase-0.0.45 → replbase-0.0.47}/README.md +0 -0
- {replbase-0.0.45 → replbase-0.0.47}/replbase/__init__.py +0 -0
- {replbase-0.0.45 → replbase-0.0.47}/replbase/repl_base.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "replbase"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.47"
|
|
8
8
|
description = "\"Combination of other REPL tools into a reusable class that generates a REPL\""
|
|
9
9
|
authors = [ "Joseph Bochinski <stirgejr@gmail.com>",]
|
|
10
10
|
license = "MIT"
|
|
@@ -203,31 +203,38 @@ class CommandMeta:
|
|
|
203
203
|
return repl_cmd
|
|
204
204
|
|
|
205
205
|
for arg, parm in self.sig_parms.items():
|
|
206
|
-
|
|
206
|
+
try:
|
|
207
|
+
arg_type = self.type_hints.get(arg, str)
|
|
207
208
|
|
|
208
|
-
|
|
209
|
+
flag_name = self.flag_names.get(arg)
|
|
209
210
|
|
|
210
|
-
|
|
211
|
+
cmd_init = {"help": self.args.get(arg)}
|
|
211
212
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
if arg_type == bool:
|
|
214
|
+
cmd_init["action"] = (
|
|
215
|
+
"store_false" if parm.default is True else "store_true"
|
|
216
|
+
)
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
if arg_type not in [str, bool]:
|
|
219
|
+
cmd_init["type"] = arg_type
|
|
219
220
|
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
if isinstance(arg_type, type) and isinstance(
|
|
222
|
+
parm.default, arg_type
|
|
223
|
+
):
|
|
224
|
+
cmd_init["default"] = parm.default
|
|
222
225
|
|
|
223
|
-
|
|
224
|
-
|
|
226
|
+
if isinstance(arg_type, list):
|
|
227
|
+
cmd_init["nargs"] = "+"
|
|
225
228
|
|
|
226
|
-
|
|
227
|
-
|
|
229
|
+
if cmd_init:
|
|
230
|
+
repl_cmd.parser.add_argument(flag_name, **cmd_init)
|
|
228
231
|
|
|
229
|
-
|
|
230
|
-
|
|
232
|
+
else:
|
|
233
|
+
repl_cmd.parser.add_argument(flag_name)
|
|
234
|
+
except TypeError as e:
|
|
235
|
+
print(
|
|
236
|
+
f"[ERROR]: {e} for:\n{self.func.__name__}.{arg} with {arg_type} and {parm.default}"
|
|
237
|
+
)
|
|
231
238
|
|
|
232
239
|
return repl_cmd
|
|
233
240
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|