typedparser 0.33.2__tar.gz → 0.33.4__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.4
2
2
  Name: typedparser
3
- Version: 0.33.2
3
+ Version: 0.33.4
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
@@ -25,4 +25,4 @@ __all__ = [
25
25
  ]
26
26
 
27
27
 
28
- __version__ = "0.33.2"
28
+ __version__ = "0.33.4"
@@ -10,12 +10,26 @@ from importlib import util as import_util
10
10
  from importlib.machinery import ModuleSpec
11
11
  from os import path
12
12
  from pkgutil import iter_modules
13
+ import traceback
13
14
  from typing import Any, Iterator, List, Optional, Tuple, Union
14
15
  import sysconfig
15
16
  import site
16
17
  from importlib.metadata import distributions
17
18
 
18
- from packg import format_exception
19
+
20
+ def format_exception(e, with_traceback=False) -> str:
21
+ error_str, error_name = str(e), type(e).__name__
22
+ if error_str == "":
23
+ out_str = error_name
24
+ else:
25
+ out_str = f"{error_name}: {error_str}"
26
+
27
+ if not with_traceback:
28
+ return out_str
29
+
30
+ tb_list = traceback.format_tb(e.__traceback__)
31
+ tb_str = "".join(tb_list)
32
+ return f"{tb_str}{out_str}"
19
33
 
20
34
 
21
35
  def get_installed_top_level_packages() -> list[str]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: typedparser
3
- Version: 0.33.2
3
+ Version: 0.33.4
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
File without changes
File without changes
File without changes