mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Enable flake8-pyi's Y037 (#9686)
This commit is contained in:
@@ -6,7 +6,7 @@ from enum import Enum
|
||||
from tkinter.constants import *
|
||||
from tkinter.font import _FontDescription
|
||||
from types import TracebackType
|
||||
from typing import Any, Generic, NamedTuple, Protocol, TypeVar, Union, overload
|
||||
from typing import Any, Generic, NamedTuple, Protocol, TypeVar, overload
|
||||
from typing_extensions import Literal, TypeAlias, TypedDict
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -179,7 +179,7 @@ _CanvasItemId: TypeAlias = int
|
||||
_Color: TypeAlias = str # typically '#rrggbb', '#rgb' or color names.
|
||||
_Compound: TypeAlias = Literal["top", "left", "center", "right", "bottom", "none"] # -compound in manual page named 'options'
|
||||
# manual page: Tk_GetCursor
|
||||
_Cursor: TypeAlias = Union[str, tuple[str], tuple[str, str], tuple[str, str, str], tuple[str, str, str, str]]
|
||||
_Cursor: TypeAlias = str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str]
|
||||
# example when it's sequence: entry['invalidcommand'] = [entry.register(print), '%P']
|
||||
_EntryValidateCommand: TypeAlias = str | list[str] | tuple[str, ...] | Callable[[], bool]
|
||||
_GridIndex: TypeAlias = int | str
|
||||
@@ -188,7 +188,7 @@ _Relief: TypeAlias = Literal["raised", "sunken", "flat", "ridge", "solid", "groo
|
||||
_ScreenUnits: TypeAlias = str | float # Often the right type instead of int. Manual page: Tk_GetPixels
|
||||
# -xscrollcommand and -yscrollcommand in 'options' manual page
|
||||
_XYScrollCommand: TypeAlias = str | Callable[[float, float], object]
|
||||
_TakeFocusValue: TypeAlias = Union[int, Literal[""], Callable[[str], bool | None]] # -takefocus in manual page named 'options'
|
||||
_TakeFocusValue: TypeAlias = int | Literal[""] | Callable[[str], bool | None] # -takefocus in manual page named 'options'
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class _VersionInfoType(NamedTuple):
|
||||
|
||||
@@ -4,7 +4,7 @@ import tkinter
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from tkinter.font import _FontDescription
|
||||
from typing import Any, Union, overload
|
||||
from typing import Any, overload
|
||||
from typing_extensions import Literal, TypeAlias, TypedDict
|
||||
|
||||
__all__ = [
|
||||
@@ -38,13 +38,13 @@ __all__ = [
|
||||
def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ...
|
||||
def setup_master(master: Incomplete | None = None): ...
|
||||
|
||||
_Padding: TypeAlias = Union[
|
||||
tkinter._ScreenUnits,
|
||||
tuple[tkinter._ScreenUnits],
|
||||
tuple[tkinter._ScreenUnits, tkinter._ScreenUnits],
|
||||
tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits],
|
||||
tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits],
|
||||
]
|
||||
_Padding: TypeAlias = (
|
||||
tkinter._ScreenUnits
|
||||
| tuple[tkinter._ScreenUnits]
|
||||
| tuple[tkinter._ScreenUnits, tkinter._ScreenUnits]
|
||||
| tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits]
|
||||
| tuple[tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits, tkinter._ScreenUnits]
|
||||
)
|
||||
|
||||
# from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound
|
||||
_TtkCompound: TypeAlias = Literal["text", "image", tkinter._Compound]
|
||||
|
||||
Reference in New Issue
Block a user