* 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>
* tiny typo fix for min length validator's error string
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Remove work-arounds for setting cell_contents
Simple assignment to cell_contents works starting from Python 3.7[1].
This is also the minimum supported version of Python according to
pyproject.toml. It follows that we don't need complex work-arounds that
were needed in the past.
Also tested on pypy 3.8.
[1] https://bugs.python.org/issue30486
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
Some error messages changed in mypy 1.7.0 and pyright 1.1.335.
Also, test_mypy sometimes fails with xdist (-n auto). A failure I can
reliably reproduce locally is due to changes in type variables numbering.
There may be other issues.
This allows org-hosted projects to start enabling merge queues in the
repository settings. With that, GitHub would trigger a separate event
against a merge commit derived from merging several pull requests with
the target branch.
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Pass args from `__init__` to `__attrs_pre_init__` if requested
Detect if `__attrs_pre_init__` has arguments besides `self`
using `inspect.signature`. If so, pass `__attrs_pre_init__`
the same arguments that `__init__` (or `__attrs_init__`)
expects.
* Add changelog entry for `__attrs_pre_init__` args changes
* Don't use monkeypatch in new code
* Clarify docs
* Missed one monkeypatching
---------
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Fix TypeError for asdict with namedtuples and retain_collection_types=True
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add news fragment in `changelog.d`
* fix pre-commit interrogate checker
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix flake8 issue
* also fixed `astuple`
* Add `_is_namedtuple` function
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix SyntaxError for python 3.7
* use `issubclass(..., tuple)`
* use issubclass(cf, tuple) if case of TypeError
* pragma: no cover
* Get rid of the `# no cover`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* simplify a bit
* Update tests/test_funcs.py
* Update tests/test_funcs.py
* Update tests/test_funcs.py
* Update tests/test_funcs.py
* Update tests/test_funcs.py
* Update tests/test_funcs.py
* Update tests/test_funcs.py
* Update tests/test_funcs.py
* Update changelog.d/1165.change.md
* Escape patterns
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>