-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed-length tuple type hint disambiguation x 3.
This commit is the last in a commit chain disambiguating fixed-length tuple type hints of the form `tuple[{child_hint_1}, ..., {child_hint_N}]` from variable-length tuple type hints of the form `tuple[{child_hint}, ...]` across the @beartype codebase in a more elegant manner. Although @beartype currently (of course) disambiguates these two kinds of tuple type hints, it does rather inelegantly in a manner breaking @leycec's head. As a beneficial side effect of this refactoring, the `beartype.door.TypeHint` API now explicitly disambiguates between fixed- and variable-length tuple type hints by creating and returning unambiguous instances of either: * The new public `beartype.door.TupleFixedTypeHint` subclass when instantiating `beartype.door.TypeHint` with a fixed-length tuple type hint: e.g., ```python >>> from beartype.door import TypeHint >>> repr(TypeHint(tuple[int, str])) 'TupleFixedTypeHint(tuple[int, str])' ``` * The new public `beartype.door.TupleVariableTypeHint` subclass when instantiating `beartype.door.TypeHint` with a variable-length tuple type hint: e.g., ```python >>> from beartype.door import TypeHint >>> repr(TypeHint(tuple[int, ...])) 'TupleVariableTypeHint(tuple[int, ...])' ``` Beartype: *Open the door to a whole new typing world.* Cue Disney music. (*Indubitable doubt is industriously dusty!*)
- Loading branch information
Showing
16 changed files
with
130 additions
and
231 deletions.
There are no files selected for viewing
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
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
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.