Replace a number of default argument values with "..." (#1280)

pytype apparently doesn't like default values that aren't ints or
None/True/False.
This commit is contained in:
Jelle Zijlstra
2017-05-21 14:31:22 -07:00
committed by Guido van Rossum
parent 3896298027
commit 728b977729
6 changed files with 47 additions and 52 deletions

View File

@@ -1,7 +1,7 @@
import datetime
from time import struct_time
from typing import Any, Iterable, List, Optional, Tuple, Sequence, Union
from typing import Any, Iterable, List, Optional, Sequence, Tuple, Union
LocaleType = Tuple[Optional[str], Optional[str]]
@@ -20,7 +20,7 @@ def weekday(year: int, month: int, day: int) -> int: ...
def monthrange(year: int, month: int) -> Tuple[int, int]: ...
class Calendar:
def __init__(self, firstweekday: int = 0) -> None: ...
def __init__(self, firstweekday: int = ...) -> None: ...
def getfirstweekday(self) -> int: ...
def setfirstweekday(self, firstweekday: int) -> None: ...
def iterweekdays(self) -> Iterable[int]: ...
@@ -30,9 +30,9 @@ class Calendar:
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 = 3) -> List[List[int]]: ...
def yeardays2calendar(self, year: int, width: int = 3) -> List[List[Tuple[int, int]]]: ...
def yeardayscalendar(self, year: int, width: int = 3) -> 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: ...
@@ -42,8 +42,8 @@ class TextCalendar(Calendar):
def formatweekheader(self, width: int) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ...
def prmonth(self, theyear: int, themonth: int, w: Any=0, l: Any = 0) -> None: ...
def formatmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: ...
def formatyear(self, theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ...
def formatmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ...
def formatyear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ...
def pryear(self, theyear: int, w: Any = 0, l: Any = 0, c: Any = 6, m: Any = 3) -> None: ...
class HTMLCalendar(Calendar):
@@ -53,8 +53,8 @@ class HTMLCalendar(Calendar):
def formatweekheader(self) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...
def formatyear(self, theyear: int, width: int = 3) -> str: ...
def formatyearpage(self, theyear: int, width: int = 3, css: Optional[str] = 'calendar.css', encoding: Optional[str] = ...) -> str: ...
def formatyear(self, theyear: int, width: int = ...) -> str: ...
def formatyearpage(self, theyear: int, width: int = ..., css: Optional[str] = ..., encoding: Optional[str] = ...) -> str: ...
class different_locale:
def __init__(self, locale: LocaleType) -> None: ...
@@ -62,12 +62,12 @@ class different_locale:
def __exit__(self, *args) -> None: ...
class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday: int = 0, locale: Optional[LocaleType] = ...) -> None: ...
def __init__(self, firstweekday: int = ..., locale: Optional[LocaleType] = ...) -> None: ...
def formatweekday(self, day: int, width: int) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ...
class LocaleHTMLCalendar(HTMLCalendar):
def __init__(self, firstweekday: int = 0, locale: Optional[LocaleType] = ...) -> None: ...
def __init__(self, firstweekday: int = ..., locale: Optional[LocaleType] = ...) -> None: ...
def formatweekday(self, day: int) -> str: ...
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ...

View File

@@ -4,8 +4,8 @@ import types
from typing import Any, Mapping, Optional, Sequence
def __import__(name: str, globals: Mapping[str, Any] = None,
locals: Mapping[str, Any] = None, fromlist: Sequence[str] = (),
level: int = 0) -> types.ModuleType: ...
locals: Mapping[str, Any] = None, fromlist: Sequence[str] = ...,
level: int = ...) -> types.ModuleType: ...
def import_module(name: str, package: str = None) -> types.ModuleType: ...

View File

@@ -35,11 +35,11 @@ class InspectLoader(Loader):
def exec_module(self, module: types.ModuleType) -> None: ...
if sys.version_info[:2] == (3, 4):
def source_to_code(self, data: Union[bytes, str],
path: str = '<string>') -> types.CodeType: ...
path: str = ...) -> types.CodeType: ...
elif sys.version_info >= (3, 5):
@staticmethod
def source_to_code(data: Union[bytes, str],
path: str = '<string>') -> types.CodeType: ...
path: str = ...) -> types.CodeType: ...
class ExecutionLoader(InspectLoader):
@abstractmethod

View File

