mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Fixing flake8 E401, E402 errors
This commit is contained in:
2
.flake8
2
.flake8
@@ -18,7 +18,6 @@ ignore = F401, F811, E127, E128, E301, E302, E305, E501, E701, E704
|
||||
|
||||
# Errors that we need to fix before enabling flake8 by default:
|
||||
# 921 F821 undefined name
|
||||
# 52 E402 module-level import not at top of file
|
||||
# 48 E225 missing whitespace around operator
|
||||
# 28 E116 unexpected indentation (comment)
|
||||
# 26 F403 from * import used
|
||||
@@ -32,5 +31,4 @@ ignore = F401, F811, E127, E128, E301, E302, E305, E501, E701, E704
|
||||
# 4 E114 indentation is not a multiple of four
|
||||
# 3 E303 too many blank lines
|
||||
# 2 B303 __metaclass__ use on Python 3
|
||||
# 1 E401 multiple imports on one line
|
||||
# 1 E202 whitespace before )
|
||||
|
||||
@@ -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
|
||||
|
||||
8
third_party/2/simplejson/__init__.pyi
vendored
8
third_party/2/simplejson/__init__.pyi
vendored
@@ -1,10 +1,10 @@
|
||||
from typing import Any, IO
|
||||
|
||||
from simplejson.scanner import JSONDecodeError
|
||||
from simplejson.decoder import JSONDecoder
|
||||
from simplejson.encoder import JSONEncoder, JSONEncoderForHTML
|
||||
|
||||
def dumps(obj: Any, *args: Any, **kwds: Any) -> str: ...
|
||||
def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
|
||||
def loads(s: str, **kwds: Any) -> Any: ...
|
||||
def load(fp: IO[str]) -> Any: ...
|
||||
|
||||
from simplejson.scanner import JSONDecodeError
|
||||
from simplejson.decoder import JSONDecoder
|
||||
from simplejson.encoder import JSONEncoder, JSONEncoderForHTML
|
||||
|
||||
13
third_party/2/six/__init__.pyi
vendored
13
third_party/2/six/__init__.pyi
vendored
@@ -2,14 +2,19 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import types
|
||||
from typing import (
|
||||
Any, AnyStr, Callable, Iterable, Mapping, Optional,
|
||||
Pattern, Tuple, TypeVar, Union, overload, ValuesView, KeysView, ItemsView
|
||||
)
|
||||
import typing
|
||||
|
||||
import unittest
|
||||
import types
|
||||
|
||||
# Exports
|
||||
from __builtin__ import unichr as unichr
|
||||
from StringIO import StringIO as StringIO, StringIO as BytesIO
|
||||
from functools import wraps as wraps
|
||||
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_K = TypeVar('_K')
|
||||
@@ -62,12 +67,10 @@ def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...
|
||||
|
||||
def b(s: str) -> binary_type: ...
|
||||
def u(s: str) -> text_type: ...
|
||||
from __builtin__ import unichr as unichr
|
||||
int2byte = chr
|
||||
def byte2int(bs: binary_type) -> int: ...
|
||||
def indexbytes(buf: binary_type, i: int) -> int: ...
|
||||
def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
|
||||
from StringIO import StringIO as StringIO, StringIO as BytesIO
|
||||
|
||||
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = ...) -> None: ...
|
||||
@overload
|
||||
@@ -82,8 +85,6 @@ def raise_from(value: BaseException, from_value: BaseException) -> None: ...
|
||||
|
||||
print_ = print
|
||||
|
||||
from functools import wraps as wraps
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
|
||||
6
third_party/2/sqlalchemy/sql/expression.pyi
vendored
6
third_party/2/sqlalchemy/sql/expression.pyi
vendored
@@ -7,9 +7,6 @@ from . import base
|
||||
from . import selectable
|
||||
from . import dml
|
||||
|
||||
func = functions.func # type: functions._FunctionGenerator
|
||||
modifier = functions.modifier # type: functions._FunctionGenerator
|
||||
|
||||
from .visitors import Visitable
|
||||
|
||||
from .elements import ClauseElement, ColumnElement,\
|
||||
@@ -28,6 +25,9 @@ from .selectable import Alias, Join, Select, Selectable, TableClause, \
|
||||
subquery, HasPrefixes, HasSuffixes, Exists, ScalarSelect, TextAsFrom
|
||||
from .dml import Insert, Update, Delete, UpdateBase, ValuesBase
|
||||
|
||||
func = functions.func # type: functions._FunctionGenerator
|
||||
modifier = functions.modifier # type: functions._FunctionGenerator
|
||||
|
||||
and_ = ... # type: Any
|
||||
or_ = ... # type: Any
|
||||
bindparam = ... # type: Any
|
||||
|
||||
4
third_party/2and3/jinja2/utils.pyi
vendored
4
third_party/2and3/jinja2/utils.pyi
vendored
@@ -4,6 +4,8 @@
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
from markupsafe import Markup, escape, soft_unicode
|
||||
|
||||
missing = ... # type: Any
|
||||
internal_code = ... # type: Any
|
||||
concat = ... # type: Any
|
||||
@@ -60,5 +62,3 @@ class Joiner:
|
||||
used = ... # type: bool
|
||||
def __init__(self, sep: str = ...) -> None: ...
|
||||
def __call__(self): ...
|
||||
|
||||
from markupsafe import Markup, escape, soft_unicode
|
||||
|
||||
4
third_party/3.6/click/core.pyi
vendored
4
third_party/3.6/click/core.pyi
vendored
@@ -430,5 +430,5 @@ class Argument(Parameter):
|
||||
) -> None:
|
||||
...
|
||||
|
||||
|
||||
from click.types import ParamType # cyclic dependency
|
||||
# cyclic dependency
|
||||
from click.types import ParamType # noqa: E402
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from typing import Any
|
||||
from . import packages
|
||||
from http.client import HTTPConnection as _HTTPConnection
|
||||
import ssl
|
||||
# from httplib import HTTPConnection as _HTTPConnection # python 2
|
||||
from . import exceptions
|
||||
from .packages import ssl_match_hostname
|
||||
@@ -12,7 +13,6 @@ import http.client
|
||||
|
||||
class DummyConnection: ...
|
||||
|
||||
import ssl
|
||||
BaseSSLError = ssl.SSLError
|
||||
ConnectionError = __builtins__.ConnectionError
|
||||
HTTPException = http.client.HTTPException
|
||||
|
||||
16
third_party/3/six/__init__.pyi
vendored
16
third_party/3/six/__init__.pyi
vendored
@@ -19,10 +19,14 @@ from typing import (
|
||||
ValuesView,
|
||||
overload,
|
||||
)
|
||||
import typing
|
||||
|
||||
import unittest
|
||||
import types
|
||||
import typing
|
||||
import unittest
|
||||
|
||||
# Exports
|
||||
from io import StringIO as StringIO, BytesIO as BytesIO
|
||||
from builtins import next as next
|
||||
from functools import wraps as wraps
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_K = TypeVar('_K')
|
||||
@@ -45,9 +49,6 @@ MAXSIZE = ... # type: int
|
||||
# def add_move
|
||||
# def remove_move
|
||||
|
||||
from builtins import next as advance_iterator
|
||||
next = advance_iterator
|
||||
|
||||
def callable(obj: object) -> bool: ...
|
||||
|
||||
def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ...
|
||||
@@ -80,7 +81,6 @@ def int2byte(i: int) -> bytes: ...
|
||||
def byte2int(bs: binary_type) -> int: ...
|
||||
def indexbytes(buf: binary_type, i: int) -> int: ...
|
||||
def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
|
||||
from io import StringIO as StringIO, BytesIO as BytesIO
|
||||
|
||||
def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: str = None) -> None: ...
|
||||
@overload
|
||||
@@ -96,8 +96,6 @@ def raise_from(value: BaseException, from_value: BaseException) -> None: ...
|
||||
|
||||
print_ = print
|
||||
|
||||
from functools import wraps as wraps
|
||||
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
|
||||
Reference in New Issue
Block a user