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

mypy_extensions.TypedDict errors because when creating a class, it is inferred as an instance #1927

Closed
libre-man opened this issue Mar 12, 2018 · 2 comments · Fixed by #4072
Labels
Astroid Related to astroid Enhancement ✨ Improvement to a component Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)

Comments

@libre-man
Copy link

Steps to reproduce

  1. Create a new variable Dict1 = mypy_extensions.TypedDict('Dict1', {'a' : int}).
  2. Create a class class Dict2(Dict1, Total=True): pass
  3. Run pyling

Current behavior

Pylint gives an error for the class creation as inheriting from a non class is invalid.

Expected behavior

No error as this valid.

pylint --version output

Python 3.6.4rc1

@PCManticore
Copy link
Contributor

Thanks for the report. It seems that mypy_extensions does some metaprogramming that pylint and its inference mechanism can't quite understand.

@PCManticore PCManticore added Enhancement ✨ Improvement to a component Astroid Related to astroid Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade) labels Mar 12, 2018
@PCManticore PCManticore changed the title Inheriting from TypedDict instance should not error mypy_extensions.TypedDict errors because when creating a class, it is inferred as an instance Mar 12, 2018
@socketpair
Copy link

socketpair commented Jan 29, 2021

from typing import TypedDict
class UserRecordType(TypedDict):
    id: str
    login: str
E0239: Inheriting 'TypedDict', which is not a class. (inherit-non-class)

Pylint 2.6.0-2
Python 3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Enhancement ✨ Improvement to a component Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants