replbase 0.0.68__tar.gz → 0.0.70__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.68
3
+ Version: 0.0.70
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.68"
7
+ version = "0.0.70"
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"
@@ -3,6 +3,7 @@
3
3
  import argparse
4
4
  import inspect
5
5
  import re
6
+ import traceback
6
7
 
7
8
  from collections import defaultdict
8
9
  from collections.abc import Callable
@@ -285,9 +286,11 @@ class CommandMeta:
285
286
 
286
287
  else:
287
288
  repl_cmd.parser.add_argument(*flag_names)
288
- except TypeError as e:
289
+ except TypeError:
290
+ err_details = traceback.format_exc()
291
+
289
292
  print(
290
- f"[ERROR]: {e} for:\n{self.func.__name__}.{arg} with {arg_type} and {parm.default}"
293
+ f"[ERROR]: {err_details} for:\n{self.func.__name__}.{arg} with {arg_type} and {parm.default}"
291
294
  )
292
295
 
293
296
  return repl_cmd
@@ -328,7 +331,7 @@ class CommandMeta:
328
331
  flags[arg].append(f"-{char.upper()}")
329
332
  self.used_flags.add(char.upper())
330
333
 
331
- self.flag_names[arg] = [flags]
334
+ self.flag_names[arg] = flags
332
335
 
333
336
  def parse_lines(self) -> None:
334
337
  """Parse the lines of the docstring into the appropriate sections"""
@@ -500,6 +500,29 @@ class ReplBase:
500
500
  for name in cmd_names:
501
501
  self.gen_command(name, hyphenate=hyphenate)
502
502
 
503
+ def get_local_funcs(self, tgt_cls: type = None) -> list[str]:
504
+ """Retrieve a list of local functions for this class
505
+
506
+ Returns:
507
+ list[str]: List of function names
508
+ """
509
+
510
+ base_funcs = [
511
+ name
512
+ for name in dir(ReplBase)
513
+ if callable(getattr(ReplBase, name)) and not name.startswith("_")
514
+ ]
515
+
516
+ tgt_cls = tgt_cls or self.__class__
517
+
518
+ return [
519
+ name
520
+ for name in dir(tgt_cls)
521
+ if callable(getattr(tgt_cls, name))
522
+ and not name.startswith("_")
523
+ and name not in base_funcs
524
+ ]
525
+
503
526
  def warn(self, msg: str) -> None:
504
527
  """Print a message to the REPL preformatted as a warning"""
505
528
 
File without changes
File without changes