logging: various fixes (#4196)

* logging.disable: update for py37

* RootLogger: fix __init__

* shutdown: add undocumented parameter

* MemoryHandler: add flushOnClose in py36

* NTEventLogHandler: fix dllname type

* makeSocket: add undocumented parameter

* SysLogHandler: fix socktype type

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-06-07 14:05:29 -07:00
committed by GitHub
parent 4ab1d6f0ae
commit df6136c4ac
7 changed files with 15 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
from typing import (
Any, Callable, Dict, Iterable, List, Mapping, MutableMapping, Optional, IO,
Tuple, Text, Union, overload,
Sequence, Tuple, Text, Union, overload,
)
from string import Template
from time import struct_time
@@ -490,7 +490,7 @@ else:
def basicConfig(*, filename: Optional[str] = ..., filemode: str = ...,
format: str = ..., datefmt: Optional[str] = ...,
level: Optional[_Level] = ..., stream: IO[str] = ...) -> None: ...
def shutdown() -> None: ...
def shutdown(handlerList: Sequence[Any] = ...) -> None: ... # handlerList is undocumented
def setLoggerClass(klass: type) -> None: ...
@@ -533,7 +533,8 @@ class PlaceHolder:
# Below aren't in module docs but still visible
class RootLogger(Logger): ...
class RootLogger(Logger):
def __init__(self, level: int) -> None: ...
root: RootLogger

View File

@@ -93,13 +93,14 @@ class SocketHandler(Handler):
def __init__(self, host: str, port: Optional[int]) -> None: ...
else:
def __init__(self, host: str, port: int) -> None: ...
def makeSocket(self) -> SocketType: ...
def makeSocket(self, timeout: float = ...) -> SocketType: ... # timeout is undocumented
def makePickle(self, record: LogRecord) -> bytes: ...
def send(self, s: bytes) -> None: ...
def createSocket(self) -> None: ...
class DatagramHandler(SocketHandler): ...
class DatagramHandler(SocketHandler):
def makeSocket(self) -> SocketType: ... # type: ignore
class SysLogHandler(Handler):
@@ -132,14 +133,14 @@ class SysLogHandler(Handler):
LOG_LOCAL6: int
LOG_LOCAL7: int
def __init__(self, address: Union[Tuple[str, int], str] = ...,
facility: int = ..., socktype: _SocketKind = ...) -> None: ...
facility: int = ..., socktype: Optional[_SocketKind] = ...) -> None: ...
def encodePriority(self, facility: Union[int, str],
priority: Union[int, str]) -> int: ...
def mapPriority(self, levelName: str) -> str: ...
class NTEventLogHandler(Handler):
def __init__(self, appname: str, dllname: str = ...,
def __init__(self, appname: str, dllname: Optional[str] = ...,
logtype: str = ...) -> None: ...
def getEventCategory(self, record: LogRecord) -> int: ...
# TODO correct return value?
@@ -170,8 +171,12 @@ class BufferingHandler(Handler):
def shouldFlush(self, record: LogRecord) -> bool: ...
class MemoryHandler(BufferingHandler):
def __init__(self, capacity: int, flushLevel: int = ...,
target: Optional[Handler] = ...) -> None: ...
if sys.version_info >= (3, 6):
def __init__(self, capacity: int, flushLevel: int = ...,
target: Optional[Handler] = ..., flushOnClose: bool = ...) -> None: ...
else:
def __init__(self, capacity: int, flushLevel: int = ...,
target: Optional[Handler] = ...) -> None: ...
def setTarget(self, target: Handler) -> None: ...

View File

@@ -29,7 +29,6 @@ importlib.resources
io.StringIO.readline
ipaddress._BaseNetwork.__init__
json.loads
logging.handlers.MemoryHandler.__init__
mmap.ACCESS_DEFAULT
multiprocessing.shared_memory
nntplib._NNTPBase.starttls

View File

@@ -40,7 +40,6 @@ http.server.SimpleHTTPRequestHandler.__init__
importlib.metadata
ipaddress._BaseNetwork.__init__
json.loads
logging.handlers.MemoryHandler.__init__
macurl2path # removed in 3.7
multiprocessing.shared_memory
nntplib._NNTPBase.starttls

View File

@@ -60,7 +60,6 @@ ipaddress.IPv4Interface.hostmask
ipaddress.IPv6Interface.hostmask
ipaddress._BaseNetwork.broadcast_address
ipaddress._BaseNetwork.hostmask
logging.handlers.MemoryHandler.__init__
macpath
macurl2path # removed in 3.7
mmap.MADV_[A-Z_]+

View File

@@ -113,7 +113,6 @@ ipaddress._BaseNetwork.hostmask
itertools.tee
logging.FileHandler.__init__
logging.handlers.BaseRotatingHandler.__init__
logging.handlers.MemoryHandler.__init__
logging.handlers.RotatingFileHandler.__init__
logging.handlers.TimedRotatingFileHandler.__init__
logging.handlers.WatchedFileHandler.__init__

View File

@@ -292,12 +292,6 @@ lib2to3.pytree.BasePattern.__new__
lib2to3.pytree.BasePattern.type
lib2to3.pytree.NegatedPattern.match
lib2to3.pytree.NegatedPattern.match_seq
logging.RootLogger.__init__
logging.disable
logging.handlers.NTEventLogHandler.__init__
logging.handlers.SocketHandler.makeSocket
logging.handlers.SysLogHandler.__init__
logging.shutdown
mailbox.Babyl.__init__
mailbox.MH.__init__
mailbox.MMDF.__init__