* Add tuple_keys to asdict
See #646
* Add typing example
* Add newsfragments
* Add missing test
* Switch it on by default
* Let's not make buggy behavior configurable
* NG: convert on setattr by default
Not doing that from the get-go was an oversight.
Fixes#835
* Add optimization for default on_setattr w/ no work to do
Otherwise we'd end up with an explicit setattr every time.
* Fix optimization for NG default & j/ convert
* NG is actually 3.6+
* Add test for convert optimization for good measure
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.11b1 → 21.12b0](https://github.com/psf/black/compare/21.11b1...21.12b0)
* [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>
Fixes#875.
This adds support for pre-compiled regular expressions to
attr.validators.matches_re(). This cannot be combined with flags since
the pre-compiled pattern already has those.
Detailed changes:
- attr.validators.matches_re() now accepts re.Pattern in addition to
strings; update type annotations accordingly.
- Convert percent-formatting into str.format() for an error message
- Simplify (private) _MatchesReValidator helper class a bit: use the
actual compiled pattern, and drop the unused .flags attribute.
- Simplify control flow a bit; add pointer about fullmatch emulation.
- Add tests
- Tweak existing test to ensure that .fullmatch() actually works
correctly by matching a pattern that also matches (but not
‘full-matches’) a shorter substring.
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Document the various core names and why they exist
Signed-off-by: Hynek Schlawack <hs@ox.cx>
* Remove stray backtick
* Add example of new API
* Link PEP 526
* future is now
* phrase and typos
* typo/grammar
* typo
* Better phrasing
* Add missing and
* less words = better
* polish
* phrasing
* looks weird but is correct
* comma spliiiiceeeee
* example
* make it sound less dry
* fix
* phrasing