Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)

This commit is contained in:
Alex Waygood
2022-01-18 15:14:03 +00:00
committed by GitHub
parent aa885ecd65
commit 8af5e0d340
264 changed files with 2217 additions and 2411 deletions

View File

@@ -1,8 +1,8 @@
import datetime
from time import struct_time
from typing import Any, Iterable, List, Optional, Sequence, Tuple
from typing import Any, Iterable, Optional, Sequence
_LocaleType = Tuple[Optional[str], Optional[str]]
_LocaleType = tuple[Optional[str], Optional[str]]
class IllegalMonthError(ValueError):
def __init__(self, month: int) -> None: ...
@@ -15,7 +15,7 @@ class IllegalWeekdayError(ValueError):
def isleap(year: int) -> bool: ...
def leapdays(y1: int, y2: int) -> int: ...
def weekday(year: int, month: int, day: int) -> int: ...
def monthrange(year: int, month: int) -> Tuple[int, int]: ...
def monthrange(year: int, month: int) -> tuple[int, int]: ...
class Calendar:
firstweekday: int
@@ -24,14 +24,14 @@ class Calendar:
def setfirstweekday(self, firstweekday: int) -> None: ...
def iterweekdays(self) -> Iterable[int]: ...
def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ...
def itermonthdays2(self, year: int, month: int) -> Iterable[Tuple[int, int]]: ...
def itermonthdays2(self, year: int, month: int) -> Iterable[tuple[int, int]]: ...
def itermonthdays(self, year: int, month: int) -> Iterable[int]: ...
def monthdatescalendar(self, year: int, month: int) -> List[List[datetime.date]]: ...
def monthdays2calendar(self, year: int, month: int) -> List[List[Tuple[int, int]]]: ...
def monthdayscalendar(self, year: int, month: int) -> List[List[int]]: ...
def yeardatescalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
def yeardays2calendar(self, year: int, width: int = ...) -> List[List[Tuple[int, int]]]: ...
def yeardayscalendar(self, year: int, width: int = ...) -> List[List[int]]: ...
def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: ...
def monthdays2calendar(self, year: int, month: int) -> list[list[tuple[int, int]]]: ...
def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: ...
def yeardatescalendar(self, year: int, width: int = ...) -> list[list[int]]: ...
def yeardays2calendar(self, year: int, width: int = ...) -> list[list[tuple[int, int]]]: ...
def yeardayscalendar(self, year: int, width: int = ...) -> list[list[int]]: ...
class TextCalendar(Calendar):
def prweek(self, theweek: int, width: int) -> None: ...
@@ -46,7 +46,7 @@ class TextCalendar(Calendar):
def pryear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ...
def firstweekday() -> int: ...
def monthcalendar(year: int, month: int) -> List[List[int]]: ...
def monthcalendar(year: int, month: int) -> list[list[int]]: ...
def prweek(theweek: int, width: int) -> None: ...
def week(theweek: int, width: int) -> str: ...
def weekheader(width: int) -> str: ...
@@ -85,7 +85,7 @@ c: TextCalendar
def setfirstweekday(firstweekday: int) -> None: ...
def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ...
def timegm(tuple: Tuple[int, ...] | struct_time) -> int: ...
def timegm(tuple: tuple[int, ...] | struct_time) -> int: ...
# Data attributes
day_name: Sequence[str]