@@ -10,8 +10,8 @@ class Lock():
def release(self) -> None: ...
class AsyncResult():
def get(self, timeout: float = -1) -> Any: ...
def wait(self, timeout: float = -1) -> None: ...
def get(self, timeout: float = ...) -> Any: ...
def wait(self, timeout: float = ...) -> None: ...
def ready(self) -> bool: ...
def successful(self) -> bool: ...
@@ -20,49 +20,49 @@ class Event(object):
def is_set(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[int] = None) -> bool: ...
def wait(self, timeout: Optional[int] = ...) -> bool: ...
class Pool():
def __init__(self, processes: Optional[int] = None,
initializer: Optional[Callable[..., None]] = None,
initargs: Iterable[Any] = (),
maxtasksperchild: Optional[int] = None,
def __init__(self, processes: Optional[int] = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Iterable[Any] = ...,
maxtasksperchild: Optional[int] = ...,
context: Any = None) -> None: ...
def apply(self,
func: Callable[..., Any],
args: Iterable[Any]=(),
args: Iterable[Any] = ...,
kwds: Dict[str, Any]=...) -> Any: ...
def apply_async(self,
func: Callable[..., Any],
args: Iterable[Any]=(),
kwds: Dict[str, Any]=...,
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def map(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
chunksize: Optional[int] = None) -> List[Any]: ...
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = ...) -> List[Any]: ...
def map_async(self, func: Callable[..., Any],
iterable: Iterable[Any] = (),
chunksize: Optional[int] = None,
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = ...,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def imap(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = None) -> Iterable[Any]: ...
def imap_unordered(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = None) -> Iterable[Any]: ...
def starmap(self,
func: Callable[..., Any],
iterable: Iterable[Iterable[Any]]=(),
iterable: Iterable[Iterable[Any]] = ...,
chunksize: Optional[int] = None) -> List[Any]: ...
def starmap_async(self,
func: Callable[..., Any],
iterable: Iterable[Iterable[Any]] = (),
chunksize: Optional[int] = None,
iterable: Iterable[Iterable[Any]] = ...,
chunksize: Optional[int] = ...,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def close(self) -> None: ...

View File

@@ -5,49 +5,49 @@
from typing import Any, Callable, Iterable, Mapping, Optional, Dict, List
class AsyncResult():
def get(self, timeout: float = -1) -> Any: ...
def wait(self, timeout: float = -1) -> None: ...
def get(self, timeout: float = ...) -> Any: ...
def wait(self, timeout: float = ...) -> None: ...
def ready(self) -> bool: ...
def successful(self) -> bool: ...
class ThreadPool():
def __init__(self, processes: Optional[int] = None,
initializer: Optional[Callable[..., None]] = None,
initargs: Iterable[Any] = ()) -> None: ...
initargs: Iterable[Any] = ...) -> None: ...
def apply(self,
func: Callable[..., Any],
args: Iterable[Any]=(),
kwds: Dict[str, Any]=...) -> Any: ...
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...) -> Any: ...
def apply_async(self,
func: Callable[..., Any],
args: Iterable[Any]=(),
kwds: Dict[str, Any]=...,
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def map(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = None) -> List[Any]: ...
def map_async(self, func: Callable[..., Any],
iterable: Iterable[Any] = (),
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = None,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...
def imap(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = None) -> Iterable[Any]: ...
def imap_unordered(self,
func: Callable[..., Any],
iterable: Iterable[Any]=(),
iterable: Iterable[Any] = ...,
chunksize: Optional[int] = None) -> Iterable[Any]: ...
def starmap(self,
func: Callable[..., Any],
iterable: Iterable[Iterable[Any]]=(),
iterable: Iterable[Iterable[Any]] = ...,
chunksize: Optional[int] = None) -> List[Any]: ...
def starmap_async(self,
func: Callable[..., Any],
iterable: Iterable[Iterable[Any]] = (),
iterable: Iterable[Iterable[Any]] = ...,
chunksize: Optional[int] = None,
callback: Callable[..., None] = None,
error_callback: Callable[[BaseException], None] = None) -> AsyncResult: ...

View File

@@ -17,7 +17,6 @@ stdlib/3/os/__init__.pyi
# We've not been running the pytype tests under Python 3, for quite a while.
# The below are files that have regressed and need fixing:
stdlib/3/calendar.pyi
stdlib/3/collections/__init__.pyi
stdlib/3/collections/abc.pyi
stdlib/3/concurrent/futures/__init__.pyi
@@ -31,14 +30,10 @@ stdlib/3/fileinput.pyi
stdlib/3/gzip.pyi
stdlib/3/http/__init__.pyi
stdlib/3/http/cookiejar.pyi
stdlib/3/importlib/__init__.pyi
stdlib/3/importlib/abc.pyi
stdlib/3/inspect.pyi
stdlib/3/json/__init__.pyi
stdlib/3/json/decoder.pyi
stdlib/3/json/encoder.pyi
stdlib/3/multiprocessing/__init__.pyi
stdlib/3/multiprocessing/pool.pyi
stdlib/3/ssl.pyi
stdlib/3/subprocess.pyi
stdlib/3/sys.pyi