Remove True/False/None optional arguments.

Use Optional[...] when appropriate.
Adhere to PEP-484 styling.
This commit is contained in:
Lorenzo Bolla
2016-02-24 21:01:41 +00:00
parent d872968e32
commit ce938b367b
2 changed files with 38 additions and 46 deletions

View File

@@ -11,10 +11,6 @@ LocaleType = Tuple[Optional[str], Optional[str]]
_colwidth = ... # type: int
_spacing = ... # type: int
# TODO mypy complains about missing True/False
True = ... # type: bool
False = ... # type: bool
class IllegalMonthError(ValueError):
def __init__(self, month: MonthType) -> None: ...
def __str__(self) -> str: ...
@@ -29,7 +25,7 @@ def weekday(year: YearType, month: MonthType, day: DayType) -> WeekdayType: ...
def monthrange(year: YearType, month: MonthType) -> Tuple[WeekdayType, int]: ...
class Calendar(object):
def __init__(self, firstweekday: WeekdayType=0) -> None: ...
def __init__(self, firstweekday: WeekdayType = 0) -> None: ...
def getfirstweekday(self) -> WeekdayType: ...
def setfirstweekday(self, firstweekday: WeekdayType) -> None: ...
def iterweekdays(self) -> Iterable[WeekdayType]: ...
@@ -39,9 +35,9 @@ class Calendar(object):
def monthdatescalendar(self, year: YearType, month: MonthType) -> List[List[datetime.date]]: ...
def monthdays2calendar(self, year: YearType, month: MonthType) -> List[List[Tuple[DayType, WeekdayType]]]: ...
def monthdayscalendar(self, year: YearType, month: MonthType) -> List[List[DayType]]: ...
def yeardatescalendar(self, year: YearType, width: int=3) -> List[List[DayType]]: ...
def yeardays2calendar(self, year: YearType, width: int=3) -> List[List[Tuple[DayType, WeekdayType]]]: ...
def yeardayscalendar(self, year: YearType, width: int=3) -> List[List[DayType]]: ...
def yeardatescalendar(self, year: YearType, width: int = 3) -> List[List[DayType]]: ...
def yeardays2calendar(self, year: YearType, width: int = 3) -> List[List[Tuple[DayType, WeekdayType]]]: ...
def yeardayscalendar(self, year: YearType, width: int = 3) -> List[List[DayType]]: ...
class TextCalendar(Calendar):
def prweek(self, theweek: int, width: int) -> None: ...
@@ -49,21 +45,21 @@ class TextCalendar(Calendar):
def formatweek(self, theweek: int, width: int) -> str: ...
def formatweekday(self, day: DayType, width: int) -> str: ...
def formatweekheader(self, width: int) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool=True) -> str: ...
def prmonth(self, theyear: YearType, themonth: MonthType, w: Any=0, l: Any=0) -> None: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, w: int=0, l: int=0) -> str: ...
def formatyear(self, theyear: YearType, w: int=2, l: int=1, c: int=6, m: int=3) -> str: ...
def pryear(self, theyear: YearType, w: Any=0, l: Any=0, c: Any=6, m: Any=3) -> None: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool = ...) -> str: ...
def prmonth(self, theyear: YearType, themonth: MonthType, w: Any=0, l: Any = 0) -> None: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, w: int = 0, l: int = 0) -> str: ...
def formatyear(self, theyear: YearType, w: int=2, l: int=1, c: int = 6, m: int = 3) -> str: ...
def pryear(self, theyear: YearType, w: Any = 0, l: Any = 0, c: Any = 6, m: Any = 3) -> None: ...
class HTMLCalendar(Calendar):
def formatday(self, day: DayType, weekday: WeekdayType) -> str: ...
def formatweek(self, theweek: int) -> str: ...
def formatweekday(self, day: DayType) -> str: ...
def formatweekheader(self) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool=True) -> str: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, withyear: bool=True) -> str: ...
def formatyear(self, theyear: YearType, width: int=3) -> str: ...
def formatyearpage(self, theyear: YearType, width: int=3, css: Optional[str]='calendar.css', encoding: Optional[str]=None) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool = ...) -> str: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, withyear: bool = ...) -> str: ...
def formatyear(self, theyear: YearType, width: int = 3) -> str: ...
def formatyearpage(self, theyear: YearType, width: int = 3, css: Optional[str] = 'calendar.css', encoding: Optional[str] = ...) -> str: ...
class TimeEncoding:
def __init__(self, locale: LocaleType) -> None: ...
@@ -71,17 +67,17 @@ class TimeEncoding:
def __exit__(self, *args) -> None: ...
class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday: WeekdayType=0, locale: LocaleType=None) -> None: ...
def __init__(self, firstweekday: WeekdayType = 0, locale: Optional[LocaleType] = ...) -> None: ...
def formatweekday(self, day: DayType, width: int) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool=True) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool = ...) -> str: ...
class LocaleHTMLCalendar(HTMLCalendar):
def __init__(self, firstweekday: WeekdayType=0, locale: LocaleType=None) -> None: ...
def __init__(self, firstweekday: WeekdayType = 0, locale: Optional[LocaleType] = ...) -> None: ...
def formatweekday(self, day: DayType) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool=True) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool = ...) -> str: ...
c = ... # type: TextCalendar
def setfirstweekday(firstweekday: WeekdayType) -> None: ...
def format(cols: int, colwidth: int=_colwidth, spacing: int=_spacing) -> str: ...
def formatstring(cols: int, colwidth: int=_colwidth, spacing: int=_spacing) -> str: ...
def format(cols: int, colwidth: int=_colwidth, spacing: int = _spacing) -> str: ...
def formatstring(cols: int, colwidth: int = _colwidth, spacing: int = _spacing) -> str: ...
def timegm(tuple: Tuple[int]) -> int: ...

