You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using TypedDict to add the proper coverage and proper types for the codebase where the dictionary with pre-defined keys is used. This should solve the problem, add the proper typing everywhere where this dictionary is used and also increase the total coverage of codebase.
Unfortunately when we are using extensively TypeDicts, we have noticed that the coverage stays the same after applying to the code.
The problem is with the coverage of TypedDict itself, even if it has all the types and values specified, mypy somehow flag it as Any Types on this line
NOTE: At the same time if we convert everything to inline type, then the coverage will be proper 100%.
To Reproduce
from __future__ importannotations__all__= ['ChannelTypedDict']
importtypingastclass_RecipientTypedDict(t.TypedDict):
to: list[str]
cc: list[str]
bcc: list[str]
class_DataTypedDict(t.TypedDict):
recipients: _RecipientTypedDictsubject: strmessage: strclassChannelTypedDict(t.TypedDict):
medium: t.Literal['email']
data: _DataTypedDict
Expected Behavior
The file with TypedDict definitions should be covered accordingly (in most cases it should have 100% coverage)
Actual Behavior
The file containing TypedDict usually has 50% coverage or around (usually we put types outside of main codebase)
Your Environment
Mypy version used: mypy 1.10.1 (compiled: no)
Mypy command-line flags: --cache-fine-grained (as we are running it with dmypy)
Mypy configuration options from mypy.ini (and other config files):
Fixes#10007Fixes#17477
This fixes the crash as proposed in
#13732, but also fixes some
inconsistencies in `Any` types exposed by the fix.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Bug Report
We are using TypedDict to add the proper coverage and proper types for the codebase where the dictionary with pre-defined keys is used. This should solve the problem, add the proper typing everywhere where this dictionary is used and also increase the total coverage of codebase.
Unfortunately when we are using extensively TypeDicts, we have noticed that the coverage stays the same after applying to the code.
The problem is with the coverage of TypedDict itself, even if it has all the types and values specified, mypy somehow flag it as
Any Types on this line
NOTE: At the same time if we convert everything to inline type, then the coverage will be proper 100%.
To Reproduce
Expected Behavior
The file with TypedDict definitions should be covered accordingly (in most cases it should have 100% coverage)
Actual Behavior
The file containing TypedDict usually has 50% coverage or around (usually we put types outside of main codebase)
Your Environment
mypy 1.10.1 (compiled: no)
--cache-fine-grained
(as we are running it withdmypy
)mypy.ini
(and other config files):Python 3.11.9
The text was updated successfully, but these errors were encountered: