Skip to content

Enable pyright for all Python 3 stubs #5597

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

Merged
merged 7 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,17 @@
"stubs/scribe",
"stubs/tornado",
// Modules that are incomplete in some way.
"stdlib/sqlite3/dbapi2.pyi",
"stdlib/tkinter",
"stdlib/xml/dom",
"stdlib/xml/sax",
"stubs/backports",
"stubs/backports_abc",
"stubs/boto",
"stubs/cryptography",
"stubs/docutils",
"stubs/Flask",
"stubs/Jinja2",
"stubs/Markdown",
"stubs/paramiko",
"stubs/protobuf",
"stubs/PyMySQL",
"stubs/python-dateutil",
"stubs/pyvmomi",
"stubs/PyYAML",
"stubs/redis",
"stubs/requests",
"stubs/simplejson",
"stubs/waitress",
"stubs/Werkzeug"
],
Expand Down Expand Up @@ -70,10 +60,8 @@
"reportIncompatibleMethodOverride": "error",
"reportIncompatibleVariableOverride": "error",
"reportInvalidStringEscapeSequence": "error",
"reportUnknownParameterType": "error",
"reportUnknownArgumentType": "error",
"reportUnknownLambdaType": "error",
"reportUnknownVariableType": "error",
"reportUnknownMemberType": "error",
"reportMissingTypeArgument": "error",
"reportUndefinedVariable": "error",
Expand Down
7 changes: 4 additions & 3 deletions stdlib/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ class EventType(str, Enum):
VirtualEvent: str = ...
Visibility: str = ...

_W = TypeVar("_W", bound="Misc")
# Events considered covariant because you should never assign to event.widget.
_W = TypeVar("_W", covariant=True, bound="Misc")
_W_co = TypeVar("_W_co", covariant=True, bound="Misc")

class Event(Generic[_W]):
class Event(Generic[_W_co]):
serial: int
num: int
focus: bool
Expand All @@ -185,7 +186,7 @@ class Event(Generic[_W]):
keysym: str
keysym_num: int
type: EventType
widget: _W
widget: _W_co
delta: int

def NoDefaultRoot(): ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/tkinter/font.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import tkinter
from typing import Any, List, Optional, Tuple, TypeVar, Union, overload
from typing import Any, Optional, Tuple, Union, overload
from typing_extensions import Literal, TypedDict

NORMAL: Literal["normal"]
Expand Down
2 changes: 1 addition & 1 deletion stdlib/tkinter/scrolledtext.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tkinter import Frame, Grid, Misc, Pack, Place, Scrollbar, Text
from tkinter import Frame, Misc, Scrollbar, Text
from typing import Any, Optional

# The methods from Pack, Place, and Grid are dynamically added over the parent's impls
Expand Down
2 changes: 1 addition & 1 deletion stdlib/tkinter/ttk.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _tkinter
import sys
import tkinter
from tkinter.font import _FontDescription
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload
from typing import Any, Callable, Dict, Optional, Tuple, Union, overload
from typing_extensions import Literal, TypedDict

def tclobjs_to_py(adict): ...
Expand Down