mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-30 16:14:24 +08:00
Fixing flake8 E401, E402 errors
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
|
||||
# Only a subset of functionality is included.
|
||||
|
||||
DEFAULT_BUFFER_SIZE = 0
|
||||
|
||||
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union
|
||||
|
||||
DEFAULT_BUFFER_SIZE = 0
|
||||
|
||||
def open(file: Union[str, unicode, int],
|
||||
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
|
||||
errors: unicode = ..., newline: unicode = ...,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from typing import Union, Tuple, Sequence
|
||||
from abc import abstractmethod
|
||||
|
||||
import asyncore
|
||||
import socket
|
||||
import sys
|
||||
from typing import Union, Tuple, Sequence
|
||||
|
||||
|
||||
class simple_producer:
|
||||
def __init__(self, data: str, buffer_size: int = ...) -> None: ...
|
||||
@@ -30,7 +31,6 @@ class async_chat (asyncore.dispatcher):
|
||||
def initiate_send(self) -> None: ...
|
||||
def discard_buffers(self) -> None: ...
|
||||
|
||||
import sys
|
||||
if sys.version_info < (3, 0, 0):
|
||||
class fifo:
|
||||
def __init__(self, list: Sequence[Union[str, simple_producer]] = ...) -> None: ...
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
from typing import Tuple, Union, Optional, Any, Dict, overload
|
||||
|
||||
import select, socket, sys, time, warnings, os
|
||||
import os
|
||||
import select
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import warnings
|
||||
|
||||
from errno import (EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL,
|
||||
ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# Stubs for logging.handlers (Python 2.4)
|
||||
|
||||
from typing import Any, Callable, Optional, Tuple, Union, overload
|
||||
from logging import Handler, FileHandler, LogRecord
|
||||
import datetime
|
||||
from logging import Handler, FileHandler, LogRecord
|
||||
from socket import SocketType
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any, Callable, Optional, Tuple, Union, overload
|
||||
if sys.version_info >= (3,):
|
||||
from queue import Queue
|
||||
else:
|
||||
from Queue import Queue
|
||||
from socket import SocketType
|
||||
# TODO update socket stubs to add SocketKind
|
||||
SocketKind = int
|
||||
import ssl
|
||||
import sys
|
||||
|
||||
|
||||
class WatchedFileHandler(Handler):
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
# Stubs for mmap
|
||||
|
||||
from typing import (Optional, Sequence, Union, Generic, TypeVar, overload,
|
||||
Iterable, Container, Sized, Reversible)
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import (Optional, Sequence, Union, Generic, TypeVar, overload,
|
||||
Iterable, Container, Sized, Reversible, Type)
|
||||
|
||||
|
||||
_T = TypeVar('_T', str, bytes)
|
||||
|
||||
# TODO already in PEP, have to get added to mypy
|
||||
from typing import Type
|
||||
from types import TracebackType
|
||||
_C = TypeVar('_C')
|
||||
class _ContextManager(Generic[_C]):
|
||||
def __enter__(self) -> _C: ...
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
from typing import Any, Union, Callable, TypeVar, List, Generic, Iterable, Generator, Awaitable
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
from concurrent.futures._base import (
|
||||
Error as Error,
|
||||
)
|
||||
@@ -12,6 +7,11 @@ from concurrent.futures import (
|
||||
CancelledError as CancelledError,
|
||||
TimeoutError as TimeoutError,
|
||||
)
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class InvalidStateError(Error): ...
|
||||
|
||||
class _TracebackLogger:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from asyncio import transports
|
||||
from typing import AnyStr
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
from asyncio import transports
|
||||
|
||||
class BaseProtocol:
|
||||
def connection_made(self, transport: transports.BaseTransport) -> None: ...
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
from typing import TypeVar, Generic
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from .coroutines import coroutine
|
||||
from .futures import Future
|
||||
from typing import TypeVar, Generic
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
|
||||
class QueueEmpty(Exception): ...
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
from typing import Any, Callable, Generator, Iterable, Tuple
|
||||
|
||||
ClientConnectedCallback = Callable[[Tuple[StreamReader, StreamWriter]], None]
|
||||
import socket
|
||||
from typing import Any, Callable, Generator, Iterable, Tuple
|
||||
|
||||
from . import coroutines
|
||||
from . import events
|
||||
from . import protocols
|
||||
from . import transports
|
||||
|
||||
ClientConnectedCallback = Callable[[Tuple[StreamReader, StreamWriter]], None]
|
||||
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
class IncompleteReadError(EOFError):
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
from typing import Any, AnyStr, Tuple, Union
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
from asyncio import events
|
||||
from asyncio import protocols
|
||||
from asyncio import streams
|
||||
from asyncio import transports
|
||||
from asyncio.coroutines import coroutine
|
||||
from typing import Any, AnyStr, Tuple, Union
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
PIPE = ... # type: int
|
||||
STDOUT = ... # type: int
|
||||
|
||||
@@ -2,12 +2,11 @@ from typing import (Any, TypeVar, Set, Dict, List, TextIO, Union, Tuple, Generic
|
||||
Coroutine, Generator, Iterable, Awaitable, overload, Sequence, Iterator,
|
||||
Optional)
|
||||
import concurrent.futures
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
FIRST_EXCEPTION = 'FIRST_EXCEPTION'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Stubs for email.parser (Python 3.4)
|
||||
|
||||
from typing import Callable, Optional, TextIO, BinaryIO
|
||||
import email.feedparser
|
||||
from email.message import Message
|
||||
import sys
|
||||
from typing import Callable, Optional, TextIO, BinaryIO
|
||||
if sys.version_info >= (3, 3):
|
||||
from email.policy import Policy
|
||||
import sys
|
||||
|
||||
FeedParser = email.feedparser.FeedParser
|
||||
BytesFeedParser = email.feedparser.BytesFeedParser
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Stubs for email.policy (Python 3.4)
|
||||
|
||||
from abc import abstractmethod
|
||||
from typing import Any, Optional, Tuple, Union, Callable
|
||||
import sys
|
||||
from email.message import Message
|
||||
@@ -7,7 +8,6 @@ from email.errors import MessageDefect
|
||||
from email.header import Header
|
||||
if sys.version_info >= (3, 4):
|
||||
from email.contentmanager import ContentManager
|
||||
from abc import abstractmethod
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
if sys.version_info >= (3, 4):
|
||||
from _importlib_modulespec import ModuleSpec
|
||||
import sys
|
||||
import types
|
||||
from typing import Any, Mapping, Optional, Sequence, Tuple, Union
|
||||
|
||||
_Path = Union[bytes, str]
|
||||
|
||||
# Loader is exported from this module, but for circular import reasons
|
||||
# exists in its own stub file (with ModuleSpec and ModuleType).
|
||||
from _importlib_modulespec import Loader as Loader # Exported
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
from _importlib_modulespec import ModuleSpec
|
||||
|
||||
_Path = Union[bytes, str]
|
||||
|
||||
class Finder(metaclass=ABCMeta): ...
|
||||
# Technically this class defines the following method, but its subclasses
|
||||
# in this module violate its signature. Since this class is deprecated, it's
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
|
||||
# based on http: //docs.python.org/3.2/library/os.html
|
||||
|
||||
from builtins import OSError as error
|
||||
from io import TextIOWrapper as _TextIOWrapper
|
||||
import sys
|
||||
from typing import (
|
||||
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
|
||||
Optional, Generic, Set, Callable
|
||||
)
|
||||
import sys
|
||||
from builtins import OSError as error
|
||||
from . import path
|
||||
|
||||
# ----- os variables -----
|
||||
@@ -323,7 +324,6 @@ def killpg(pgid: int, sig: int) -> None: ... # Unix only
|
||||
def nice(increment: int) -> int: ... # Unix only
|
||||
def plock(op: int) -> None: ... # Unix only ???op is int?
|
||||
|
||||
from io import TextIOWrapper as _TextIOWrapper
|
||||
class popen(_TextIOWrapper):
|
||||
# TODO 'b' modes or bytes command not accepted?
|
||||
def __init__(self, command: str, mode: str = ...,
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# Stubs for platform (Python 3.5)
|
||||
|
||||
from typing import Tuple, NamedTuple
|
||||
|
||||
from os import devnull as DEV_NULL
|
||||
from os import popen
|
||||
from typing import Tuple, NamedTuple
|
||||
|
||||
def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> Tuple[str, str]: ...
|
||||
def linux_distribution(distname: str = ..., version: str = ..., id: str = ..., supported_dists: Tuple[str, ...] = ..., full_distribution_name: bool = ...) -> Tuple[str, str, str]: ...
|
||||
def dist(distname: str = ..., version: str = ..., id: str = ..., supported_dists: Tuple[str, ...] = ...) -> Tuple[str, str, str]: ...
|
||||
from os import popen
|
||||
def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> Tuple[str, str, str, str]: ...
|
||||
def mac_ver(release: str = ..., versioninfo: Tuple[str, str, str] = ..., machine: str = ...) -> Tuple[str, Tuple[str, str, str], str]: ...
|
||||
def java_ver(release: str = ..., vendor: str = ..., vminfo: Tuple[str, str, str] = ..., osinfo: Tuple[str, str, str] = ...) -> Tuple[str, str, Tuple[str, str, str], Tuple[str, str, str]]: ...
|
||||
|
||||
@@ -9,6 +9,10 @@ from typing import (
|
||||
Union, overload
|
||||
)
|
||||
|
||||
# ModuleType is exported from this module, but for circular import
|
||||
# reasons exists in its own stub file (with ModuleSpec and Loader).
|
||||
from _importlib_modulespec import ModuleType as ModuleType # Exported
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
@@ -107,10 +111,6 @@ class BuiltinFunctionType:
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
BuiltinMethodType = BuiltinFunctionType
|
||||
|
||||
# ModuleType is exported from this module, but for circular import
|
||||
# reasons exists in its own stub file (with ModuleSpec and Loader).
|
||||
from _importlib_modulespec import ModuleType as ModuleType # Exported
|
||||
|
||||
class TracebackType:
|
||||
tb_frame = ... # type: FrameType
|
||||
tb_lasti = ... # type: int
|
||||
|
||||
Reference in New Issue
Block a user