View File

@@ -11,10 +11,6 @@ LocaleType = Tuple[Optional[str], Optional[str]]
_colwidth = ... # type: int
_spacing = ... # type: int
# TODO mypy complains about missing True/False
True = ... # type: bool
False = ... # type: bool
class IllegalMonthError(ValueError):
def __init__(self, month: MonthType) -> None: ...
def __str__(self) -> str: ...
@@ -29,7 +25,7 @@ def weekday(year: YearType, month: MonthType, day: DayType) -> WeekdayType: ...
def monthrange(year: YearType, month: MonthType) -> Tuple[WeekdayType, int]: ...
class Calendar(object):
def __init__(self, firstweekday: WeekdayType=0) -> None: ...
def __init__(self, firstweekday: WeekdayType = 0) -> None: ...
def getfirstweekday(self) -> WeekdayType: ...
def setfirstweekday(self, firstweekday: WeekdayType) -> None: ...
def iterweekdays(self) -> Iterable[WeekdayType]: ...
@@ -39,9 +35,9 @@ class Calendar(object):
def monthdatescalendar(self, year: YearType, month: MonthType) -> List[List[datetime.date]]: ...
def monthdays2calendar(self, year: YearType, month: MonthType) -> List[List[Tuple[DayType, WeekdayType]]]: ...
def monthdayscalendar(self, year: YearType, month: MonthType) -> List[List[DayType]]: ...
def yeardatescalendar(self, year: YearType, width: int=3) -> List[List[DayType]]: ...
def yeardays2calendar(self, year: YearType, width: int=3) -> List[List[Tuple[DayType, WeekdayType]]]: ...
def yeardayscalendar(self, year: YearType, width: int=3) -> List[List[DayType]]: ...
def yeardatescalendar(self, year: YearType, width: int = 3) -> List[List[DayType]]: ...
def yeardays2calendar(self, year: YearType, width: int = 3) -> List[List[Tuple[DayType, WeekdayType]]]: ...
def yeardayscalendar(self, year: YearType, width: int = 3) -> List[List[DayType]]: ...
class TextCalendar(Calendar):
def prweek(self, theweek: int, width: int) -> None: ...
@@ -49,21 +45,21 @@ class TextCalendar(Calendar):
def formatweek(self, theweek: int, width: int) -> str: ...
def formatweekday(self, day: DayType, width: int) -> str: ...
def formatweekheader(self, width: int) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool=True) -> str: ...
def prmonth(self, theyear: YearType, themonth: MonthType, w: Any=0, l: Any=0) -> None: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, w: int=0, l: int=0) -> str: ...
def formatyear(self, theyear: YearType, w: int=2, l: int=1, c: int=6, m: int=3) -> str: ...
def pryear(self, theyear: YearType, w: Any=0, l: Any=0, c: Any=6, m: Any=3) -> None: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool = ...) -> str: ...
def prmonth(self, theyear: YearType, themonth: MonthType, w: Any=0, l: Any = 0) -> None: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, w: int = 0, l: int = 0) -> str: ...
def formatyear(self, theyear: YearType, w: int=2, l: int=1, c: int = 6, m: int = 3) -> str: ...
def pryear(self, theyear: YearType, w: Any = 0, l: Any = 0, c: Any = 6, m: Any = 3) -> None: ...
class HTMLCalendar(Calendar):
def formatday(self, day: DayType, weekday: WeekdayType) -> str: ...
def formatweek(self, theweek: int) -> str: ...
def formatweekday(self, day: DayType) -> str: ...
def formatweekheader(self) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool=True) -> str: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, withyear: bool=True) -> str: ...
def formatyear(self, theyear: YearType, width: int=3) -> str: ...
def formatyearpage(self, theyear: YearType, width: int=3, css: Optional[str]='calendar.css', encoding: Optional[str]=None) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool = ...) -> str: ...
def formatmonth(self, theyear: YearType, themonth: MonthType, withyear: bool = ...) -> str: ...
def formatyear(self, theyear: YearType, width: int = 3) -> str: ...
def formatyearpage(self, theyear: YearType, width: int = 3, css: Optional[str] = 'calendar.css', encoding: Optional[str] = ...) -> str: ...
class different_locale:
def __init__(self, locale: LocaleType) -> None: ...
@@ -71,17 +67,17 @@ class different_locale:
def __exit__(self, *args) -> None: ...
class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday: WeekdayType=0, locale: LocaleType=None) -> None: ...
def __init__(self, firstweekday: WeekdayType = 0, locale: Optional[LocaleType] = ...) -> None: ...
def formatweekday(self, day: DayType, width: int) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool=True) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, width: int, withyear: bool = ...) -> str: ...
class LocaleHTMLCalendar(HTMLCalendar):
def __init__(self, firstweekday: WeekdayType=0, locale: LocaleType=None) -> None: ...
def __init__(self, firstweekday: WeekdayType = 0, locale: Optional[LocaleType] = ...) -> None: ...
def formatweekday(self, day: DayType) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool=True) -> str: ...
def formatmonthname(self, theyear: YearType, themonth: MonthType, withyear: bool = ...) -> str: ...
c = ... # type: TextCalendar
def setfirstweekday(firstweekday: WeekdayType) -> None: ...
def format(cols: int, colwidth: int=_colwidth, spacing: int=_spacing) -> str: ...
def formatstring(cols: int, colwidth: int=_colwidth, spacing: int=_spacing) -> str: ...
def format(cols: int, colwidth: int=_colwidth, spacing: int = _spacing) -> str: ...
def formatstring(cols: int, colwidth: int = _colwidth, spacing: int = _spacing) -> str: ...
def timegm(tuple: Tuple[int]) -> int: ...