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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: replbase
3
- Version: 0.0.45
3
+ Version: 0.0.47
4
4
  Summary: "Combination of other REPL tools into a reusable class that generates a REPL"
5
5
  License: MIT
6
6
  Author: Joseph Bochinski
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "replbase"
7
- version = "0.0.45"
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
- arg_type = self.type_hints.get(arg, str)
206
+ try:
207
+ arg_type = self.type_hints.get(arg, str)
207
208
 
208
- flag_name = self.flag_names.get(arg)
209
+ flag_name = self.flag_names.get(arg)
209
210
 
210
- cmd_init = {"help": self.args.get(arg)}
211
+ cmd_init = {"help": self.args.get(arg)}
211
212
 
212
- if arg_type == bool:
213
- cmd_init["action"] = (
214
- "store_false" if parm.default is True else "store_true"
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
- if arg_type not in [str, bool]:
218
- cmd_init["type"] = arg_type
218
+ if arg_type not in [str, bool]:
219
+ cmd_init["type"] = arg_type
219
220
 
220
- if isinstance(arg_type, type) and isinstance(parm.default, arg_type):
221
- cmd_init["default"] = parm.default
221
+ if isinstance(arg_type, type) and isinstance(
222
+ parm.default, arg_type
223
+ ):
224
+ cmd_init["default"] = parm.default
222
225
 
223
- if isinstance(arg_type, list):
224
- cmd_init["nargs"] = "+"
226
+ if isinstance(arg_type, list):
227
+ cmd_init["nargs"] = "+"
225
228
 
226
- if cmd_init:
227
- repl_cmd.parser.add_argument(flag_name, **cmd_init)
229
+ if cmd_init:
230
+ repl_cmd.parser.add_argument(flag_name, **cmd_init)
228
231
 
229
- else:
230
- repl_cmd.parser.add_argument(flag_name)
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