1#!/usr/bin/env python3
2"""
3
4"""
5# Imports:
6from __future__ import annotations
7
8# ##-- types
9# isort: off
10# General
11import abc
12import collections.abc
13import typing
14import types
15from typing import cast, assert_type, assert_never
16from typing import Generic, NewType, Never
17from typing import no_type_check, final, override, overload
18# Protocols and Interfaces:
19from typing import Protocol, runtime_checkable
20# isort: on
21# ##-- end types
22
23# ##-- type checking
24# isort: off
25if typing.TYPE_CHECKING:
26 from typing import Final, ClassVar, Any, Self
27 from typing import Literal, LiteralString
28 from typing import TypeGuard
29 from collections.abc import Iterable, Iterator, Callable, Generator
30 from collections.abc import Sequence, Mapping, MutableMapping, Hashable
31
32 from jgdv import Maybe, Frame
33## isort: on
34# ##-- end type checking
35
36# Vars:
37DEL_LOG_K : Final[str] = "_log_del_active"
38DEFAULT_LOG_LEVEL : Final[int] = 40
39DEFAULT_REPORT : Final[str] = "traceback"
40CHANGE_PREFIX : Final[str] = "+-:"
41DEFAULT_PREFIX : Final[str] = "--"
42
43type TraceEvent = (
44 Literal["call"]
45 | Literal["line"]
46 | Literal["return"]
47 | Literal["exception"]
48 | Literal["opcode"]
49)
50# Body:
51
[docs]
52class TraceFn_p(Protocol):
53 """ The protocol for functions for sys.settrace """
54
55 def __call__(self, frame:Frame, event:TraceEvent, arg:Any) -> Maybe[TraceFn_p]: ... # noqa: ANN401