fix: renaming methods to more logical ones

This commit is contained in:
rus07tam 2025-11-24 15:24:45 +00:00
parent e61dd387d4
commit 12c0f42f99

View file

@ -52,21 +52,21 @@ class UniqueType(type):
def map(
cls: type[T],
value: V | type[T] | T,
and_then: Callable[[V], R],
or_else: Callable[[type[T]], R],
or_else: Callable[[V], R],
and_then: Callable[[type[T]], R],
) -> R:
if value is cls or isinstance(value, cls):
return or_else(cls)
return and_then(value) # type: ignore
return and_then(cls)
return or_else(value) # type: ignore
def and_then(
def or_else(
cls: type[T], value: V | type[T] | T, func: Callable[[V], R]
) -> type[T] | R:
if value is cls or isinstance(value, cls):
return cls
return func(value) # type: ignore
def or_else(
def and_then(
cls: type[T], value: V | type[T] | T, func: Callable[[type[T]], R]
) -> R | V:
if value is cls or isinstance(value, cls):