Skip to content

Commit 1163a91

Browse files
committed
Upgrade black to 26.5.0
1 parent 098f30e commit 1163a91

598 files changed

Lines changed: 3028 additions & 37 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727
- "--unsafe-fixes"
2828
files: '.*test_cases/.+\.py$'
2929
- repo: https://github.com/psf/black-pre-commit-mirror
30-
rev: 26.3.1
30+
rev: 26.5.0
3131
hooks:
3232
- id: black
3333
- repo: https://github.com/pycqa/flake8

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ requires-python = ">=3.10" # Minimum version to run tests, used by uv run
99
line-length = 130
1010
target-version = ["py310"]
1111
skip-magic-trailing-comma = true
12+
preview = true
1213

1314
[tool.ruff]
1415
line-length = 130

stdlib/_asyncio.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ class Future(Awaitable[_T]):
1616
@property
1717
def _exception(self) -> BaseException | None: ...
1818
_blocking: bool
19+
1920
@property
2021
def _log_traceback(self) -> bool: ...
2122
@_log_traceback.setter
2223
def _log_traceback(self, val: Literal[False]) -> None: ...
24+
2325
_asyncio_future_blocking: bool # is a part of duck-typing contract for `Future`
2426
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
2527
def __del__(self) -> None: ...

stdlib/_bisect.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def bisect_left(
3838
def bisect_left(
3939
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT]
4040
) -> int: ...
41+
4142
@overload
4243
def bisect_right(
4344
a: SupportsLenAndGetItem[SupportsRichComparisonT],
@@ -72,6 +73,7 @@ def bisect_right(
7273
def bisect_right(
7374
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT]
7475
) -> int: ...
76+
7577
@overload
7678
def insort_left(
7779
a: MutableSequence[SupportsRichComparisonT],
@@ -85,6 +87,7 @@ def insort_left(
8587
def insort_left(
8688
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
8789
) -> None: ...
90+
8891
@overload
8992
def insort_right(
9093
a: MutableSequence[SupportsRichComparisonT],

stdlib/_codecs.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "
4949
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[overload-overlap]
5050
@overload
5151
def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
52+
5253
@overload
5354
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[overload-overlap]
5455
@overload
@@ -67,6 +68,7 @@ def decode(
6768
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ...
6869
@overload
6970
def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...
71+
7072
def lookup(encoding: str, /) -> codecs.CodecInfo: ...
7173
def charmap_build(map: str, /) -> _CharMap: ...
7274
def ascii_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...

stdlib/_contextvars.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ class ContextVar(Generic[_T]):
1414
def __new__(cls, name: str) -> Self: ...
1515
@overload
1616
def __new__(cls, name: str, *, default: _T) -> Self: ...
17+
1718
def __hash__(self) -> int: ...
1819
@property
1920
def name(self) -> str: ...
21+
2022
@overload
2123
def get(self) -> _T: ...
2224
@overload
2325
def get(self, default: _T, /) -> _T: ...
2426
@overload
2527
def get(self, default: _D, /) -> _D | _T: ...
28+
2629
def set(self, value: _T, /) -> Token[_T]: ...
2730
def reset(self, token: Token[_T], /) -> None: ...
2831
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
@@ -49,12 +52,14 @@ def copy_context() -> Context: ...
4952
@final
5053
class Context(Mapping[ContextVar[Any], Any]):
5154
def __init__(self) -> None: ...
55+
5256
@overload
5357
def get(self, key: ContextVar[_T], default: None = None, /) -> _T | None: ...
5458
@overload
5559
def get(self, key: ContextVar[_T], default: _T, /) -> _T: ...
5660
@overload
5761
def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ...
62+
5863
def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
5964
def copy(self) -> Context: ...
6065
__hash__: ClassVar[None] # type: ignore[assignment]

stdlib/_ctypes.pyi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,25 @@ class _PyCPointerType(_CTypeBaseType):
127127
class _Pointer(_PointerLike, _CData, Generic[_CT], metaclass=_PyCPointerType):
128128
_type_: type[_CT]
129129
contents: _CT
130+
130131
@overload
131132
def __init__(self) -> None: ...
132133
@overload
133134
def __init__(self, arg: _CT) -> None: ...
135+
134136
@overload
135137
def __getitem__(self, key: int, /) -> Any: ...
136138
@overload
137139
def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ...
140+
138141
def __setitem__(self, key: int, value: Any, /) -> None: ...
139142

140143
if sys.version_info < (3, 14):
141144
@overload
142145
def POINTER(type: None, /) -> type[c_void_p]: ...
143146
@overload
144147
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ...
148+
145149
def pointer(obj: _CT, /) -> _Pointer[_CT]: ...
146150

147151
# This class is not exposed. It calls itself _ctypes.CArgObject.
@@ -177,6 +181,7 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType):
177181
errcheck: _ECT
178182
# Abstract attribute that must be defined on subclasses
179183
_flags_: ClassVar[int]
184+
180185
@overload
181186
def __new__(cls) -> Self: ...
182187
@overload
@@ -209,10 +214,12 @@ if sys.version_info >= (3, 14):
209214
bit_offset: int
210215
bit_size: int
211216
is_anonymous: bool
217+
212218
@overload
213219
def __get__(self, instance: None, owner: builtins.type[Any] | None = None, /) -> Self: ...
214220
@overload
215221
def __get__(self, instance: Any, owner: builtins.type[Any] | None = None, /) -> _GetT: ...
222+
216223
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
217224

218225
_CField = CField
@@ -223,10 +230,12 @@ else:
223230
class _CField(Generic[_CT, _GetT, _SetT]):
224231
offset: int
225232
size: int
233+
226234
@overload
227235
def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ...
228236
@overload
229237
def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ...
238+
230239
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
231240

232241
# This class is not exposed. It calls itself _ctypes.UnionType.
@@ -308,16 +317,19 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
308317
def _length_(self) -> int: ...
309318
@_length_.setter
310319
def _length_(self, value: int) -> None: ...
320+
311321
@property
312322
@abstractmethod
313323
def _type_(self) -> type[_CT]: ...
314324
@_type_.setter
315325
def _type_(self, value: type[_CT]) -> None: ...
326+
316327
# Note: only available if _CT == c_char
317328
@property
318329
def raw(self) -> bytes: ...
319330
@raw.setter
320331
def raw(self, value: ReadableBuffer) -> None: ...
332+
321333
value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
322334
# TODO: These methods cannot be annotated correctly at the moment.
323335
# All of these "Any"s stand for the array's element type, but it's not possible to use _CT
@@ -332,14 +344,17 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
332344
# This special behavior is not easy to model in a stub, so for now all places where
333345
# the array element type would belong are annotated with Any instead.
334346
def __init__(self, *args: Any) -> None: ...
347+
335348
@overload
336349
def __getitem__(self, key: int, /) -> Any: ...
337350
@overload
338351
def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ...
352+
339353
@overload
340354
def __setitem__(self, key: int, value: Any, /) -> None: ...
341355
@overload
342356
def __setitem__(self, key: slice[SupportsIndex | None], value: Iterable[Any], /) -> None: ...
357+
343358
def __iter__(self) -> Iterator[Any]: ...
344359
# Can't inherit from Sized because the metaclass conflict between
345360
# Sized and _CData prevents using _CDataMeta.

stdlib/_curses.pyi

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,18 +375,22 @@ class error(Exception): ...
375375
@final
376376
class window: # undocumented
377377
encoding: str
378+
378379
@overload
379380
def addch(self, ch: _ChType, attr: int = ...) -> None: ...
380381
@overload
381382
def addch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ...
383+
382384
@overload
383385
def addnstr(self, str: str, n: int, attr: int = ...) -> None: ...
384386
@overload
385387
def addnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ...
388+
386389
@overload
387390
def addstr(self, str: str, attr: int = ...) -> None: ...
388391
@overload
389392
def addstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ...
393+
390394
def attroff(self, attr: int, /) -> None: ...
391395
def attron(self, attr: int, /) -> None: ...
392396
def attrset(self, attr: int, /) -> None: ...
@@ -403,10 +407,12 @@ class window: # undocumented
403407
bl: _ChType = ...,
404408
br: _ChType = ...,
405409
) -> None: ...
410+
406411
@overload
407412
def box(self) -> None: ...
408413
@overload
409414
def box(self, vertch: _ChType = 0, horch: _ChType = 0) -> None: ...
415+
410416
@overload
411417
def chgat(self, attr: int) -> None: ...
412418
@overload
@@ -415,39 +421,49 @@ class window: # undocumented
415421
def chgat(self, y: int, x: int, attr: int) -> None: ...
416422
@overload
417423
def chgat(self, y: int, x: int, num: int, attr: int) -> None: ...
424+
418425
def clear(self) -> None: ...
419426
def clearok(self, yes: int) -> None: ...
420427
def clrtobot(self) -> None: ...
421428
def clrtoeol(self) -> None: ...
422429
def cursyncup(self) -> None: ...
430+
423431
@overload
424432
def delch(self) -> None: ...
425433
@overload
426434
def delch(self, y: int, x: int) -> None: ...
435+
427436
def deleteln(self) -> None: ...
437+
428438
@overload
429439
def derwin(self, begin_y: int, begin_x: int) -> window: ...
430440
@overload
431441
def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...
442+
432443
def echochar(self, ch: _ChType, attr: int = 0, /) -> None: ...
433444
def enclose(self, y: int, x: int, /) -> bool: ...
434445
def erase(self) -> None: ...
435446
def getbegyx(self) -> tuple[int, int]: ...
436447
def getbkgd(self) -> tuple[int, int]: ...
448+
437449
@overload
438450
def getch(self) -> int: ...
439451
@overload
440452
def getch(self, y: int, x: int) -> int: ...
453+
441454
@overload
442455
def get_wch(self) -> int | str: ...
443456
@overload
444457
def get_wch(self, y: int, x: int) -> int | str: ...
458+
445459
@overload
446460
def getkey(self) -> str: ...
447461
@overload
448462
def getkey(self, y: int, x: int) -> str: ...
463+
449464
def getmaxyx(self) -> tuple[int, int]: ...
450465
def getparyx(self) -> tuple[int, int]: ...
466+
451467
@overload
452468
def getstr(self) -> bytes: ...
453469
@overload
@@ -456,36 +472,46 @@ class window: # undocumented
456472
def getstr(self, y: int, x: int) -> bytes: ...
457473
@overload
458474
def getstr(self, y: int, x: int, n: int) -> bytes: ...
475+
459476
def getyx(self) -> tuple[int, int]: ...
477+
460478
@overload
461479
def hline(self, ch: _ChType, n: int) -> None: ...
462480
@overload
463481
def hline(self, y: int, x: int, ch: _ChType, n: int) -> None: ...
482+
464483
def idcok(self, flag: bool) -> None: ...
465484
def idlok(self, yes: bool) -> None: ...
466485
def immedok(self, flag: bool) -> None: ...
486+
467487
@overload
468488
def inch(self) -> int: ...
469489
@overload
470490
def inch(self, y: int, x: int) -> int: ...
491+
471492
@overload
472493
def insch(self, ch: _ChType, attr: int = ...) -> None: ...
473494
@overload
474495
def insch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ...
496+
475497
def insdelln(self, nlines: int) -> None: ...
476498
def insertln(self) -> None: ...
499+
477500
@overload
478501
def insnstr(self, str: str, n: int, attr: int = ...) -> None: ...
479502
@overload
480503
def insnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ...
504+
481505
@overload
482506
def insstr(self, str: str, attr: int = ...) -> None: ...
483507
@overload
484508
def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ...
509+
485510
@overload
486511
def instr(self, n: int = 2047) -> bytes: ...
487512
@overload
488513
def instr(self, y: int, x: int, n: int = 2047) -> bytes: ...
514+
489515
def is_linetouched(self, line: int, /) -> bool: ...
490516
def is_wintouched(self) -> bool: ...
491517
def keypad(self, yes: bool, /) -> None: ...
@@ -495,50 +521,60 @@ class window: # undocumented
495521
def mvwin(self, new_y: int, new_x: int) -> None: ...
496522
def nodelay(self, yes: bool) -> None: ...
497523
def notimeout(self, yes: bool) -> None: ...
524+
498525
@overload
499526
def noutrefresh(self) -> None: ...
500527
@overload
501528
def noutrefresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ...
529+
502530
@overload
503531
def overlay(self, destwin: window) -> None: ...
504532
@overload
505533
def overlay(
506534
self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int
507535
) -> None: ...
536+
508537
@overload
509538
def overwrite(self, destwin: window) -> None: ...
510539
@overload
511540
def overwrite(
512541
self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int
513542
) -> None: ...
543+
514544
def putwin(self, file: SupportsWrite[bytes], /) -> None: ...
515545
def redrawln(self, beg: int, num: int, /) -> None: ...
516546
def redrawwin(self) -> None: ...
547+
517548
@overload
518549
def refresh(self) -> None: ...
519550
@overload
520551
def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ...
552+
521553
def resize(self, nlines: int, ncols: int) -> None: ...
522554
def scroll(self, lines: int = 1) -> None: ...
523555
def scrollok(self, flag: bool) -> None: ...
524556
def setscrreg(self, top: int, bottom: int, /) -> None: ...
525557
def standend(self) -> None: ...
526558
def standout(self) -> None: ...
559+
527560
@overload
528561
def subpad(self, begin_y: int, begin_x: int) -> window: ...
529562
@overload
530563
def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...
564+
531565
@overload
532566
def subwin(self, begin_y: int, begin_x: int) -> window: ...
533567
@overload
534568
def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...
569+
535570
def syncdown(self) -> None: ...
536571
def syncok(self, flag: bool) -> None: ...
537572
def syncup(self) -> None: ...
538573
def timeout(self, delay: int) -> None: ...
539574
def touchline(self, start: int, count: int, changed: bool = True) -> None: ...
540575
def touchwin(self) -> None: ...
541576
def untouchwin(self) -> None: ...
577+
542578
@overload
543579
def vline(self, ch: _ChType, n: int) -> None: ...
544580
@overload

0 commit comments

Comments
 (0)