fixes to logging stubs (#1302)

Found with my stubcheck tool
This commit is contained in:
Jelle Zijlstra
2017-05-23 12:43:49 -07:00
committed by Matthias Kramm
parent 915a91f80d
commit 0aa7138c4e
3 changed files with 7 additions and 5 deletions

View File

@@ -20,6 +20,8 @@ _ArgsType = Union[Tuple[Any, ...], Dict[str, Any]]
_FilterType = Union['Filter', Callable[['LogRecord'], int]]
_Level = Union[int, Text]
raiseExceptions: bool
class Logger:
name = ... # type: str
@@ -111,6 +113,7 @@ class Logger:
CRITICAL = ... # type: int
FATAL = ... # type: int
ERROR = ... # type: int
WARNING = ... # type: int
WARN = ... # type: int
@@ -323,6 +326,7 @@ else:
extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ...
def log(lvl: int, msg: Text, *args: Any, exc_info: _ExcInfoType = ...,
extra: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> None: ...
fatal = critical
def disable(lvl: int) -> None: ...
def addLevelName(lvl: int, levelName: str) -> None: ...

View File

@@ -3,9 +3,7 @@
from typing import Any, Callable, Dict, Optional, IO, Union
import sys
if sys.version_info >= (3,):
# from configparser import RawConfigParser
# TODO add RawConfigParser to configparser stubs
RawConfigParser = Any
from configparser import RawConfigParser
else:
from ConfigParser import RawConfigParser

View File

@@ -11,7 +11,7 @@ if sys.version_info >= (3,):
else:
from Queue import Queue
# TODO update socket stubs to add SocketKind
SocketKind = int
_SocketKind = int
class WatchedFileHandler(Handler):
@@ -122,7 +122,7 @@ class SysLogHandler(Handler):
LOG_LOCAL6 = ... # type: int
LOG_LOCAL7 = ... # type: int
def __init__(self, address: Union[Tuple[str, int], str] = ...,
facility: int = ..., socktype: SocketKind = ...) -> None: ...
facility: int = ..., socktype: _SocketKind = ...) -> None: ...
def encodePriority(self, facility: Union[int, str],
priority: Union[int, str]) -> int: ...
def mapPriority(self, levelName: int) -> str: ...