Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Triply-redeclared types. *Just don't ask.*
This commit resolves inscrutable non-determinism (which is technically deterministic if you squint at it, but we don't talk about that) with respect to repeatedly redefined classes defining one or more methods annotated by one or more **self-referential relative forward reference** (i.e., referring to this class currently being defined), giddily resolving issue #365 kindly submitted by recursive typonista and likely candidate for next-life upgrade to minor deity status @iamrecursion (Ara Adkins). Specifically, @beartype is now *considerably* more robust against non-determinism in Jupyter cells containing `@beartype`-decorated self-referential classes ala: ```python from beartype import beartype @beartype class MuhSelfReferentialClass(object): def __init__(self, muh_var: int) -> None: self.muh_var = muh_var @classmethod def muh_factory(cls, muh_var: int) -> "MuhSelfReferentialClass": return MuhSelfReferentialClass(muh_var + 42) muh_object = MuhSelfReferentialClass.muh_factory(42) ``` Flex those burly QA biceps, @beartype. Flex 'em. (*Questionable quandaries in an old n-ary manifold!*)
- Loading branch information
Showing
3 changed files
with
58 additions
and
7 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