Skip to content

Type Aliases

Type convenience references for consistent type hints across xpytools.


Generic Type Variables

xpytools.xtype.common.T module-attribute

Python
T: TypeVar = TypeVar('T')

Generic type variable for arbitrary data type.

xpytools.xtype.common.K module-attribute

Python
K: TypeVar = TypeVar('K')

Type variable for dictionary keys.

xpytools.xtype.common.V module-attribute

Python
V: TypeVar = TypeVar('V')

Type variable for dictionary values.


String and Path Types

xpytools.xtype.common.PathLike module-attribute

Python
PathLike: type = Union[str, Path]

Type alias for file system paths — accepts str or pathlib.Path.

xpytools.xtype.common.OptPath module-attribute

Python
OptPath: type = Optional[PathLike]

Optional path type that may be None.

xpytools.xtype.common.OptStr module-attribute

Python
OptStr: type = Optional[str]

Optional string type that may be None.


Collection Shortcuts

xpytools.xtype.common.DictStrAny module-attribute

Python
DictStrAny: type = Dict[str, Any]

Dictionary with string keys and any values.

xpytools.xtype.common.DictAny module-attribute

Python
DictAny: type = Dict[Any, Any]

Dictionary with arbitrary key and value types.

xpytools.xtype.common.DictStrStr module-attribute

Python
DictStrStr: type = Dict[str, str]

Dictionary with string keys and string values.

xpytools.xtype.common.DictStrT module-attribute

Python
DictStrT: type = Dict[str, T]

Generic dictionary mapping strings to type T.

xpytools.xtype.common.ListStr module-attribute

Python
ListStr: type = List[str]

List of strings.

xpytools.xtype.common.ListAny module-attribute

Python
ListAny: type = List[Any]

List of arbitrary objects.

xpytools.xtype.common.TupleStr module-attribute

Python
TupleStr: type = Tuple[str, ...]

Tuple containing only strings.

xpytools.xtype.common.IterableStr module-attribute

Python
IterableStr: type = Iterable[str]

Iterable that yields strings.

xpytools.xtype.common.SequenceStr module-attribute

Python
SequenceStr: type = Sequence[str]

Sequence (list, tuple, etc.) of strings.


Callable Types

xpytools.xtype.common.Func module-attribute

Python
Func: type = Callable[..., Any]

Generic callable that accepts arbitrary arguments.

xpytools.xtype.common.OptFunc module-attribute

Python
OptFunc: type = Optional[Func]

Optional callable that may be None.


Numeric and Scalar Types

xpytools.xtype.common.Number module-attribute

Python
Number: type = Union[int, float]

Union of integer and float types.

xpytools.xtype.common.OptNumber module-attribute

Python
OptNumber: type = Optional[Number]

Optional numeric type that may be None.

xpytools.xtype.common.NumericIterable module-attribute

Python
NumericIterable: type = Iterable[Number]

Iterable that yields numeric values (ints or floats).


JSON-Like Convenience

xpytools.xtype.common.JSONPrimitive module-attribute

Python
JSONPrimitive: type = Union[str, int, float, bool, None]

Primitive JSON-compatible scalar value.

xpytools.xtype.common.JSONArray module-attribute

Python
JSONArray: type = List['JSONValue']

JSON array represented as a list of nested JSON values.

xpytools.xtype.common.JSONObject module-attribute

Python
JSONObject: type = Dict[str, 'JSONValue']

JSON object represented as a dictionary of string keys.

xpytools.xtype.common.JSONValue module-attribute

Python
JSONValue: type = Union[JSONPrimitive, JSONArray, JSONObject]

Recursive union type representing any valid JSON value.