Skip to content

Commit

Permalink
add: explicit __all__
Browse files Browse the repository at this point in the history
  • Loading branch information
metaist committed Dec 15, 2023
1 parent acf86fc commit 0c79fb2
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/castfit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,56 @@
NoneType = type(None)
Never = NoReturn

__all__ = [
"__version__",
"__pubdate__",
#
# imported
"Never",
"NoneType",
#
# types
"Ignored",
"TypeForm",
"CheckFn",
"Checks",
"CastFn",
"Casts",
#
# top-level API
"castfit",
"is_type",
"to_type",
#
# extensions
"checks_type",
"casts_to",
#
# lower-level API
"get_origin_type",
"setattrs",
"is_any",
"to_any",
"is_never",
"to_never",
"is_none",
"to_none",
"is_literal",
"to_literal",
"is_union",
"to_union",
"to_bytes",
"to_str",
"is_list",
"to_list",
"is_set",
"to_set",
"is_dict",
"to_dict",
"is_tuple",
"to_tuple",
"to_datetime",
]

__version__ = "0.1.0"
__pubdate__ = "2023-12-15T00:43:07Z"
Expand All @@ -52,12 +102,22 @@
# NOTE: We want just `Type[T]`, but `mypy` treats special forms as `object`.

CheckFn = Callable[[Any, TypeForm[Any]], bool]
"""Function signature that checks if a value is of a type."""

Checks = Dict[TypeForm[Any], CheckFn]
"""Type of internal mapping of types to check functions."""

TYPE_CHECKS: Checks = {}
"""Mapping of types to check functions."""

CastFn = Callable[[Any, TypeForm[T]], T]
"""Function signature that maps a value to a type."""

Casts = Dict[TypeForm[Any], CastFn[Any]]
"""Type of internal mapping of types to cast functions."""

TYPE_CASTS: Casts = {}
"""Mapping of types to cast functions."""


@overload
Expand Down

0 comments on commit 0c79fb2

Please sign in to comment.