* converters: allow wrapping & takes_self
* Add takes field
* Add news fragment
* Refactor name and call creation
* Make argument names more idiomatic
* Add missing hints
* Make 3-arg converters zero-overhead at runtime
* Remove unnecessary changes
* More idiomatic name
* Explain method
* Make pickle test more meaningful
* Add unit tests for fmt_converter_call
* Check our eq works too
* Convert Converter docstring to Napoleon
* Fix rebase fubar
* Add ~types~
* Comment out failing mypy tests for now
* Fix mypy tests
* Add warning
* Add narrative docs
* Fix converter overloads, add tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Speed up __eq__
* Changelog, disallow nans in tests
* Fix `eq_key` comparisons
* Rework changlelog
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Make docs more precise
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Implement attrs.validators.or_ validator
* Add tests/test_validators.py::TestOr test cases
* Add test for _OrValidator.__repr__ method
* Add description of attrs.validators.or_ to docs/api.rst
* Add changelog entry
* Swap double quotes for single because doctests don't like it
* Rename changelog fragment pointing to incorrect number
* Silence ruff linter warnings
Although good warning in general, in this particular code, they
do not fit here.
* BLE001 Do not catch blind exception: `Exception`
`validators` usually raise `ValueError` upon their violation.
However, it's not the only `Exception` they can raise - cf.
`attrs.validators.not_` - therefore, it is desirable to catch
them all!
* PERF203 `try`-`except` within a loop incurs performance overhead
Fair point, but the loop is written in a way to short-circuit,
ie. it will finish when a first validator is satisfied.
* S112 `try`-`except`-`continue` detected, consider logging the exception
Not applicable here, we care only if **all** validators raise
an exception, which is already accomodated for after the `for`
loop.
* Apply suggestions from code review
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Rework example of or_ validator in api/docs.rst
* Update docs/api.rst
---------
Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: Libor <libas.martinek@protonmail.com>
`attr.fields_dict` was a link back to itself. The intention, like all the other nearby aliases, was to refer back to the version in `attrs` for the full story.
* 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>