mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-07 10:20:58 +08:00
apply black and isort (#4287)
* apply black and isort * move some type ignores
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,9 @@
|
||||
from _typeshed import AnyPath, StrPath
|
||||
from typing import Any, Callable, Dict, Optional, IO, Union
|
||||
from threading import Thread
|
||||
import sys
|
||||
from threading import Thread
|
||||
from typing import IO, Any, Callable, Dict, Optional, Union
|
||||
|
||||
from _typeshed import AnyPath, StrPath
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
from configparser import RawConfigParser
|
||||
else:
|
||||
@@ -12,17 +14,20 @@ if sys.version_info >= (3, 7):
|
||||
else:
|
||||
_Path = StrPath
|
||||
|
||||
|
||||
def dictConfig(config: Dict[str, Any]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
def fileConfig(fname: Union[_Path, IO[str], RawConfigParser],
|
||||
defaults: Optional[Dict[str, str]] = ...,
|
||||
disable_existing_loggers: bool = ...) -> None: ...
|
||||
def listen(port: int = ...,
|
||||
verify: Optional[Callable[[bytes], Optional[bytes]]] = ...) -> Thread: ...
|
||||
def fileConfig(
|
||||
fname: Union[_Path, IO[str], RawConfigParser],
|
||||
defaults: Optional[Dict[str, str]] = ...,
|
||||
disable_existing_loggers: bool = ...,
|
||||
) -> None: ...
|
||||
def listen(port: int = ..., verify: Optional[Callable[[bytes], Optional[bytes]]] = ...) -> Thread: ...
|
||||
|
||||
else:
|
||||
def fileConfig(fname: Union[str, IO[str]],
|
||||
defaults: Optional[Dict[str, str]] = ...,
|
||||
disable_existing_loggers: bool = ...) -> None: ...
|
||||
def fileConfig(
|
||||
fname: Union[str, IO[str]], defaults: Optional[Dict[str, str]] = ..., disable_existing_loggers: bool = ...
|
||||
) -> None: ...
|
||||
def listen(port: int = ...) -> Thread: ...
|
||||
|
||||
def stopListening() -> None: ...
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from _typeshed import StrPath
|
||||
import datetime
|
||||
from logging import Handler, FileHandler, LogRecord
|
||||
from socket import SocketType
|
||||
import ssl
|
||||
import sys
|
||||
from logging import FileHandler, Handler, LogRecord
|
||||
from socket import SocketType
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload
|
||||
|
||||
from _typeshed import StrPath
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from queue import SimpleQueue, Queue
|
||||
elif sys.version_info >= (3,):
|
||||
@@ -25,59 +27,84 @@ SYSLOG_TCP_PORT: int
|
||||
class WatchedFileHandler(FileHandler):
|
||||
dev: int
|
||||
ino: int
|
||||
def __init__(self, filename: StrPath, mode: str = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def __init__(self, filename: StrPath, mode: str = ..., encoding: Optional[str] = ..., delay: bool = ...) -> None: ...
|
||||
def _statstream(self) -> None: ...
|
||||
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class BaseRotatingHandler(FileHandler):
|
||||
terminator: str
|
||||
namer: Optional[Callable[[str], str]]
|
||||
rotator: Optional[Callable[[str, str], None]]
|
||||
def __init__(self, filename: StrPath, mode: str,
|
||||
encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def __init__(self, filename: StrPath, mode: str, encoding: Optional[str] = ..., delay: bool = ...) -> None: ...
|
||||
def rotation_filename(self, default_name: str) -> None: ...
|
||||
def rotate(self, source: str, dest: str) -> None: ...
|
||||
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class RotatingFileHandler(BaseRotatingHandler):
|
||||
def __init__(self, filename: StrPath, mode: str = ..., maxBytes: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
else:
|
||||
class RotatingFileHandler(Handler):
|
||||
def __init__(self, filename: str, mode: str = ..., maxBytes: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
filename: StrPath,
|
||||
mode: str = ...,
|
||||
maxBytes: int = ...,
|
||||
backupCount: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
delay: bool = ...,
|
||||
) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
else:
|
||||
class RotatingFileHandler(Handler):
|
||||
def __init__(
|
||||
self,
|
||||
filename: str,
|
||||
mode: str = ...,
|
||||
maxBytes: int = ...,
|
||||
backupCount: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
delay: bool = ...,
|
||||
) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self, filename: StrPath, when: str = ...,
|
||||
interval: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...,
|
||||
atTime: Optional[datetime.datetime] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
filename: StrPath,
|
||||
when: str = ...,
|
||||
interval: int = ...,
|
||||
backupCount: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
delay: bool = ...,
|
||||
utc: bool = ...,
|
||||
atTime: Optional[datetime.datetime] = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
filename: str, when: str = ..., interval: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
else:
|
||||
class TimedRotatingFileHandler(Handler):
|
||||
def __init__(self,
|
||||
filename: str, when: str = ..., interval: int = ...,
|
||||
backupCount: int = ..., encoding: Optional[str] = ...,
|
||||
delay: bool = ..., utc: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
filename: str,
|
||||
when: str = ...,
|
||||
interval: int = ...,
|
||||
backupCount: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
delay: bool = ...,
|
||||
utc: bool = ...,
|
||||
) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
else:
|
||||
class TimedRotatingFileHandler(Handler):
|
||||
def __init__(
|
||||
self,
|
||||
filename: str,
|
||||
when: str = ...,
|
||||
interval: int = ...,
|
||||
backupCount: int = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
delay: bool = ...,
|
||||
utc: bool = ...,
|
||||
) -> None: ...
|
||||
def doRollover(self) -> None: ...
|
||||
|
||||
class SocketHandler(Handler):
|
||||
retryStart: float
|
||||
@@ -92,11 +119,9 @@ class SocketHandler(Handler):
|
||||
def send(self, s: bytes) -> None: ...
|
||||
def createSocket(self) -> None: ...
|
||||
|
||||
|
||||
class DatagramHandler(SocketHandler):
|
||||
def makeSocket(self) -> SocketType: ... # type: ignore
|
||||
|
||||
|
||||
class SysLogHandler(Handler):
|
||||
LOG_ALERT: int
|
||||
LOG_CRIT: int
|
||||
@@ -126,39 +151,44 @@ class SysLogHandler(Handler):
|
||||
LOG_LOCAL5: int
|
||||
LOG_LOCAL6: int
|
||||
LOG_LOCAL7: int
|
||||
def __init__(self, address: Union[Tuple[str, int], str] = ...,
|
||||
facility: int = ..., socktype: Optional[_SocketKind] = ...) -> None: ...
|
||||
def encodePriority(self, facility: Union[int, str],
|
||||
priority: Union[int, str]) -> int: ...
|
||||
def __init__(
|
||||
self, address: Union[Tuple[str, int], str] = ..., 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: Optional[str] = ...,
|
||||
logtype: str = ...) -> None: ...
|
||||
def __init__(self, appname: str, dllname: Optional[str] = ..., logtype: str = ...) -> None: ...
|
||||
def getEventCategory(self, record: LogRecord) -> int: ...
|
||||
# TODO correct return value?
|
||||
def getEventType(self, record: LogRecord) -> int: ...
|
||||
def getMessageID(self, record: LogRecord) -> int: ...
|
||||
|
||||
|
||||
class SMTPHandler(Handler):
|
||||
# TODO `secure` can also be an empty tuple
|
||||
if sys.version_info >= (3,):
|
||||
def __init__(self, mailhost: Union[str, Tuple[str, int]], fromaddr: str,
|
||||
toaddrs: List[str], subject: str,
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
secure: Union[Tuple[str], Tuple[str, str], None] = ...,
|
||||
timeout: float = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
mailhost: Union[str, Tuple[str, int]],
|
||||
fromaddr: str,
|
||||
toaddrs: List[str],
|
||||
subject: str,
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
secure: Union[Tuple[str], Tuple[str, str], None] = ...,
|
||||
timeout: float = ...,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
mailhost: Union[str, Tuple[str, int]], fromaddr: str,
|
||||
toaddrs: List[str], subject: str,
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
secure: Union[Tuple[str], Tuple[str, str], None] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
mailhost: Union[str, Tuple[str, int]],
|
||||
fromaddr: str,
|
||||
toaddrs: List[str],
|
||||
subject: str,
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
secure: Union[Tuple[str], Tuple[str, str], None] = ...,
|
||||
) -> None: ...
|
||||
def getSubject(self, record: LogRecord) -> str: ...
|
||||
|
||||
|
||||
class BufferingHandler(Handler):
|
||||
buffer: List[LogRecord]
|
||||
def __init__(self, capacity: int) -> None: ...
|
||||
@@ -166,30 +196,32 @@ class BufferingHandler(Handler):
|
||||
|
||||
class MemoryHandler(BufferingHandler):
|
||||
if sys.version_info >= (3, 6):
|
||||
def __init__(self, capacity: int, flushLevel: int = ...,
|
||||
target: Optional[Handler] = ..., flushOnClose: bool = ...) -> None: ...
|
||||
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 __init__(self, capacity: int, flushLevel: int = ..., target: Optional[Handler] = ...) -> None: ...
|
||||
def setTarget(self, target: Handler) -> None: ...
|
||||
|
||||
|
||||
class HTTPHandler(Handler):
|
||||
if sys.version_info >= (3, 5):
|
||||
def __init__(self, host: str, url: str, method: str = ...,
|
||||
secure: bool = ...,
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
context: Optional[ssl.SSLContext] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
url: str,
|
||||
method: str = ...,
|
||||
secure: bool = ...,
|
||||
credentials: Optional[Tuple[str, str]] = ...,
|
||||
context: Optional[ssl.SSLContext] = ...,
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3,):
|
||||
def __init__(self,
|
||||
host: str, url: str, method: str = ..., secure: bool = ...,
|
||||
credentials: Optional[Tuple[str, str]] = ...) -> None: ...
|
||||
def __init__(
|
||||
self, host: str, url: str, method: str = ..., secure: bool = ..., credentials: Optional[Tuple[str, str]] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
host: str, url: str, method: str = ...) -> None: ...
|
||||
def __init__(self, host: str, url: str, method: str = ...) -> None: ...
|
||||
def mapLogRecord(self, record: LogRecord) -> Dict[str, Any]: ...
|
||||
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
class QueueHandler(Handler):
|
||||
if sys.version_info >= (3, 7):
|
||||
@@ -198,18 +230,15 @@ if sys.version_info >= (3,):
|
||||
def __init__(self, queue: Queue[Any]) -> None: ...
|
||||
def prepare(self, record: LogRecord) -> Any: ...
|
||||
def enqueue(self, record: LogRecord) -> None: ...
|
||||
|
||||
class QueueListener:
|
||||
if sys.version_info >= (3, 7):
|
||||
def __init__(self, queue: Union[SimpleQueue[Any], Queue[Any]],
|
||||
*handlers: Handler,
|
||||
respect_handler_level: bool = ...) -> None: ...
|
||||
def __init__(
|
||||
self, queue: Union[SimpleQueue[Any], Queue[Any]], *handlers: Handler, respect_handler_level: bool = ...
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3, 5):
|
||||
def __init__(self, queue: Queue[Any], *handlers: Handler,
|
||||
respect_handler_level: bool = ...) -> None: ...
|
||||
def __init__(self, queue: Queue[Any], *handlers: Handler, respect_handler_level: bool = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
queue: Queue, *handlers: Handler) -> None: ...
|
||||
def __init__(self, queue: Queue, *handlers: Handler) -> None: ...
|
||||
def dequeue(self, block: bool) -> LogRecord: ...
|
||||
def prepare(self, record: LogRecord) -> Any: ...
|
||||
def start(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user