-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parameter default type-checking x 4.
This commit is the last in a commit chain type-checking the default values of optional parameters accepted by `@beartype`-decorated callables, resolving feature request #154 kindly submitted by @dosisod (Logan Hunt) a literal lifetime ago when @leycec still had hair. And what kind of an unabashedly superheroic name is "Logan Hunt," anyway? He was destined for greatness. Specifically, this commit: * Defines two new exception and warning types: * `beartype.roar.BeartypeDecorHintParamDefaultViolation`, raised at `@beartype` decoration time when the default value of an optional parameter violates its type hint. * `beartype.roar.BeartypeDecorHintParamDefaultForwardRefWarning`, emitted when the type hint annotating an optional parameter contains one or more **unresolvable forward references** (i.e., references to user-defined objects that have yet to be defined at `@beartype` decoration time). * Raises the new `beartype.roar.BeartypeDecorHintParamDefaultViolation` exception type at `@beartype` decoration time when the default value of an optional parameter violates its type hint. * Emits the new `beartype.roar.BeartypeDecorHintParamDefaultForwardRefWarning` warning category when the type hint annotating an optional parameter contains one or more unresolvable forward references. * Exhaustively tests this functionality. I am exhausted so that you don't have to be. (*Contrariwise to unwise disestablishmentarian contrarianism!*)
- Loading branch information
Showing
19 changed files
with
374 additions
and
84 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
Oops, something went wrong.