diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47c40eb5e..26a64dd85 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -312,7 +312,7 @@ def foo(x): ... # unannotated argument and return type `Incomplete` can also be used for partially known types: ```python -def foo(x: Incomplete | None = None) -> list[Incomplete]: ... +def foo(x: Incomplete | None) -> list[Incomplete]: ... ``` ### What to do when a project's documentation and implementation disagree diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 7448dd51a..85ccbd7a8 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -9,6 +9,7 @@ // test cases use a custom pyrightconfig file "**/@tests/test_cases", "stdlib/__main__.pyi", + "stdlib/distutils/cmd.pyi", "stdlib/distutils/command", "stdlib/distutils/dist.pyi", "stdlib/encodings/__init__.pyi", diff --git a/stdlib/distutils/cmd.pyi b/stdlib/distutils/cmd.pyi index a4e77ddf1..7f97bc3a2 100644 --- a/stdlib/distutils/cmd.pyi +++ b/stdlib/distutils/cmd.pyi @@ -1,4 +1,4 @@ -from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused +from _typeshed import BytesPath, StrOrBytesPath, StrPath, Unused from abc import abstractmethod from collections.abc import Callable, Iterable from distutils.command.bdist import bdist @@ -226,4 +226,4 @@ class Command: level: Unused = 1, ) -> None: ... def ensure_finalized(self) -> None: ... - def dump_options(self, header: Incomplete | None = None, indent: str = "") -> None: ... + def dump_options(self, header=None, indent: str = "") -> None: ... diff --git a/stdlib/distutils/command/config.pyi b/stdlib/distutils/command/config.pyi index 562ff3a52..381e8e466 100644 --- a/stdlib/distutils/command/config.pyi +++ b/stdlib/distutils/command/config.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, StrOrBytesPath +from _typeshed import StrOrBytesPath from collections.abc import Sequence from re import Pattern from typing import ClassVar, Final, Literal @@ -81,4 +81,4 @@ class config(Command): self, header: str, include_dirs: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, lang: str = "c" ) -> bool: ... -def dump_file(filename: StrOrBytesPath, head: Incomplete | None = None) -> None: ... +def dump_file(filename: StrOrBytesPath, head=None) -> None: ... diff --git a/stdlib/distutils/command/register.pyi b/stdlib/distutils/command/register.pyi index cf98e178a..c3bd62aaa 100644 --- a/stdlib/distutils/command/register.pyi +++ b/stdlib/distutils/command/register.pyi @@ -1,4 +1,3 @@ -from _typeshed import Incomplete from collections.abc import Callable from typing import Any, ClassVar @@ -18,4 +17,4 @@ class register(PyPIRCCommand): def verify_metadata(self) -> None: ... def send_metadata(self) -> None: ... def build_post_data(self, action): ... - def post_to_server(self, data, auth: Incomplete | None = None): ... + def post_to_server(self, data, auth=None): ... diff --git a/stdlib/distutils/dist.pyi b/stdlib/distutils/dist.pyi index 09f2b456d..412b94131 100644 --- a/stdlib/distutils/dist.pyi +++ b/stdlib/distutils/dist.pyi @@ -112,9 +112,7 @@ class Distribution: command_obj: Incomplete have_run: Incomplete want_user_cfg: bool - def dump_option_dicts( - self, header: Incomplete | None = None, commands: Incomplete | None = None, indent: str = "" - ) -> None: ... + def dump_option_dicts(self, header=None, commands=None, indent: str = "") -> None: ... def find_config_files(self): ... commands: Incomplete def parse_command_line(self): ... diff --git a/stdlib/numbers.pyi b/stdlib/numbers.pyi index f2bca4e58..02d469ce0 100644 --- a/stdlib/numbers.pyi +++ b/stdlib/numbers.pyi @@ -7,7 +7,6 @@ # (since type checkers don't see `complex` as a subtype of `numbers.Complex`, # nor `float` as a subtype of `numbers.Real`, etc.) -from _typeshed import Incomplete from abc import ABCMeta, abstractmethod from typing import ClassVar, Literal, Protocol, overload @@ -166,7 +165,7 @@ class Integral(Rational, _IntegralLike): def __int__(self) -> int: ... def __index__(self) -> int: ... @abstractmethod - def __pow__(self, exponent, modulus: Incomplete | None = None) -> _IntegralLike: ... + def __pow__(self, exponent, modulus=None) -> _IntegralLike: ... @abstractmethod def __lshift__(self, other) -> _IntegralLike: ... @abstractmethod diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index e23ab07f1..c153ca499 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -312,7 +312,7 @@ class Event(Generic[_W_co]): def NoDefaultRoot() -> None: ... class Variable: - def __init__(self, master: Misc | None = None, value: Incomplete | None = None, name: str | None = None) -> None: ... + def __init__(self, master: Misc | None = None, value=None, name: str | None = None) -> None: ... def set(self, value) -> None: ... initialize = set def get(self): ... @@ -379,7 +379,7 @@ class Misc: children: dict[str, Widget] def destroy(self) -> None: ... def deletecommand(self, name: str) -> None: ... - def tk_strictMotif(self, boolean: Incomplete | None = None): ... + def tk_strictMotif(self, boolean=None): ... def tk_bisque(self) -> None: ... def tk_setPalette(self, *args, **kw) -> None: ... def wait_variable(self, name: str | Variable = "PY_VAR") -> None: ... @@ -442,15 +442,15 @@ class Misc: ) -> None: ... def option_clear(self) -> None: ... def option_get(self, name, className): ... - def option_readfile(self, fileName, priority: Incomplete | None = None) -> None: ... + def option_readfile(self, fileName, priority=None) -> None: ... def selection_clear(self, **kw) -> None: ... def selection_get(self, **kw): ... def selection_handle(self, command, **kw) -> None: ... def selection_own(self, **kw) -> None: ... def selection_own_get(self, **kw): ... def send(self, interp, cmd, *args): ... - def lower(self, belowThis: Incomplete | None = None) -> None: ... - def tkraise(self, aboveThis: Incomplete | None = None) -> None: ... + def lower(self, belowThis=None) -> None: ... + def tkraise(self, aboveThis=None) -> None: ... lift = tkraise if sys.version_info >= (3, 11): def info_patchlevel(self) -> _VersionInfoType: ... @@ -888,29 +888,23 @@ class Wm: @overload def wm_geometry(self, newGeometry: str) -> None: ... geometry = wm_geometry - def wm_grid( - self, - baseWidth: Incomplete | None = None, - baseHeight: Incomplete | None = None, - widthInc: Incomplete | None = None, - heightInc: Incomplete | None = None, - ): ... + def wm_grid(self, baseWidth=None, baseHeight=None, widthInc=None, heightInc=None): ... grid = wm_grid - def wm_group(self, pathName: Incomplete | None = None): ... + def wm_group(self, pathName=None): ... group = wm_group - def wm_iconbitmap(self, bitmap: Incomplete | None = None, default: Incomplete | None = None): ... + def wm_iconbitmap(self, bitmap=None, default=None): ... iconbitmap = wm_iconbitmap def wm_iconify(self) -> None: ... iconify = wm_iconify - def wm_iconmask(self, bitmap: Incomplete | None = None): ... + def wm_iconmask(self, bitmap=None): ... iconmask = wm_iconmask - def wm_iconname(self, newName: Incomplete | None = None) -> str: ... + def wm_iconname(self, newName=None) -> str: ... iconname = wm_iconname def wm_iconphoto(self, default: bool, image1: _PhotoImageLike | str, /, *args: _PhotoImageLike | str) -> None: ... iconphoto = wm_iconphoto def wm_iconposition(self, x: int | None = None, y: int | None = None) -> tuple[int, int] | None: ... iconposition = wm_iconposition - def wm_iconwindow(self, pathName: Incomplete | None = None): ... + def wm_iconwindow(self, pathName=None): ... iconwindow = wm_iconwindow def wm_manage(self, widget) -> None: ... manage = wm_manage @@ -1453,8 +1447,8 @@ class Canvas(Widget, XView, YView): @overload def tag_bind(self, tagOrId: str | int, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ... def tag_unbind(self, tagOrId: str | int, sequence: str, funcid: str | None = None) -> None: ... - def canvasx(self, screenx, gridspacing: Incomplete | None = None): ... - def canvasy(self, screeny, gridspacing: Incomplete | None = None): ... + def canvasx(self, screenx, gridspacing=None): ... + def canvasy(self, screeny, gridspacing=None): ... @overload def coords(self, tagOrId: str | int, /) -> list[float]: ... @overload @@ -2462,7 +2456,7 @@ class Listbox(Widget, XView, YView): select_set = selection_set def size(self) -> int: ... # type: ignore[override] def itemcget(self, index: str | int, option): ... - def itemconfigure(self, index: str | int, cnf: Incomplete | None = None, **kw): ... + def itemconfigure(self, index: str | int, cnf=None, **kw): ... itemconfig = itemconfigure class Menu(Widget): @@ -3142,7 +3136,7 @@ class Scrollbar(Widget): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def activate(self, index: Incomplete | None = None): ... + def activate(self, index=None): ... def delta(self, deltax: int, deltay: int) -> float: ... def fraction(self, x: int, y: int) -> float: ... def identify(self, x: int, y: int) -> Literal["arrow1", "arrow2", "slider", "trough1", "trough2", ""]: ... @@ -3625,7 +3619,7 @@ class Text(Widget, XView, YView): def yview_pickplace(self, *what): ... # deprecated class _setit: - def __init__(self, var, value, callback: Incomplete | None = None) -> None: ... + def __init__(self, var, value, callback=None) -> None: ... def __call__(self, *args) -> None: ... # manual page: tk_optionMenu @@ -3663,9 +3657,7 @@ class _PhotoImageLike(_Image): ... class Image(_Image): name: Incomplete tk: _tkinter.TkappType - def __init__( - self, imgtype, name: Incomplete | None = None, cnf={}, master: Misc | _tkinter.TkappType | None = None, **kw - ) -> None: ... + def __init__(self, imgtype, name=None, cnf={}, master: Misc | _tkinter.TkappType | None = None, **kw) -> None: ... def __del__(self) -> None: ... def __setitem__(self, key, value) -> None: ... def __getitem__(self, key): ... @@ -3791,7 +3783,7 @@ class BitmapImage(Image, _BitmapImageLike): # This should be kept in sync with PIL.ImageTK.BitmapImage.__init__() def __init__( self, - name: Incomplete | None = None, + name=None, cnf: dict[str, Any] = {}, master: Misc | _tkinter.TkappType | None = None, *, @@ -3925,7 +3917,7 @@ class Spinbox(Widget, XView): def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure def bbox(self, index) -> tuple[int, int, int, int] | None: ... # type: ignore[override] - def delete(self, first, last: Incomplete | None = None) -> Literal[""]: ... + def delete(self, first, last=None) -> Literal[""]: ... def get(self) -> str: ... def icursor(self, index): ... def identify(self, x: int, y: int) -> Literal["", "buttondown", "buttonup", "entry"]: ... @@ -3939,7 +3931,7 @@ class Spinbox(Widget, XView): def selection(self, *args) -> tuple[int, ...]: ... def selection_adjust(self, index): ... def selection_clear(self): ... # type: ignore[override] - def selection_element(self, element: Incomplete | None = None): ... + def selection_element(self, element=None): ... def selection_from(self, index: int) -> None: ... def selection_present(self) -> None: ... def selection_range(self, start: int, end: int) -> None: ... @@ -4082,7 +4074,7 @@ class PanedWindow(Widget): def sash_mark(self, index): ... def sash_place(self, index, x, y): ... def panecget(self, child, option): ... - def paneconfigure(self, tagOrId, cnf: Incomplete | None = None, **kw): ... + def paneconfigure(self, tagOrId, cnf=None, **kw): ... paneconfig: Incomplete def panes(self): ... diff --git a/stdlib/tkinter/commondialog.pyi b/stdlib/tkinter/commondialog.pyi index 201ca13dd..d5fc2f05c 100644 --- a/stdlib/tkinter/commondialog.pyi +++ b/stdlib/tkinter/commondialog.pyi @@ -8,5 +8,5 @@ class Dialog: command: ClassVar[str | None] master: Incomplete | None options: Mapping[str, Incomplete] - def __init__(self, master: Incomplete | None = None, **options) -> None: ... + def __init__(self, master=None, **options) -> None: ... def show(self, **options): ... diff --git a/stdlib/tkinter/dialog.pyi b/stdlib/tkinter/dialog.pyi index 3dc059940..971b64f09 100644 --- a/stdlib/tkinter/dialog.pyi +++ b/stdlib/tkinter/dialog.pyi @@ -1,4 +1,3 @@ -from _typeshed import Incomplete from collections.abc import Mapping from tkinter import Widget from typing import Any, Final @@ -10,5 +9,5 @@ DIALOG_ICON: Final = "questhead" class Dialog(Widget): widgetName: str num: int - def __init__(self, master: Incomplete | None = None, cnf: Mapping[str, Any] = {}, **kw) -> None: ... + def __init__(self, master=None, cnf: Mapping[str, Any] = {}, **kw) -> None: ... def destroy(self) -> None: ... diff --git a/stdlib/tkinter/filedialog.pyi b/stdlib/tkinter/filedialog.pyi index cafcf61e8..af033dae9 100644 --- a/stdlib/tkinter/filedialog.pyi +++ b/stdlib/tkinter/filedialog.pyi @@ -38,21 +38,21 @@ class FileDialog: filter_button: Button cancel_button: Button def __init__( - self, master, title: Incomplete | None = None + self, master, title=None ) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either how: Incomplete | None - def go(self, dir_or_file=".", pattern: str = "*", default: str = "", key: Incomplete | None = None): ... - def quit(self, how: Incomplete | None = None) -> None: ... + def go(self, dir_or_file=".", pattern: str = "*", default: str = "", key=None): ... + def quit(self, how=None) -> None: ... def dirs_double_event(self, event) -> None: ... def dirs_select_event(self, event) -> None: ... def files_double_event(self, event) -> None: ... def files_select_event(self, event) -> None: ... def ok_event(self, event) -> None: ... def ok_command(self) -> None: ... - def filter_command(self, event: Incomplete | None = None) -> None: ... + def filter_command(self, event=None) -> None: ... def get_filter(self): ... def get_selection(self): ... - def cancel_command(self, event: Incomplete | None = None) -> None: ... + def cancel_command(self, event=None) -> None: ... def set_filter(self, dir, pat) -> None: ... def set_selection(self, file) -> None: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index ab3c01093..50b9cd8f9 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -35,7 +35,7 @@ __all__ = [ ] def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ... -def setup_master(master: Incomplete | None = None): ... +def setup_master(master=None): ... _Padding: TypeAlias = ( tkinter._ScreenUnits @@ -52,14 +52,14 @@ class Style: master: Incomplete tk: _tkinter.TkappType def __init__(self, master: tkinter.Misc | None = None) -> None: ... - def configure(self, style, query_opt: Incomplete | None = None, **kw): ... - def map(self, style, query_opt: Incomplete | None = None, **kw): ... - def lookup(self, style, option, state: Incomplete | None = None, default: Incomplete | None = None): ... - def layout(self, style, layoutspec: Incomplete | None = None): ... + def configure(self, style, query_opt=None, **kw): ... + def map(self, style, query_opt=None, **kw): ... + def lookup(self, style, option, state=None, default=None): ... + def layout(self, style, layoutspec=None): ... def element_create(self, elementname, etype, *args, **kw) -> None: ... def element_names(self): ... def element_options(self, elementname): ... - def theme_create(self, themename, parent: Incomplete | None = None, settings: Incomplete | None = None) -> None: ... + def theme_create(self, themename, parent=None, settings=None) -> None: ... def theme_settings(self, themename, settings) -> None: ... def theme_names(self) -> tuple[str, ...]: ... @overload @@ -68,10 +68,10 @@ class Style: def theme_use(self, themename: None = None) -> str: ... class Widget(tkinter.Widget): - def __init__(self, master: tkinter.Misc | None, widgetname, kw: Incomplete | None = None) -> None: ... + def __init__(self, master: tkinter.Misc | None, widgetname, kw=None) -> None: ... def identify(self, x: int, y: int) -> str: ... - def instate(self, statespec, callback: Incomplete | None = None, *args, **kw): ... - def state(self, statespec: Incomplete | None = None): ... + def instate(self, statespec, callback=None, *args, **kw): ... + def state(self, statespec=None): ... class Button(Widget): def __init__( @@ -567,8 +567,8 @@ class Notebook(Widget): def identify(self, x: int, y: int) -> str: ... def index(self, tab_id): ... def insert(self, pos, child, **kw) -> None: ... - def select(self, tab_id: Incomplete | None = None): ... - def tab(self, tab_id, option: Incomplete | None = None, **kw): ... + def select(self, tab_id=None): ... + def tab(self, tab_id, option=None, **kw): ... def tabs(self): ... def enable_traversal(self) -> None: ... @@ -617,8 +617,8 @@ class Panedwindow(Widget, tkinter.PanedWindow): def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... forget: Incomplete def insert(self, pos, child, **kw) -> None: ... - def pane(self, pane, option: Incomplete | None = None, **kw): ... - def sashpos(self, index, newpos: Incomplete | None = None): ... + def pane(self, pane, option=None, **kw): ... + def sashpos(self, index, newpos=None): ... PanedWindow = Panedwindow