Fix annotations with literal values (#3411)

This commit is contained in:
Sebastian Rittau
2019-10-28 14:59:28 +01:00
committed by Jelle Zijlstra
parent 6a7c2011cc
commit 87d7dd3d95
15 changed files with 104 additions and 104 deletions

View File

@@ -6,9 +6,9 @@ _DataType = Union[str, unicode, bytearray, buffer, memoryview]
class _hash(object): # This is not actually in the module namespace.
name: str
block_size = 0
digest_size = 0
digestsize = 0
block_size: int
digest_size: int
digestsize: int
def __init__(self, arg: _DataType = ...) -> None: ...
def update(self, arg: _DataType) -> None: ...
def digest(self) -> str: ...

View File

@@ -2,5 +2,5 @@
from hashlib import md5 as md5, md5 as new
blocksize = 0
digest_size = 0
blocksize: int
digest_size: int

View File

@@ -10,21 +10,21 @@ from typing import (
)
# ----- re variables and constants -----
DEBUG = 0
I = 0
IGNORECASE = 0
L = 0
LOCALE = 0
M = 0
MULTILINE = 0
S = 0
DOTALL = 0
X = 0
VERBOSE = 0
U = 0
UNICODE = 0
T = 0
TEMPLATE = 0
DEBUG: int
I: int
IGNORECASE: int
L: int
LOCALE: int
M: int
MULTILINE: int
S: int
DOTALL: int
X: int
VERBOSE: int
U: int
UNICODE: int
T: int
TEMPLATE: int
class error(Exception): ...

View File

@@ -7,5 +7,5 @@ class sha(object):
def copy(self) -> sha: ...
def new(string: str = ...) -> sha: ...
blocksize = 0
digest_size = 0
blocksize: int
digest_size: int

View File

@@ -9,51 +9,51 @@ def S_ISSOCK(mode: int) -> bool: ...
def S_IMODE(mode: int) -> int: ...
def S_IFMT(mode: int) -> int: ...
ST_MODE = 0
ST_INO = 0
ST_DEV = 0
ST_NLINK = 0
ST_UID = 0
ST_GID = 0
ST_SIZE = 0
ST_ATIME = 0
ST_MTIME = 0
ST_CTIME = 0
S_IFSOCK = 0
S_IFLNK = 0
S_IFREG = 0
S_IFBLK = 0
S_IFDIR = 0
S_IFCHR = 0
S_IFIFO = 0
S_ISUID = 0
S_ISGID = 0
S_ISVTX = 0
S_IRWXU = 0
S_IRUSR = 0
S_IWUSR = 0
S_IXUSR = 0
S_IRWXG = 0
S_IRGRP = 0
S_IWGRP = 0
S_IXGRP = 0
S_IRWXO = 0
S_IROTH = 0
S_IWOTH = 0
S_IXOTH = 0
S_ENFMT = 0
S_IREAD = 0
S_IWRITE = 0
S_IEXEC = 0
UF_NODUMP = 0
UF_IMMUTABLE = 0
UF_APPEND = 0
UF_OPAQUE = 0
UF_NOUNLINK = 0
UF_COMPRESSED = 0
UF_HIDDEN = 0
SF_ARCHIVED = 0
SF_IMMUTABLE = 0
SF_APPEND = 0
SF_NOUNLINK = 0
SF_SNAPSHOT = 0
ST_MODE: int
ST_INO: int
ST_DEV: int
ST_NLINK: int
ST_UID: int
ST_GID: int
ST_SIZE: int
ST_ATIME: int
ST_MTIME: int
ST_CTIME: int
S_IFSOCK: int
S_IFLNK: int
S_IFREG: int
S_IFBLK: int
S_IFDIR: int
S_IFCHR: int
S_IFIFO: int
S_ISUID: int
S_ISGID: int
S_ISVTX: int
S_IRWXU: int
S_IRUSR: int
S_IWUSR: int
S_IXUSR: int
S_IRWXG: int
S_IRGRP: int
S_IWGRP: int
S_IXGRP: int
S_IRWXO: int
S_IROTH: int
S_IWOTH: int
S_IXOTH: int
S_ENFMT: int
S_IREAD: int
S_IWRITE: int
S_IEXEC: int
UF_NODUMP: int
UF_IMMUTABLE: int
UF_APPEND: int
UF_OPAQUE: int
UF_NOUNLINK: int
UF_COMPRESSED: int
UF_HIDDEN: int
SF_ARCHIVED: int
SF_IMMUTABLE: int
SF_APPEND: int
SF_NOUNLINK: int
SF_SNAPSHOT: int

View File

@@ -61,7 +61,7 @@ PIPE: int
STDOUT: int
class CalledProcessError(Exception):
returncode = 0
returncode: int
# morally: _CMD
cmd: Any
# morally: Optional[bytes]
@@ -79,8 +79,8 @@ class Popen(Generic[_T]):
stdin: Optional[IO[bytes]]
stdout: Optional[IO[bytes]]
stderr: Optional[IO[bytes]]
pid = 0
returncode = 0
pid: int
returncode: int
def __new__(cls,
args: _CMD,

View File

@@ -42,11 +42,11 @@ class _float_info:
rounds: int
class _version_info(Tuple[int, int, int, str, int]):
major = 0
minor = 0
micro = 0
major: int
minor: int
micro: int
releaselevel: str
serial = 0
serial: int
_mercurial: Tuple[str, str, str]
api_version: int

View File

@@ -11,7 +11,7 @@ non_hierarchical: List[str]
uses_query: List[str]
uses_fragment: List[str]
scheme_chars: str
MAX_CACHE_SIZE = 0
MAX_CACHE_SIZE: int
def clear_cache() -> None: ...

View File

@@ -4,17 +4,17 @@
from typing import Mapping, Any, Tuple
CREATE_NEW_CONSOLE = 0
CREATE_NEW_PROCESS_GROUP = 0
STD_INPUT_HANDLE = 0
STD_OUTPUT_HANDLE = 0
STD_ERROR_HANDLE = 0
SW_HIDE = 0
STARTF_USESTDHANDLES = 0
STARTF_USESHOWWINDOW = 0
INFINITE = 0
DUPLICATE_SAME_ACCESS = 0
WAIT_OBJECT_0 = 0
CREATE_NEW_CONSOLE: int
CREATE_NEW_PROCESS_GROUP: int
STD_INPUT_HANDLE: int
STD_OUTPUT_HANDLE: int
STD_ERROR_HANDLE: int
SW_HIDE: int
STARTF_USESTDHANDLES: int
STARTF_USESHOWWINDOW: int
INFINITE: int
DUPLICATE_SAME_ACCESS: int
WAIT_OBJECT_0: int
# TODO not exported by the Python module
class Handle:

View File

@@ -2,9 +2,9 @@
from typing import Tuple, Callable, Optional
from types import TracebackType
BUFSIZE: int = ...
PIPE: int = ...
STDOUT: int = ...
BUFSIZE: int
PIPE: int
STDOUT: int
def pipe(*, duplex: bool = ..., overlapped: Tuple[bool, bool] = ..., bufsize: int = ...) -> Tuple[int, int]: ...

View File

@@ -13,6 +13,6 @@ def spawn_main(pipe_handle: int, parent_pid: Optional[int] = ..., tracker_fd: Op
# undocumented
def _main(fd: int) -> Any: ...
def get_preparation_data(name: str) -> Dict[str, Any]: ...
old_main_modules: List[ModuleType] = ...
old_main_modules: List[ModuleType]
def prepare(data: Mapping[str, Any]) -> None: ...
def import_main_path(main_path: str) -> None: ...

View File

@@ -19,8 +19,8 @@ class shlex(Iterable[str]):
infile: str
instream: TextIO
source: str
debug = 0
lineno = 0
debug: int
lineno: int
token: str
eof: str
if sys.version_info >= (3, 6):

View File

@@ -814,7 +814,7 @@ class TimeoutExpired(SubprocessError):
class CalledProcessError(Exception):
returncode = 0
returncode: int
# morally: _CMD
cmd: Any
# morally: Optional[_TXT]
@@ -835,8 +835,8 @@ class Popen(Generic[AnyStr]):
stdin: IO[AnyStr]
stdout: IO[AnyStr]
stderr: IO[AnyStr]
pid = 0
returncode = 0
pid: int
returncode: int
# Technically it is wrong that Popen provides __new__ instead of __init__
# but this shouldn't come up hopefully?

View File

@@ -29,7 +29,7 @@ if sys.version_info >= (3, 8):
def final(f: _F) -> _F: ...
Literal: _SpecialForm = ...
# TypedDict is a (non-subscriptable) special form.
TypedDict: object = ...
TypedDict: object
class GenericMeta(type): ...
@@ -525,8 +525,8 @@ class TextIO(IO[str]):
class ByteString(Sequence[int], metaclass=ABCMeta): ...
class Match(Generic[AnyStr]):
pos = 0
endpos = 0
pos: int
endpos: int
lastindex: Optional[int]
lastgroup: Optional[AnyStr]
string: AnyStr
@@ -559,9 +559,9 @@ class Match(Generic[AnyStr]):
def __getitem__(self, g: Union[int, str]) -> AnyStr: ...
class Pattern(Generic[AnyStr]):
flags = 0
flags: int
groupindex: Mapping[str, int]
groups = 0
groups: int
pattern: AnyStr
def search(self, string: AnyStr, pos: int = ...,

View File

@@ -11,7 +11,7 @@ non_hierarchical: List[str]
uses_query: List[str]
uses_fragment: List[str]
scheme_chars: str
MAX_CACHE_SIZE = 0
MAX_CACHE_SIZE: int
class _ResultMixinBase(Generic[AnyStr]):
def geturl(self) -> AnyStr: ...