* Spike `alias` implementation.
* Move default alias init to after field_transformer.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fixup docs.
* Update docs/extending.rst
* Pre-commit fixes
* Partially fix doctest
* Add test docstrings.
* Add typing_example tests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Tidy typing_example
* Add note in init.rst on private aliases
* Add alias example to examples.rst
* Assert to comment
* Add changelog entry
* Fixup doc error
* Tidy dataclass_transform docs
* Lil' spice for the changelog.
* Fix doctest
* Update extending.rst
* Make alias introspection more explicit
* Update src/attr/_make.py
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Drop Python 2.7
The tooling situation around Python 2 has deteriorate to such a degree that
upholding compatibility is not tenable anymore for a volunteer-run project.
Signed-off-by: Hynek Schlawack <hs@ox.cx>
* Add newsfragment
* Run Python 3.5 under coverage to make up for Python 2.7
* Wait for py35 in parallel
* Remove fullmatch kludge
* Remove Python 2-specific code
* Revert empty slot test
Also disable pyupgrade on that file.
Signed-off-by: Hynek Schlawack <hs@ox.cx>
* We DO run under 3.5
* Remove __qualname__ workarounds
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update changelog.d/936.breaking.rst
Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
* Compare methods using is
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
* Split cmp into eq and order
Fixes#170
* Fix tests on old pypy3 versions
Old as in: currently on AP.
* Fix issue number and clarify newsfragment
* Clarify behavior and interaction between cmp/eq/order
* This sounds better
* Address Julian's review comments
* Missed a cmp
* Test the behavior of Attribute.cmp
* Make test more idiomatic
* Explain assumptions
* Clarify comment
* Grammar
* One more cmp!
* First stab at implementing hashcode caching (#423)
Currently all existing tests pass but no cache_hash tests have yet
been added.
* Existing hash tests now pass on cache_hash classes
* Add towncrier change log
* Add documentation for cache_hash
* Fixes bug with check that init=True if cache_hash=True
* Fix long lines
* Fix documentation issues
* Add test for cache_hash requiring init
* Improve test coverage
* Remove now unnecessary 'pass'
* Add periods to the end of exception strings
* Add test docstrings for cache_hash tests
* Clarify documentation of cache_hash
* Recommend that hashable classes be frozen
* Fix test references for exception messages
* Added support for keyword-only attributes. Closes#106, and closes#38
(Rebases #281)
Co-authored-by: Alex Ford <fordas@uw.edu>
* Add `attr.s`-level `kw_only` flag.
Add `kw_only` flag to `attr.s` decorator, indicating that all class
attributes should be keyword-only in __init__.
Minor updates to internal interface of `Attribute` to support
evolution of attributes to `kw_only` in class factory.
Expand examples with `attr.s` level kw_only.
* Add `kw_only` to type stubs.
* Update changelog for rebased PR.
Hear ye, hear ye. A duplicate PR is born.
* Tidy docs from review.
* Tidy code from review.
* Add explicit tests of PY2 kw_only SyntaxError behavior.
* Add `PythonToOldError`, raise for kw_only on PY2.
* `Attribute._evolve` to `Attribute._assoc`.
* Make _CountingAttr empty metadata unique
Issue #278
* Correct st.none().map() to st.builds()
* Add 'real' and 'force coverage' tests for not None metadata
* Add changelog for pr 280
* Correct import order in tests/test_make.py
* Add back coverage force test
* Remove debug print from test/utils.py
* Stop setting attributes on class bodies
This behavior has been deprecated since 16.1 and can now be removed in
accordance with our backward-compatibility policy.
* We don't need iterkeys anymore
* Restore hash to validators.
* Restore Attribute.default and Attribute.validator.
* _AndValidator is hashable now. Test validator hashability.
* Add in_ to validators.__all__.
If this method is defined for a class, it will get executed at the end
of ``__init__``. Previously, there was no way to extend what was
done during ``__init__`` when using ``@attr.s``.