Add logging.WARN; TextIO -> IO[str].

This commit is contained in:
Guido van Rossum
2016-06-05 17:09:50 -07:00
parent e97638d4bd
commit d75e2ab224
2 changed files with 10 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
## Stubs for logging (Python 3.4)
from typing import (
Any, Callable, Iterable, Mapping, MutableMapping, Optional, TextIO, Tuple,
Any, Callable, Iterable, Mapping, MutableMapping, Optional, IO, Tuple,
Union,
overload,
)
@@ -106,7 +106,8 @@ class Logger:
CRITICAL = ... # type: int
ERROR = ... # type: int
WARNING = ... # type: Any
WARNING = ... # type: int
WARN = ... # type: int
INFO = ... # type: int
DEBUG = ... # type: int
NOTSET = ... # type: int
@@ -318,7 +319,7 @@ def makeLogRecord(attrdict: Mapping[str, Any]) -> LogRecord: ...
#if sys.version_info >= (3,):
# def basicConfig(*, filename: str = ..., filemode: str = ...,
# format: str = ..., datefmt: str = ..., style: str = ...,
# level: int = ..., stream: TextIO = ...,
# level: int = ..., stream: IO[str] = ...,
# handlers: Iterable[Handler]) -> None: ...
#else:
# @overload
@@ -326,10 +327,10 @@ def makeLogRecord(attrdict: Mapping[str, Any]) -> LogRecord: ...
# @overload
# def basicConfig(*, filename: str = ..., filemode: str = ...,
# format: str = ..., datefmt: str = ...,
# level: int = ..., stream: TextIO = ...) -> None: ...
# level: int = ..., stream: IO[str] = ...) -> None: ...
def basicConfig(*, filename: str = ..., filemode: str = ...,
format: str = ..., datefmt: str = ..., style: str = ...,
level: int = ..., stream: TextIO = ...,
level: int = ..., stream: IO[str] = ...,
handlers: Iterable[Handler]) -> None: ...
def shutdown() -> None: ...
@@ -343,7 +344,7 @@ if sys.version_info >= (3,):
class StreamHandler(Handler):
def __init__(self, stream: Optional[TextIO] = ...) -> None: ...
def __init__(self, stream: Optional[IO[str]] = ...) -> None: ...
class FileHandler(Handler):

View File

@@ -1,6 +1,6 @@
# Stubs for logging.config (Python 3.4)
from typing import Any, Callable, Dict, Optional, TextIO, Union
from typing import Any, Callable, Dict, Optional, IO, Union
import sys
# TODO uncomment when mypy handle conditionals
#if sys.version_info >= (3,):
@@ -13,7 +13,7 @@ RawConfigParser = Any
def dictConfig(config: Dict[str, Any]) -> None: ...
if sys.version_info >= (3, 4):
def fileConfig(fname: Union[str, TextIO, RawConfigParser],
def fileConfig(fname: Union[str, IO[str], RawConfigParser],
defaults: Optional[Dict[str, str]] = ...,
disable_existing_loggers: bool = ...) -> None: ...
def listen(port: int = ...,
@@ -21,7 +21,7 @@ if sys.version_info >= (3, 4):
-> None: ...
else:
def fileConfig( # type: ignore
fname: Union[str, TextIO],
fname: Union[str, IO[str]],
defaults: Optional[Dict[str, str]] = ...,
disable_existing_loggers: bool = ...) -> None: ...
def listen( # type: ignore