Pyright: Class keyword arguments are not supported

Created on 22 May 2019  路  2Comments  路  Source: microsoft/pyright

Describe the bug
Pyright does not understand class keyword arguments.

To Reproduce
Try to use mypy_extensions.TypedDict with total=False argument from mypy documentation:

from mypy_extensions import TypedDict

class Translations(TypedDict, total=False):
    de: str
    en: str

Expected behavior
I expect Pyright not to be confused by total=False.

Screenshot
image

VS Code extension
Name: Pyright
Id: ms-pyright.pyright
Description: VS Code static type checking for Python
Version: 1.0.31
Publisher: ms-pyright
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyright

addressed in next version bug

All 2 comments

Thanks for the bug report. I wasn't aware that Python supported this, but indeed it does. I just found the statement in the python spec:

3.3.3.1: Any other keyword arguments that are specified in the class definition are passed through to all metaclass operations described below.

This is an easy fix - mostly just involves removing some existing code. I'll have it fixed shortly.

This is now fixed in 1.0.32, which I just published. Thanks again for the bug report.

Was this page helpful?
0 / 5 - 0 ratings