Reference
Various type aliases.
AnyAsyncCallable = DynamicAsyncCallable[Any]
module-attribute
Represents any async callables async (...) -> Any
.
AnyAsyncContextManager = AsyncContextManager[Any]
module-attribute
Represents any async context managers.
AnyCallable = DynamicCallable[Any]
module-attribute
Represents any callables (...) -> Any
.
AnyContextManager = ContextManager[Any]
module-attribute
Represents any context managers.
AnyError = BaseException
module-attribute
Represents any errors.
AnyErrorType = Type[AnyError]
module-attribute
Represents any error types.
AnyErrorTypes = DynamicTuple[AnyErrorType]
module-attribute
Represents tuples of any error types (AnyErrorType, ...)
.
AnyIterable = Union[AsyncIterable[T], Iterable[T]]
module-attribute
Represents any iterable, async or not.
AnyIterator = Union[AsyncIterator[T], Iterator[T]]
module-attribute
Represents any iterator, async or not.
AnySelectors = AnyIterable[bool]
module-attribute
Represents any selectors, async or not.
AnySet = AbstractSet[T]
module-attribute
Represents any sets.
AnyTuple = DynamicTuple[Any]
module-attribute
Represents any tuples (Any, ...)
.
AnyType = Type[Any]
module-attribute
Represents any types.
AsyncBinary = Binary[T, U, Awaitable[R]]
module-attribute
Represents async binary functions async (T, U) -> R
.
AsyncCallable = Callable[P, Awaitable[R]]
module-attribute
Represents async callables async (P) -> R
.
AsyncCompare = AsyncBinary[T, U, bool]
module-attribute
Represents async comparison functions async (T, U) -> bool
.
AsyncForEach = AsyncUnary[T, None]
module-attribute
Represents async for-each functions async (T)
.
AsyncGenericPredicate = AsyncCallable[P, bool]
module-attribute
Represents async generic predicates async (P) -> bool
.
AsyncIdentity = AsyncUnary[T, T]
module-attribute
Represents async identity functions async (T) -> T
.
AsyncInspect = AsyncUnary[T, None]
module-attribute
Represents async inspect functions async (T)
.
AsyncNullary = Nullary[Awaitable[R]]
module-attribute
Represents async nullary functions async () -> R
.
AsyncParse = AsyncUnary[str, T]
module-attribute
Represents parsing functions async (str) -> T
.
AsyncPredicate = AsyncUnary[T, bool]
module-attribute
Represents async predicates async (T) -> bool
.
AsyncQuaternary = Quaternary[T, U, V, W, Awaitable[R]]
module-attribute
Represents async quaternary functions async (T, U, V, W) -> R
.
AsyncSelectors = AsyncIterable[bool]
module-attribute
Represents async selectors.
AsyncTernary = Ternary[T, U, V, Awaitable[R]]
module-attribute
Represents async ternary functions async (T, U, V) -> R
.
AsyncUnary = Unary[T, Awaitable[R]]
module-attribute
Represents async unary functions async (T) -> R
.
AsyncValidate = AsyncUnary[T, None]
module-attribute
Represents async validation functions async (T)
.
Attributes = StringDict[Any]
module-attribute
Represents attributes.
Binary = Callable[[T, U], R]
module-attribute
Represents binary functions (T, U) -> R
.
Compare = Binary[T, U, bool]
module-attribute
Represents comparison functions (T, U) -> bool
.
Decorator = Unary[F, G]
module-attribute
Represents decorators (F) -> G
.
DecoratorIdentity = Identity[F]
module-attribute
Represents identity decorators (F) -> F
.
DynamicAsyncCallable = Callable[..., Awaitable[R]]
module-attribute
Represents dynamic async callables async (...) -> R
.
DynamicCallable = Callable[..., R]
module-attribute
Represents dynamic callables (...) -> R
.
DynamicTuple = Tuple[T, ...]
module-attribute
Represents homogeneous tuples of any length (T, ...)
.
EmptyTuple = Tuple[]
module-attribute
Represents empty tuples ()
.
ForEach = Unary[T, None]
module-attribute
Represents for-each functions (T)
.
GenericPredicate = Callable[P, bool]
module-attribute
Represents generic predicates (P) -> bool
.
Headers = StringMapping[Any]
module-attribute
Represents headers.
Identity = Unary[T, T]
module-attribute
Represents identity functions (T) -> T
.
Inspect = Unary[T, None]
module-attribute
Represents inspect functions (T)
.
IntoAttributes = IntoStringDict[Any]
module-attribute
Represents types that can be converted into attributes.
IntoDict = Union[Mapping[Q, T], Pairs[Q, T]]
module-attribute
Represents types that can be converted into dictionaries.
IntoHeaders = IntoStringMapping[Any]
module-attribute
Represents types that can be converted into headers.
IntoMapping = Union[Mapping[T, U], Pairs[T, U]]
module-attribute
Represents types that can be converted into mappings.
IntoNamespace = IntoStringDict[Any]
module-attribute
Represents types that can be converted into namespaces.
IntoParameters = IntoStringMapping[Any]
module-attribute
Represents types that can be converted into parameters.
IntoPath = Union[str, PathLike[str]]
module-attribute
Represents types that can be converted into Path
.
IntoStringDict = IntoDict[str, T]
module-attribute
Represents types that can be converted into string dictionaries.
IntoStringMapping = IntoMapping[str, T]
module-attribute
Represents types that can be converted into string mappings.
Namespace = StringDict[Any]
module-attribute
Represents namespaces.
NormalError = Exception
module-attribute
Represents normal errors.
NormalErrorType = Type[NormalError]
module-attribute
Represents normal error types.
NormalErrorTypes = DynamicTuple[NormalErrorType]
module-attribute
Represents tuples of normal error types (NormalErrorType, ...)
.
Nullary = Callable[[], R]
module-attribute
Represents nullary functions () -> R
.
Pair = Tuple[T, T]
module-attribute
Represents homogeneous pairs (T, T)
.
Pairs = Iterable[Tuple[T, U]]
module-attribute
Represents iterables of pairs (T, U)
.
Parameters = StringMapping[Any]
module-attribute
Represents parameters.
Parse = Unary[str, T]
module-attribute
Represents parsing functions (str) -> T
.
Payload = Union[Primitive, List['Payload'], StringDict['Payload']]
module-attribute
Represents payloads.
Predicate = Unary[T, bool]
module-attribute
Represents predicates (T) -> bool
.
Primitive = Optional[Union[bool, int, float, str]]
module-attribute
Represents primitive types.
Quaternary = Callable[[T, U, V, W], R]
module-attribute
Represents quaternary functions (T, U, V, W) -> R
.
RecursiveAnyIterable = Union[T, AnyIterable['RecursiveAnyIterable[T]']]
module-attribute
Represents recursive iterables, async or not.
RecursiveAsyncIterable = Union[T, AsyncIterable['RecursiveAsyncIterable[T]']]
module-attribute
Represents recursive async iterables.
RecursiveIterable = Union[T, Iterable['RecursiveIterable[T]']]
module-attribute
Represents recursive iterables.
Selectors = Iterable[bool]
module-attribute
Represents selectors.
SimpleAsyncContextManager = AsyncContextManager[None]
module-attribute
Represents simple async context managers that do not return anything on entering.
SimpleContextManager = ContextManager[None]
module-attribute
Represents simple context managers that do not return anything on entering.
StrictPayload = Union[StrictPrimitive, List['StrictPayload'], StringDict['StrictPayload']]
module-attribute
Represents strict payloads (which exclude None
).
StrictPrimitive = Union[bool, int, float, str]
module-attribute
Represents strict pritimive types (which exclude None
).
StringDict = Dict[str, T]
module-attribute
Represents string dictionaries.
StringMapping = Mapping[str, T]
module-attribute
Represents string mappings.
Ternary = Callable[[T, U, V], R]
module-attribute
Represents ternary functions (T, U, V) -> R
.
Tuple1 = Tuple[T]
module-attribute
Represents homogeneous 1-tuples (T)
.
Tuple2 = Tuple[T, T]
module-attribute
Represents homogeneous 2-tuples (T, T)
.
Tuple3 = Tuple[T, T, T]
module-attribute
Represents homogeneous 3-tuples (T, T, T)
.
Tuple4 = Tuple[T, T, T, T]
module-attribute
Represents homogeneous 4-tuples (T, T, T, T)
.
Tuple5 = Tuple[T, T, T, T, T]
module-attribute
Represents homogeneous 5-tuples (T, T, T, T, T)
.
Tuple6 = Tuple[T, T, T, T, T, T]
module-attribute
Represents homogeneous 6-tuples (T, T, T, T, T, T)
.
Tuple7 = Tuple[T, T, T, T, T, T, T]
module-attribute
Represents homogeneous 7-tuples (T, T, T, T, T, T, T)
.
Tuple8 = Tuple[T, T, T, T, T, T, T, T]
module-attribute
Represents homogeneous 8-tuples (T, T, T, T, T, T, T, T)
.
TypeDecorator = Unary[C, D]
module-attribute
Represents type decorators (C) -> D
.
TypeDecoratorIdentity = Identity[C]
module-attribute
Represents identity type decorators (C) -> C
.
Unary = Callable[[T], R]
module-attribute
Represents unary functions (T) -> R
.
UnpackBinary = Unary[Tuple[T, U], R]
module-attribute
Represents unpacking binary functions ((T, U)) -> R
.
UnpackNullary = Unary[EmptyTuple, R]
module-attribute
Represents unpacking nullary functions (()) -> R
.
UnpackQuaternary = Unary[Tuple[T, U, V, W], R]
module-attribute
Represents unpacking quaternary functions ((T, U, V, W)) -> R
.
UnpackTernary = Unary[Tuple[T, U, V], R]
module-attribute
Represents unpacking ternary functions ((T, U, V)) -> R
.
UnpackUnary = Unary[Tuple[T], R]
module-attribute
Represents unpacking unary functions ((T)) -> R
.
Validate = Unary[T, None]
module-attribute
Represents validation functions (T)
.
is_async_iterable(iterable: AnyIterable[T]) -> TypeIs[AsyncIterable[T]]
Checks if an AnyIterable[T]
is an
AsyncIterable[T]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterable |
AnyIterable[T]
|
The iterable to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[AsyncIterable[T]]
|
Whether the iterable is an |
Source code in typing_aliases/typing.py
463 464 465 466 467 468 469 470 471 472 473 |
|
is_async_iterator(iterator: AnyIterator[T]) -> TypeIs[AsyncIterator[T]]
Checks if an AnyIterator[T]
is an
AsyncIterator[T]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterator |
AnyIterator[T]
|
The iterator to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[AsyncIterator[T]]
|
Whether the iterator is an |
Source code in typing_aliases/typing.py
489 490 491 492 493 494 495 496 497 498 499 |
|
is_bool(item: Any) -> TypeIs[bool]
Checks if the given item is of type bool
.
This is equivalent to:
is_true(item) or is_false(item)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[bool]
|
Whether the given item is of type |
Source code in typing_aliases/typing.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
|
is_bytes(item: Any) -> TypeIs[bytes]
Checks if the given item is of type bytes
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[bytes]
|
Whether the given item is of type |
Source code in typing_aliases/typing.py
557 558 559 560 561 562 563 564 565 566 |
|
is_false(item: Any) -> TypeIs[Literal[False]]
Checks if the given item
is False
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[Literal[False]]
|
Whether the given item is |
Source code in typing_aliases/typing.py
617 618 619 620 621 622 623 624 625 626 |
|
is_float(item: Any) -> TypeIs[float]
Checks if the given item is of type float
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[float]
|
Whether the given item is of type |
Source code in typing_aliases/typing.py
545 546 547 548 549 550 551 552 553 554 |
|
is_hashable(item: Any) -> TypeIs[Hashable]
Checks if the given item is hashable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[Hashable]
|
Whether the given item is hashable. |
Source code in typing_aliases/typing.py
662 663 664 665 666 667 668 669 670 671 |
|
is_int(item: Any) -> TypeIs[int]
Checks if the given item is of type int
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[int]
|
Whether the given item is of type |
Source code in typing_aliases/typing.py
533 534 535 536 537 538 539 540 541 542 |
|
is_iterable(iterable: AnyIterable[T]) -> TypeIs[Iterable[T]]
Checks if an AnyIterable[T]
is an
Iterable[T]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterable |
AnyIterable[T]
|
The iterable to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[Iterable[T]]
|
Whether the iterable is an |
Source code in typing_aliases/typing.py
476 477 478 479 480 481 482 483 484 485 486 |
|
is_iterator(iterator: AnyIterator[T]) -> TypeIs[Iterator[T]]
Checks if an AnyIterator[T]
is an
Iterator[T]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterator |
AnyIterator[T]
|
The iterator to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[Iterator[T]]
|
Whether the iterator is an |
Source code in typing_aliases/typing.py
502 503 504 505 506 507 508 509 510 511 512 |
|
is_none(item: Optional[T]) -> TypeIs[None]
Checks if the given item
is None
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Optional[T]
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[None]
|
Whether the given item is |
Source code in typing_aliases/typing.py
518 519 520 521 522 523 524 525 526 527 |
|
is_range(item: Any) -> TypeIs[range]
Checks if the given item is of type range
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[range]
|
Whether the given item is of type |
Source code in typing_aliases/typing.py
593 594 595 596 597 598 599 600 601 602 |
|
is_same_or_sub_type(item: Any, other: T) -> TypeIs[T]
Checks if the item is of the sub- or same type T
as the other item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
other |
T
|
The other item to check against. |
required |
Returns:
Type | Description |
---|---|
TypeIs[T]
|
Whether the item is of the sub- or same type |
Source code in typing_aliases/typing.py
690 691 692 693 694 695 696 697 698 699 700 |
|
is_same_type(item: Any, other: T) -> TypeIs[T]
Checks if the item is of the same type T
as the other item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
other |
T
|
The other item to check against. |
required |
Returns:
Type | Description |
---|---|
TypeIs[T]
|
Whether the item is of the same type |
Source code in typing_aliases/typing.py
677 678 679 680 681 682 683 684 685 686 687 |
|
is_sized(item: Any) -> TypeIs[Sized]
Checks if the given item is sized.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[Sized]
|
Whether the given item is sized. |
Source code in typing_aliases/typing.py
650 651 652 653 654 655 656 657 658 659 |
|
is_slice(item: Any) -> TypeIs[slice]
Checks if the given item is of type slice
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[slice]
|
Whether the given item is of type |
Source code in typing_aliases/typing.py
581 582 583 584 585 586 587 588 589 590 |
|
is_string(item: Any) -> TypeIs[str]
Checks if the given item is of type str
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[str]
|
Whether the given item is of type |
Source code in typing_aliases/typing.py
569 570 571 572 573 574 575 576 577 578 |
|
is_true(item: Any) -> TypeIs[Literal[True]]
Checks if the given item
is True
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Any
|
The item to check. |
required |
Returns:
Type | Description |
---|---|
TypeIs[Literal[True]]
|
Whether the given item is |
Source code in typing_aliases/typing.py
605 606 607 608 609 610 611 612 613 614 |
|