Skip to content

Commit 916bb2f

Browse files
committed
[tkinter] Remove _WhatToCount alias
1 parent fb21402 commit 916bb2f

File tree

1 file changed

+93
-28
lines changed

1 file changed

+93
-28
lines changed

stdlib/tkinter/__init__.pyi

Lines changed: 93 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3146,9 +3146,6 @@ class Scrollbar(Widget):
31463146
def set(self, first: float | str, last: float | str) -> None: ...
31473147

31483148
_TextIndex: TypeAlias = _tkinter.Tcl_Obj | str | float | Misc
3149-
_WhatToCount: TypeAlias = Literal[
3150-
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"
3151-
]
31523149

31533150
class Text(Widget, XView, YView):
31543151
def __init__(
@@ -3268,15 +3265,23 @@ class Text(Widget, XView, YView):
32683265
def count(self, index1: _TextIndex, index2: _TextIndex, *, return_ints: Literal[True]) -> int: ...
32693266
@overload
32703267
def count(
3271-
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /, *, return_ints: Literal[True]
3268+
self,
3269+
index1: _TextIndex,
3270+
index2: _TextIndex,
3271+
arg: Literal[
3272+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3273+
],
3274+
/,
3275+
*,
3276+
return_ints: Literal[True],
32723277
) -> int: ...
32733278
@overload
32743279
def count(
32753280
self,
32763281
index1: _TextIndex,
32773282
index2: _TextIndex,
32783283
arg1: Literal["update"],
3279-
arg2: _WhatToCount,
3284+
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
32803285
/,
32813286
*,
32823287
return_ints: Literal[True],
@@ -3286,26 +3291,41 @@ class Text(Widget, XView, YView):
32863291
self,
32873292
index1: _TextIndex,
32883293
index2: _TextIndex,
3289-
arg1: _WhatToCount,
3294+
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
32903295
arg2: Literal["update"],
32913296
/,
32923297
*,
32933298
return_ints: Literal[True],
32943299
) -> int: ...
32953300
@overload
32963301
def count(
3297-
self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /, *, return_ints: Literal[True]
3302+
self,
3303+
index1: _TextIndex,
3304+
index2: _TextIndex,
3305+
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
3306+
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
3307+
/,
3308+
*,
3309+
return_ints: Literal[True],
32983310
) -> tuple[int, int]: ...
32993311
@overload
33003312
def count(
33013313
self,
33023314
index1: _TextIndex,
33033315
index2: _TextIndex,
3304-
arg1: _WhatToCount | Literal["update"],
3305-
arg2: _WhatToCount | Literal["update"],
3306-
arg3: _WhatToCount | Literal["update"],
3316+
arg1: Literal[
3317+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3318+
],
3319+
arg2: Literal[
3320+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3321+
],
3322+
arg3: Literal[
3323+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3324+
],
33073325
/,
3308-
*args: _WhatToCount | Literal["update"],
3326+
*args: Literal[
3327+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3328+
],
33093329
return_ints: Literal[True],
33103330
) -> tuple[int, ...]: ...
33113331
@overload
@@ -3315,7 +3335,9 @@ class Text(Widget, XView, YView):
33153335
self,
33163336
index1: _TextIndex,
33173337
index2: _TextIndex,
3318-
arg: _WhatToCount | Literal["update"],
3338+
arg: Literal[
3339+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3340+
],
33193341
/,
33203342
*,
33213343
return_ints: Literal[False] = False,
@@ -3326,7 +3348,7 @@ class Text(Widget, XView, YView):
33263348
index1: _TextIndex,
33273349
index2: _TextIndex,
33283350
arg1: Literal["update"],
3329-
arg2: _WhatToCount,
3351+
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
33303352
/,
33313353
*,
33323354
return_ints: Literal[False] = False,
@@ -3336,7 +3358,7 @@ class Text(Widget, XView, YView):
33363358
self,
33373359
index1: _TextIndex,
33383360
index2: _TextIndex,
3339-
arg1: _WhatToCount,
3361+
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
33403362
arg2: Literal["update"],
33413363
/,
33423364
*,
@@ -3347,8 +3369,8 @@ class Text(Widget, XView, YView):
33473369
self,
33483370
index1: _TextIndex,
33493371
index2: _TextIndex,
3350-
arg1: _WhatToCount,
3351-
arg2: _WhatToCount,
3372+
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
3373+
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
33523374
/,
33533375
*,
33543376
return_ints: Literal[False] = False,
@@ -3358,36 +3380,79 @@ class Text(Widget, XView, YView):
33583380
self,
33593381
index1: _TextIndex,
33603382
index2: _TextIndex,
3361-
arg1: _WhatToCount | Literal["update"],
3362-
arg2: _WhatToCount | Literal["update"],
3363-
arg3: _WhatToCount | Literal["update"],
3383+
arg1: Literal[
3384+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3385+
],
3386+
arg2: Literal[
3387+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3388+
],
3389+
arg3: Literal[
3390+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3391+
],
33643392
/,
3365-
*args: _WhatToCount | Literal["update"],
3393+
*args: Literal[
3394+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3395+
],
33663396
return_ints: Literal[False] = False,
33673397
) -> tuple[int, ...]: ...
33683398
else:
33693399
@overload
33703400
def count(self, index1: _TextIndex, index2: _TextIndex) -> tuple[int] | None: ...
33713401
@overload
33723402
def count(
3373-
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /
3403+
self,
3404+
index1: _TextIndex,
3405+
index2: _TextIndex,
3406+
arg: Literal[
3407+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3408+
],
3409+
/,
33743410
) -> tuple[int] | None: ...
33753411
@overload
3376-
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: Literal["update"], arg2: _WhatToCount, /) -> int | None: ...
3412+
def count(
3413+
self,
3414+
index1: _TextIndex,
3415+
index2: _TextIndex,
3416+
arg1: Literal["update"],
3417+
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
3418+
/,
3419+
) -> int | None: ...
33773420
@overload
3378-
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: Literal["update"], /) -> int | None: ...
3421+
def count(
3422+
self,
3423+
index1: _TextIndex,
3424+
index2: _TextIndex,
3425+
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
3426+
arg2: Literal["update"],
3427+
/,
3428+
) -> int | None: ...
33793429
@overload
3380-
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /) -> tuple[int, int]: ...
3430+
def count(
3431+
self,
3432+
index1: _TextIndex,
3433+
index2: _TextIndex,
3434+
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
3435+
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
3436+
/,
3437+
) -> tuple[int, int]: ...
33813438
@overload
33823439
def count(
33833440
self,
33843441
index1: _TextIndex,
33853442
index2: _TextIndex,
3386-
arg1: _WhatToCount | Literal["update"],
3387-
arg2: _WhatToCount | Literal["update"],
3388-
arg3: _WhatToCount | Literal["update"],
3443+
arg1: Literal[
3444+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3445+
],
3446+
arg2: Literal[
3447+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3448+
],
3449+
arg3: Literal[
3450+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3451+
],
33893452
/,
3390-
*args: _WhatToCount | Literal["update"],
3453+
*args: Literal[
3454+
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
3455+
],
33913456
) -> tuple[int, ...]: ...
33923457

33933458
@overload

0 commit comments

Comments
 (0)