1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
from enum import auto
from types import FunctionType, ModuleType
from typing import overload, Literal, Callable, TypedDict
from .line_profiler_utils import StringEnum
class ScopingPolicy(StringEnum):
CHILDREN = auto()
DESCENDANTS = auto()
SIBLINGS = auto()
NONE = auto()
@overload
def get_filter(
self,
namespace: type | ModuleType,
obj_type: Literal['func']) -> Callable[[FunctionType], bool]:
...
@overload
def get_filter(
self,
namespace: type | ModuleType,
obj_type: Literal['class']) -> Callable[[type], bool]:
...
@overload
def get_filter(
self,
namespace: type | ModuleType,
obj_type: Literal['module']) -> Callable[[ModuleType], bool]:
...
@classmethod
def to_policies(
cls,
policies: (str | 'ScopingPolicy' | 'ScopingPolicyDict'
| None) = None) -> '_ScopingPolicyDict':
...
ScopingPolicyDict = TypedDict('ScopingPolicyDict',
{'func': str | ScopingPolicy,
'class': str | ScopingPolicy,
'module': str | ScopingPolicy})
_ScopingPolicyDict = TypedDict('_ScopingPolicyDict',
{'func': str | ScopingPolicy,
'class': str | ScopingPolicy,
'module': str | ScopingPolicy})
|