$47 GRAYBYTE WORDPRESS FILE MANAGER $84

SERVER : in-mum-web1330.main-hosting.eu #1 SMP Mon Feb 10 22:45:17 UTC 2025
SERVER IP : 93.127.173.207 | ADMIN IP 216.73.216.63
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python311/lib/python3.11/site-packages/typish/

HOME
Current File : /opt/alt/python311/lib/python3.11/site-packages/typish//_state.py
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)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
5 Sep 2025 9.32 AM
root / 996
0755
__pycache__
--
8 May 2024 6.34 PM
root / root
0755
classes
--
8 May 2024 6.34 PM
root / root
0755
decorators
--
8 May 2024 6.34 PM
root / root
0755
functions
--
8 May 2024 6.34 PM
root / root
0755
__init__.py
1.452 KB
8 May 2024 6.34 PM
root / root
0644
_classes.py
11.346 KB
8 May 2024 6.34 PM
root / root
0644
_decorators.py
0.717 KB
8 May 2024 6.34 PM
root / root
0644
_functions.py
15.254 KB
8 May 2024 6.34 PM
root / root
0644
_meta.py
0.239 KB
8 May 2024 6.34 PM
root / root
0644
_state.py
1.271 KB
8 May 2024 6.34 PM
root / root
0644
_types.py
0.436 KB
8 May 2024 6.34 PM
root / root
0644
effe.py
0.821 KB
8 May 2024 6.34 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF