Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive on __required__ and __optional__ on TypedDict. #10158

Open
rcosperec opened this issue Dec 24, 2024 · 0 comments
Open

False positive on __required__ and __optional__ on TypedDict. #10158

rcosperec opened this issue Dec 24, 2024 · 0 comments
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation typing

Comments

@rcosperec
Copy link

Bug description

from typing import TypedDict, Required, NotRequired

class MyDict(TypedDict):
    required: Required[str]
    not_required: NotRequired[str]
    implicitely_required: str

def main():
    print(MyDict.__required_keys__)
    print(MyDict.__optional_keys__)

if __name__ == "__main__":
    main()

Configuration

Command used

pylint --disable=missing-docstring main.py

Pylint output

************* Module main
main.py:9:10: E1101: Class 'MyDict' has no '__required_keys__' member (no-member)
main.py:10:10: E1101: Class 'MyDict' has no '__optional_keys__' member (no-member)

Expected behavior

Pylint shouldn't report it as a missing member as the code runs without any issue.

It seems the same issue was already fixed for annotations

Pylint version

pylint 3.3.3
astroid 3.3.8
Python 3.11.10 (main, Sep  7 2024, 01:03:31) [Clang 15.0.0 (clang-1500.3.9.4)]

OS / Environment

Darwin 24.2.0

Additional dependencies

@rcosperec rcosperec added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 24, 2024
@zenlyj zenlyj added False Positive 🦟 A message is emitted but nothing is wrong with the code typing Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation typing
Projects
None yet
Development

No branches or pull requests

2 participants