Method: rich.traceback.Traceback.__init__
Calls: 18, Exceptions: 1, Paths: 3Back
Path 1: 11 calls (0.61)
None (11)
100 (11)
3 (11)
None (11)
False (11)
False (10) True (1)
True (11)
10 (11)
80 (11)
() (11)
100 (11)
1def __init__(
2 self,
3 trace: Optional[Trace] = None,
4 width: Optional[int] = 100,
5 extra_lines: int = 3,
6 theme: Optional[str] = None,
7 word_wrap: bool = False,
8 show_locals: bool = False,
9 indent_guides: bool = True,
10 locals_max_length: int = LOCALS_MAX_LENGTH,
11 locals_max_string: int = LOCALS_MAX_STRING,
12 suppress: Iterable[Union[str, ModuleType]] = (),
13 max_frames: int = 100,
14 ):
15 if trace is None:
16 exc_type, exc_value, traceback = sys.exc_info()
17 if exc_type is None or exc_value is None or traceback is None:
18 raise ValueError(
19 "Value for 'trace' required if not called in except: block"
20 )
21 trace = self.extract(
22 exc_type, exc_value, traceback, show_locals=show_locals
23 )
24 self.trace = trace
25 self.width = width
26 self.extra_lines = extra_lines
27 self.theme = Syntax.get_theme(theme or "ansi_dark")
28 self.word_wrap = word_wrap
29 self.show_locals = show_locals
30 self.indent_guides = indent_guides
31 self.locals_max_length = locals_max_length
32 self.locals_max_string = locals_max_string
33
34 self.suppress: Sequence[str] = []
35 for suppress_entity in suppress:
36 if not isinstance(suppress_entity, str):
37 assert (
38 suppress_entity.__file__ is not None
39 ), f"{suppress_entity!r} must be a module with '__file__' attribute"
40 path = os.path.dirname(suppress_entity.__file__)
41 else:
42 path = suppress_entity
43 path = os.path.normpath(os.path.abspath(path))
44 self.suppress.append(path)
45 self.max_frames = max(4, max_frames) if max_frames > 0 else 0
Path 2: 6 calls (0.33)
Trace (6)
None (5) 100 (1)
3 (4) 5 (2)
None (6)
True (5) False (1)
False (6)
True (6)
10 (6)
80 (6)
() (6)
100 (6)
1def __init__(
2 self,
3 trace: Optional[Trace] = None,
4 width: Optional[int] = 100,
5 extra_lines: int = 3,
6 theme: Optional[str] = None,
7 word_wrap: bool = False,
8 show_locals: bool = False,
9 indent_guides: bool = True,
10 locals_max_length: int = LOCALS_MAX_LENGTH,
11 locals_max_string: int = LOCALS_MAX_STRING,
12 suppress: Iterable[Union[str, ModuleType]] = (),
13 max_frames: int = 100,
14 ):
15 if trace is None:
16 exc_type, exc_value, traceback = sys.exc_info()
17 if exc_type is None or exc_value is None or traceback is None:
18 raise ValueError(
19 "Value for 'trace' required if not called in except: block"
20 )
21 trace = self.extract(
22 exc_type, exc_value, traceback, show_locals=show_locals
23 )
24 self.trace = trace
25 self.width = width
26 self.extra_lines = extra_lines
27 self.theme = Syntax.get_theme(theme or "ansi_dark")
28 self.word_wrap = word_wrap
29 self.show_locals = show_locals
30 self.indent_guides = indent_guides
31 self.locals_max_length = locals_max_length
32 self.locals_max_string = locals_max_string
33
34 self.suppress: Sequence[str] = []
35 for suppress_entity in suppress:
36 if not isinstance(suppress_entity, str):
37 assert (
38 suppress_entity.__file__ is not None
39 ), f"{suppress_entity!r} must be a module with '__file__' attribute"
40 path = os.path.dirname(suppress_entity.__file__)
41 else:
42 path = suppress_entity
43 path = os.path.normpath(os.path.abspath(path))
44 self.suppress.append(path)
45 self.max_frames = max(4, max_frames) if max_frames > 0 else 0
Path 3: 1 calls (0.06)
None (1)
100 (1)
3 (1)
None (1)
False (1)
False (1)
True (1)
10 (1)
80 (1)
() (1)
100 (1)
ValueError (1)
1def __init__(
2 self,
3 trace: Optional[Trace] = None,
4 width: Optional[int] = 100,
5 extra_lines: int = 3,
6 theme: Optional[str] = None,
7 word_wrap: bool = False,
8 show_locals: bool = False,
9 indent_guides: bool = True,
10 locals_max_length: int = LOCALS_MAX_LENGTH,
11 locals_max_string: int = LOCALS_MAX_STRING,
12 suppress: Iterable[Union[str, ModuleType]] = (),
13 max_frames: int = 100,
14 ):
15 if trace is None:
16 exc_type, exc_value, traceback = sys.exc_info()
17 if exc_type is None or exc_value is None or traceback is None:
18 raise ValueError(
19 "Value for 'trace' required if not called in except: block"
20 )
21 trace = self.extract(
22 exc_type, exc_value, traceback, show_locals=show_locals
23 )
24 self.trace = trace
25 self.width = width
26 self.extra_lines = extra_lines
27 self.theme = Syntax.get_theme(theme or "ansi_dark")
28 self.word_wrap = word_wrap
29 self.show_locals = show_locals
30 self.indent_guides = indent_guides
31 self.locals_max_length = locals_max_length
32 self.locals_max_string = locals_max_string
33
34 self.suppress: Sequence[str] = []
35 for suppress_entity in suppress:
36 if not isinstance(suppress_entity, str):
37 assert (
38 suppress_entity.__file__ is not None
39 ), f"{suppress_entity!r} must be a module with '__file__' attribute"
40 path = os.path.dirname(suppress_entity.__file__)
41 else:
42 path = suppress_entity
43 path = os.path.normpath(os.path.abspath(path))
44 self.suppress.append(path)
45 self.max_frames = max(4, max_frames) if max_frames > 0 else 0