From 0aa7138c4e73c1e421b20168fd83bf50adde374b Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 23 May 2017 12:43:49 -0700 Subject: [PATCH] fixes to logging stubs (#1302) Found with my stubcheck tool --- stdlib/2and3/logging/__init__.pyi | 4 ++++ stdlib/2and3/logging/config.pyi | 4 +--- stdlib/2and3/logging/handlers.pyi | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/stdlib/2and3/logging/__init__.pyi b/stdlib/2and3/logging/__init__.pyi index d1d9c5420..83cf9c0e3 100644 --- a/stdlib/2and3/logging/__init__.pyi +++ b/stdlib/2and3/logging/__init__.pyi @@ -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: ... diff --git a/stdlib/2and3/logging/config.pyi b/stdlib/2and3/logging/config.pyi index 99f740659..dc5e19e02 100644 --- a/stdlib/2and3/logging/config.pyi +++ b/stdlib/2and3/logging/config.pyi @@ -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 diff --git a/stdlib/2and3/logging/handlers.pyi b/stdlib/2and3/logging/handlers.pyi index 604139730..2705d56e3 100644 --- a/stdlib/2and3/logging/handlers.pyi +++ b/stdlib/2and3/logging/handlers.pyi @@ -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: ...