Add Optional[] for all remaining cases of x: <type> = None (#1424)

* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
This commit is contained in:
Guido van Rossum
2017-06-21 10:50:21 -07:00
committed by Matthias Kramm
parent 81f77b17ec
commit 350563223f
18 changed files with 152 additions and 133 deletions

View File

@@ -84,12 +84,12 @@ def byte2int(bs: binary_type) -> int: ...
def indexbytes(buf: binary_type, i: int) -> int: ...
def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = None) -> None: ...
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: Optional[str] = None) -> None: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, msg: str = None) -> Any: ...
def assertRaisesRegex(self: unittest.TestCase, msg: Optional[str] = None) -> Any: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = None) -> None: ...
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Optional[str] = None) -> None: ...
exec_ = exec

View File

@@ -76,7 +76,14 @@ class BaseResponse:
status = ... # type: str
direct_passthrough = ... # type: bool
response = ... # type: Iterable[bytes]
def __init__(self, response: Union[Iterable[bytes], bytes]=None, status: Union[str, int]=None, headers: Union[Headers, Mapping[str, str], Sequence[Tuple[str, str]]]=None, mimetype: str=None, content_type: str=None, direct_passthrough: bool=False) -> None: ...
def __init__(self, response: Optional[Union[Iterable[bytes], bytes]]=None,
status: Optional[Union[str, int]]=None,
headers: Optional[Union[Headers,
Mapping[str, str],
Sequence[Tuple[str, str]]]]=None,
mimetype: Optional[str] = None,
content_type: Optional[str] = None,
direct_passthrough: bool=False) -> None: ...
def call_on_close(self, func): ...
@classmethod
def force_type(cls, response, environ=None): ...