Commit Graph

20 Commits

Author SHA1 Message Date
Hynek Schlawack f5683b852b
converters: allow wrapping and passing self and fields (#1267)
* 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>
2024-07-28 13:55:24 +00:00
Hynek Schlawack 0b07265e0c
Unpin Mypy (#1301)
* Unpin Mypy

fixes #1279

Looks like 1.10.1 fixed itself?

* Fix type errors

* Update pins

* Don't run Mypy on 3.8 too

* wtf

* Fix order
2024-07-13 12:33:59 +02:00
Eugene Toder ea1037cc14
Fix mypy and pyright tests in CI (#1202)
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.
2023-11-11 10:45:04 +00:00
Tin Tvrtković fb97252186
Bump mypy, fix tests (#1190)
* Bump mypy, fix tests

* Skip Mypy on 3.7

* Maybe?

* Maybe again?

* Fix old school tuple

* Fix test
2023-10-17 05:48:35 +02:00
Hynek Schlawack 4461e2ce47
Unpin Mypy (#1155) 2023-06-26 21:36:22 +02:00
Tin Tvrtković 92f5eec824
Fix for new Mypy (#1111) 2023-03-12 05:26:36 +01:00
Vyacheslav Tverskoy 882805e173
Add AttrsInstance protocol to forgotten attrs.asdict and attrs.astuple (#1090)
* Add AttrsInstance protocol to forgotten attrs.asdict and attrs.astuple

* Add mypy test for attrs.asdict

* Add changelog entry for attrs.asdict

* Clarify it's about type stubs

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2023-01-23 09:21:20 +00:00
Tin Tvrtković 14354bbd67
Update Mypy tests for new Mypy output (#1070)
* Update Mypy tests for new Mypy output

* Finish rebase

* Tweak tox mypy

* Limit tox version
2023-01-16 15:50:52 +01:00
layday ca6ce8c00e
Use `TypeGuard` for `has` in Python 3.10 and above (#997)
* Use `TypeGuard` for `has` in Python 3.10 and above

* fixup! Use `TypeGuard` for `has` in Python 3.10 and above

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Test the negative case

* Add type guard example

Co-authored-by: Hynek Schlawack <hs@ox.cx>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-08-16 07:20:32 +02:00
Hynek Schlawack c89abcd6e6 It totally is correct 2022-07-28 14:46:53 +02:00
Hynek Schlawack 557e3fd8ea Fix test_yaml
Looks like mypy added support for converter lambdas.
2022-07-27 16:30:18 +02:00
Tin Tvrtković c4ded79ff9
Mypy improvements (#890)
* Mypy improvements

* Change protocol, add a test

* Relax fields return type

* Test fixes

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-05-01 10:43:57 -06:00
wouter bolsterlee a22e98c6cb
No longer explicitly subclass ‘object’ (#940)
This is no longer relevant in Python 3+. Follow-up to !936.

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2022-03-21 10:35:44 +01:00
Hynek Schlawack 980c8b04f5
Drop Python 2.7 (#936)
* 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>
2022-03-21 08:47:47 +01:00
David Euresti 82ab0c1d11
Fix mypy tests. Looks like the tests are error order sensitive (#856) 2021-10-30 21:05:49 +02:00
David Euresti b8f5cd780b
Fix mypy tests. (#844)
Looks like the ordering changed
2021-09-19 17:09:35 +02:00
David Euresti ec249f62b3
Fix the mypy tests by double quoting. (#825) 2021-06-14 19:17:33 +02:00
David Euresti 467e28b268
Fix mypy tests (#749) 2021-01-23 10:33:13 +01:00
David Euresti 6b84ad2db2
Move some of the mypy tests over. (#738)
* First pass

* Fix the tests

* trim

Co-authored-by: Hynek Schlawack <hs@ox.cx>
2020-12-28 07:50:29 +01:00
David Euresti 3d274d0bfa
WIP: Add mypy tests (#737)
* Add basic mypy tests

* Only run mypy on 3.6+

* No pypy

* Fix things

* Oooh parametrized
2020-12-21 06:21:28 +01:00