OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python311
/
lib
/
python3.11
/
site-packages
/
typish
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
09/05/2025 09:34:01 AM
rwxr-xr-x
📄
__init__.py
1.45 KB
05/08/2024 06:42:59 PM
rw-r--r--
📁
__pycache__
-
05/08/2024 06:42:59 PM
rwxr-xr-x
📄
_classes.py
11.35 KB
05/08/2024 06:42:59 PM
rw-r--r--
📄
_decorators.py
734 bytes
05/08/2024 06:42:59 PM
rw-r--r--
📄
_functions.py
15.25 KB
05/08/2024 06:42:59 PM
rw-r--r--
📄
_meta.py
245 bytes
05/08/2024 06:42:59 PM
rw-r--r--
📄
_state.py
1.27 KB
05/08/2024 06:42:59 PM
rw-r--r--
📄
_types.py
446 bytes
05/08/2024 06:42:59 PM
rw-r--r--
📁
classes
-
05/08/2024 06:42:59 PM
rwxr-xr-x
📁
decorators
-
05/08/2024 06:42:59 PM
rwxr-xr-x
📄
effe.py
841 bytes
05/08/2024 06:42:59 PM
rw-r--r--
📁
functions
-
05/08/2024 06:42:59 PM
rwxr-xr-x
Editing: _state.py
Close
from typing import Callable from typish import T class State: """ A class which instances hold any state that may be used by typish. """ def __init__(self) -> None: """ Constructor. """ self.get_type_per_cls = {} def register_get_type( self, cls: T, get_type_function: Callable[[T], type]) -> None: """ Register a callable for some type that is to be used when calling typish.get_type. :param cls: the type for which that given callable is to be called. :param get_type_function: the callable to call for that type. :return: None. """ self.get_type_per_cls[cls] = get_type_function DEFAULT = State() def register_get_type( cls: T, get_type_function: Callable[[T], type], state: State = DEFAULT) -> None: """ Register a callable for some type that is to be used when calling typish.get_type. :param cls: the type for which that given callable is to be called. :param get_type_function: the callable to call for that type. :param state: any state that is used by typish. :return: None. """ state.register_get_type(cls, get_type_function)