Use explicit "# type: str" instead of '' shortcut.

This commit is contained in:
Matthias Kramm
2015-11-09 07:59:14 -08:00
parent 63e441e804
commit d2a3d4a4ed
28 changed files with 139 additions and 137 deletions

View File

@@ -24,7 +24,7 @@ classmethod = object() # Special, only valid as a decorator.
property = object()
class object:
__doc__ = ''
__doc__ = ... # type: str
__class__ = ... # type: type
def __init__(self) -> None: ...
@@ -35,8 +35,8 @@ class object:
def __hash__(self) -> int: ...
class type:
__name__ = ''
__module__ = ''
__name__ = ... # type: str
__module__ = ... # type: str
__dict__ = ... # type: Dict[unicode, Any]
@overload
@@ -461,8 +461,8 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
class function:
# TODO name of the class (corresponds to Python 'function' class)
__name__ = ''
__module__ = ''
__name__ = ... # type: str
__module__ = ... # type: str
class list(MutableSequence[_T], Reversible[_T], Generic[_T]):
@overload
@@ -594,8 +594,8 @@ class xrange(Sized, Iterable[int], Reversible[int]):
def __reversed__(self) -> Iterator[int]: ...
class module:
__name__ = ''
__file__ = ''
__name__ = ... # type: str
__file__ = ... # type: str
__dict__ = ... # type: Dict[unicode, Any]
True = ... # type: bool
@@ -757,8 +757,9 @@ class ArithmeticError(StandardError): ...
class BufferError(StandardError): ...
class EnvironmentError(StandardError):
errno = 0
strerror = ''
filename = '' # TODO can this be unicode?
strerror = ... # type: str
# TODO can this be unicode?
filename = ... # type: str
class LookupError(StandardError): ...
class RuntimeError(StandardError): ...
class ValueError(StandardError): ...

View File

@@ -40,7 +40,7 @@ class _version_info(Tuple[int, int, int, str, int]):
major = 0
minor = 0
micro = 0
releaselevel = ''
releaselevel = ... # type: str
serial = 0
_mercurial = ... # type: Tuple[str, str, str]
@@ -75,8 +75,8 @@ version = ... # type: str
warnoptions = ... # type: object
float_info = ... # type: _float_info
version_info = ... # type: _version_info
ps1 = ''
ps2 = ''
ps1 = ... # type: str
ps2 = ... # type: str
last_type = ... # type: type
last_value = ... # type: BaseException
last_traceback = ... # type: TracebackType

View File

@@ -4,12 +4,12 @@
from typing import Any, Iterable, Tuple, List, Iterator, BinaryIO, overload
typecodes = ''
typecodes = ... # type: str
class array:
def __init__(self, typecode: str,
initializer: Iterable[Any] = None) -> None:
typecode = ''
typecode = ... # type: str
itemsize = 0
def append(self, x: Any) -> None: ...

View File

@@ -26,7 +26,7 @@ classmethod = object() # Only valid as a decorator.
property = object()
class object:
__doc__ = ''
__doc__ = ... # type: str
__class__ = ... # type: type
def __init__(self) -> None: ...
@@ -37,9 +37,9 @@ class object:
def __hash__(self) -> int: ...
class type:
__name__ = ''
__qualname__ = ''
__module__ = ''
__name__ = ... # type: str
__qualname__ = ... # type: str
__module__ = ... # type: str
__dict__ = ... # type: Dict[str, Any]
def __init__(self, o: object) -> None: ...
@@ -431,9 +431,9 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
class function:
# TODO not defined in builtins!
__name__ = ''
__qualname__ = ''
__module__ = ''
__name__ = ... # type: str
__qualname__ = ... # type: str
__module__ = ... # type: str
__code__ = ... # type: Any
class list(MutableSequence[_T], Reversible[_T], Generic[_T]):
@@ -595,8 +595,8 @@ class range(Sequence[int], Reversible[int]):
class module:
# TODO not defined in builtins!
__name__ = ''
__file__ = ''
__name__ = ... # type: str
__file__ = ... # type: str
__dict__ = ... # type: Dict[str, Any]
True = ... # type: bool
@@ -732,8 +732,9 @@ class Exception(BaseException): ...
class ArithmeticError(Exception): ...
class EnvironmentError(Exception):
errno = 0
strerror = ''
filename = '' # TODO can this be bytes?
strerror = ... # type: str
# TODO can this be bytes?
filename = ... # type: str
class LookupError(Exception): ...
class RuntimeError(Exception): ...
class ValueError(Exception): ...

View File

@@ -3,8 +3,8 @@ from typing import List
# TODO group database entry object type
class struct_group:
gr_name = ''
gr_passwd = ''
gr_name = ... # type: str
gr_passwd = ... # type: str
gr_gid = 0
gr_mem = ... # type: List[str]

View File

@@ -6,13 +6,13 @@ import typing
class struct_passwd:
# TODO use namedtuple
pw_name = ''
pw_passwd = ''
pw_name = ... # type: str
pw_passwd = ... # type: str
pw_uid = 0
pw_gid = 0
pw_gecos = ''
pw_dir = ''
pw_shell = ''
pw_gecos = ... # type: str
pw_dir = ... # type: str
pw_shell = ... # type: str
def getpwuid(uid: int) -> struct_passwd: ...
def getpwnam(name: str) -> struct_passwd: ...

View File

@@ -9,18 +9,18 @@ from typing import (
from types import TracebackType
# ----- sys variables -----
abiflags = ''
abiflags = ... # type: str
argv = ... # type: List[str]
byteorder = ''
byteorder = ... # type: str
builtin_module_names = ... # type: Sequence[str] # actually a tuple of strings
copyright = ''
copyright = ... # type: str
#dllhandle = 0 # Windows only
dont_write_bytecode = False
__displayhook__ = ... # type: Any # contains the original value of displayhook
__excepthook__ = ... # type: Any # contains the original value of excepthook
exec_prefix = ''
executable = ''
float_repr_style = ''
exec_prefix = ... # type: str
executable = ... # type: str
float_repr_style = ... # type: str
hexversion = 0 # this is a 32-bit int
last_type = ... # type: Any
last_value = ... # type: Any
@@ -32,10 +32,10 @@ modules = ... # type: Dict[str, Any]
path = ... # type: List[str]
path_hooks = ... # type: List[Any] # TODO precise type; function, path to finder
path_importer_cache = ... # type: Dict[str, Any] # TODO precise type
platform = ''
prefix = ''
ps1 = ''
ps2 = ''
platform = ... # type: str
prefix = ... # type: str
ps1 = ... # type: str
ps2 = ... # type: str
stdin = ... # type: TextIO
stdout = ... # type: TextIO
stderr = ... # type: TextIO
@@ -45,7 +45,7 @@ __stderr__ = ... # type: TextIO
# deprecated and removed in Python 3.3:
subversion = ... # type: Tuple[str, str, str]
tracebacklimit = 0
version = ''
version = ... # type: str
api_version = 0
warnoptions = ... # type: Any
# Each entry is a tuple of the form (action, message, category, module,
@@ -102,7 +102,7 @@ class _version_info(Tuple[int, int, int, str, int]):
major = 0
minor = 0
micro = 0
releaselevel = ''
releaselevel = ... # type: str
serial = 0
version_info = ... # type: _version_info