Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

Use typecheck workaround for custom list/dicts #41

Merged
merged 1 commit into from
Nov 2, 2021

Conversation

abravalheri
Copy link
Collaborator

@abravalheri abravalheri commented Nov 2, 2021

As reported in python/mypy#11427, a "lie" in typeshed messes completely the type inference for classes inheriting from (MutableMapping, dict) and (MutableSequence, list).

This is a workaround that results in useful type inference.

(Considering it is a tricky mypy issue, I suppose it will be either marked as a wontfix or take a long time to be solved, so for the time being a workaround seems to be the best approach).

@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2021

Codecov Report

Merging #41 (a5a76be) into main (4c1e92a) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #41      +/-   ##
==========================================
+ Coverage   91.80%   91.84%   +0.03%     
==========================================
  Files          12       12              
  Lines        2405     2404       -1     
==========================================
  Hits         2208     2208              
+ Misses        197      196       -1     
Flag Coverage Δ
unittests 91.84% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
atoml/container.py 88.74% <100.00%> (-0.03%) ⬇️
atoml/items.py 88.73% <100.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c1e92a...a5a76be. Read the comment docs.

As reported in python/mypy#11427, a "white lie" in typeshed
messes completely the type inference for classes inheriting from
``(MutableMapping, dict)`` and ``(MutableSequence, list)``.

This is a workaround that results in useful type inference.
@abravalheri abravalheri marked this pull request as ready for review November 2, 2021 10:21
@frostming frostming merged commit df1ef36 into frostming:main Nov 2, 2021
@abravalheri abravalheri deleted the fix-typecheck branch November 2, 2021 15:23
@abravalheri
Copy link
Collaborator Author

Thank you very much @frostming.

I am terribly sorry, I did not realise I have introduced a problematic and outdated expression in the text (English is not my first language, so I don't spot those things immediately).

I removed the problematic expression from the main branch.
Since it was in a comment and does not affect the way the code works.

abravalheri added a commit to abravalheri/atoml that referenced this pull request Nov 2, 2021
PR frostming#41 added a workaround for the MRO type checking problem, however it
missed AoT, which is fixed by this change.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants