classes icon indicating copy to clipboard operation
classes copied to clipboard

Makes `classes` compatible with `mypy` 1.2

Open thepabloaguilar opened this issue 2 years ago • 10 comments

Makes classes compatible with mypy 1.2

Checklist

  • [X] I have double checked that there are no unrelated changes in this pull request (old patches, accidental config files, etc)
  • [X] I have created at least one test case for the changes I have made
  • [X] I have updated the documentation for the changes I have made
  • [X] I have added my changes to the CHANGELOG.md

thepabloaguilar avatar Apr 11 '23 03:04 thepabloaguilar

@sobolevn just need a little of your help here with the errors!

thepabloaguilar avatar Apr 11 '23 03:04 thepabloaguilar

tests/test_typeclass/test_typed_dict.py:25: error: Invalid metaclass "_Meta" [misc]

This test needs some love. https://github.com/dry-python/classes/blob/master/tests/test_typeclass/test_typed_dict.py#L9

Right now it is in a semi-broken state.

tests/test_typeclass/test_call.py:17: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]

Can be just ignored. This is probably a mypy bug. You can also report this to mypy.

tests/test_associated_type/test_variadic_generic.py:34: error: Function "Type[Example[Any]]" could always be true in boolean context [truthy-function]

Can be just ignored.

sobolevn avatar Apr 11 '23 06:04 sobolevn

Codecov Report

Merging #487 (13d3f44) into master (4b0e9e5) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #487   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         3    +1     
  Lines          103       106    +3     
  Branches        18        17    -1     
=========================================
+ Hits           103       106    +3     
Impacted Files Coverage Δ
classes/_typeclass.py 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Apr 12 '23 03:04 codecov-commenter

I need to dig more deep to see why this expected error is not being raised anymore:

main:29: error: Instance "TypedDict('main.Other', {'name': builtins.str, 'registered': builtins.bool})" does not match inferred type "main.UserDict"

thepabloaguilar avatar Apr 13 '23 20:04 thepabloaguilar

Updated #483 to have also mypy^1.2.0. Can you guys either cherry-pick it here or review after this one is merged

zhukovgreen avatar Apr 26 '23 09:04 zhukovgreen

Sure!

sobolevn avatar Apr 26 '23 09:04 sobolevn

You can do the same for returns

sobolevn avatar Apr 26 '23 09:04 sobolevn

Added https://github.com/dry-python/returns/pull/1605

zhukovgreen avatar Apr 26 '23 16:04 zhukovgreen