-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit is the last in a commit chain reducing the space complexity of PEP 585-compliant type hints (e.g., `list[str]`) by deduplicating those hints across all `@beartype`-decorated callables. Currently, PEP 484-compliant type hints (e.g., `List[str]`) and indeed *most* other PEP-compliant type hints are already effectively deduplicated by caching hidden in the standard `typing` module; ergo `List[str] is List[str]`. Despite deprecating PEP 484, PEP 585 fails to deduplicate its hints; ergo, `list[str] is not list[str]`. Once this commit chain is finalized, `@beartype` will internally deduplicate duplicated PEP 585-compliant type hints at decoration time via a thread-safe cache from the machine-readable string representations of such hints to such hints. Specifically, this commit fundamentally refactors our new `beartype._util.hint.pep.utilpepconv` utility submodule to uniquely differentiate between root and non-root type hints -- each of which requires a moderately different form of deduplication in specific and coercion in general. Since tests pass, **all systems are a go for beartype 0.9.0.** (*Incoming commingling!*)
- Loading branch information
Showing
8 changed files
with
424 additions
and
304 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.