-
-
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.
Added is_simplified_exception configuration option. (#301)
`beartype.BeartypeConf.violation_*` options x 1. This commit by Montreal API wizard @felixchenier (Félix Chénier) is the first in a commit chain defining a trio of new public `beartype.BeartypeConf.violation_*` options, en-route to resolving issue #216 also kindly submitted by that same wizard. Specifically, this commit refactors the `beartype.BeartypeConf` dataclass to accept these new keyword-only parameters – enabling users to configure both the types and messages of type-checking violation exceptions raised by @beartype: * `violation_param_type: type[Exception] = beartype.roar.BeartypeCallHintParamViolation`, the type of exception raised by @beartype when a parameter violates a type-check. * `violation_return_type: type[Exception] = beartype.roar.BeartypeCallHintReturnViolation`, the type of exception raised by @beartype when a return violates a type-check. * `violation_verbosity: int = 3`, a non-negative integer in the range `[0, 5]` controlling the verbosity of exceptions raised by @beartype when *anything* violates a type-check. This integer varies as follows: 1. **Minimal verbosity.** Equivalently, maximal terseness. This level is intended for library users whose end users prefer concise, simple, and sparse type-checking violations. 2. **[Reserved].** Currently simply an alias for ``violation_verbosity=1`. 3. **Standard verbosity.** This level is intended for software developers by adding context on the underlying causes of type-checking violations. 4. **[Reserved].** Currently simply an alias for ``violation_verbosity=3`. 5. **Maximal verbosity.** Equivalently, minimal terseness. This level is intended for software developers debugging type-checking violations by adding even more context on the underlying causes of type-checking violations -- including metadata on the @beartype configurations under which those violations occurred. Thanks so much to @felixchenier for his brilliant volunteerism that transforms @beartype into something actually usable by living humans that breathe oxygen. (*Exulted stories of excitatory orations!*)
- Loading branch information
1 parent
6e64bdd
commit 3a835d5
Showing
2 changed files
with
163 additions
and
20 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