📋 Summary
Standardise the type hinting system across the entire library, transitioning from custom type aliases to native Python typing constructs. Simplify complex function overloads in the checkers.py and output.py modules, improve the robustness of type checking logic, and expand the documentation for core utility classes.
🛡️ Type Safety & Standardisation
- Native Typing: Replace custom type aliases like
any_collection,str_collection, andscalarwith standard library types such asCollection[Any],Collection[str], andAny. - Explicit Callables: Add explicit
Callable[..., bool]andCallable[..., None]type annotations to function aliases in thecheckers.pymodule for improved static analysis. - Generic Collections: Refactor internal logic to use
Collection[type]instead of specificlistortupletypes, allowing for more flexible input handling. - List Standardisation: Update all
__all__export lists and internal string lists to use the nativelist[str]type.
⚙️ Logic & Overload Simplification
- Overload Consolidation: Reduce the number of
@overloaddefinitions foris_all_values_of_type(),assert_value_of_type(), andlist_columns()by using more general collection types. - Robust Type Checking: Improve the
is_value_of_type()function to correctly handle non-type iterables by using a more directnot isinstance(check_type, type)check. - Constant Relocation: Move the
log_levelsLiteralfromcollection_types.pytooutput.pyto better align with its primary usage in logging utilities. - Flattening Logic: Refine the
flatten()function to useCollection[Collection[Any]]for input parameters, removing the need for internal type ignores.
📖 Documentation & DX
- Class Methods Documentation: Update the
Defaults()class docstring to include a dedicated "Methods" section, documenting the.get(),._validate_value_and_default(), and._validate_type()methods. - Docstring Accuracy: Refactor parameter descriptions across multiple modules to reflect the shift from "tuple of types" to "Sequence of types" or "Collection of types".
- Retry Metadata: Add descriptive docstrings for internal type aliases and generic type variables in the
retry.pymodule.
🛠️ Bug Fixes & Refinements
- Attribute Errors: Fix a missing
.__name__attribute access in error message generation for type assertions. - Typo Remediation: Correct several typos in docstrings and internal variable names across the
checkers.pyandbools.pymodules. - Dictionary Reversal: Update
dict_reverse_keys_and_values()to return explicitdict[str, Any]types, ensuring better compatibility with downstream consumers.
💪 What's Changed
Full Changelog: v1.5.0...v1.6.0