-
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for cached_properties to slotted attrs classes. (#1200)
* Add support for cached_properties to slotted attrs classes. * Remove locking from implementation * Add test for multiple cached properties and fix bug * Add changelog file * Document slotted cached properties * Add cached_property hypothesis check. * Only run cached_property imports on python 3.8+ * Use cached _obj_setattr instead of `object.__setattr__` * Correctly resolve mro for __getattr__ in cached properties * Use _get_annotations rather than branching on class dict entry * Optimise __getattr__ code by front loading branching, and injecting locasl variables * Remove unnecessary `__attrs_original_getattr__` from class dictionary. --------- Co-authored-by: Hynek Schlawack <hs@ox.cx>
- Loading branch information
1 parent
01413df
commit 597c3a8
Showing
7 changed files
with
512 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Slotted classes now transform `functools.cached_property` decorated methods to support equivalent semantics. |
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.