mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Misc stub fixes (#181)
This commit is contained in:
committed by
Guido van Rossum
parent
c21d8a41d5
commit
292447bd62
@@ -849,7 +849,7 @@ class UnicodeWarning(Warning): ...
|
||||
class BytesWarning(Warning): ...
|
||||
class ResourceWarning(Warning): ...
|
||||
|
||||
def eval(s: str) -> Any: ...
|
||||
def eval(s: str, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
|
||||
|
||||
def cmp(x: Any, y: Any) -> int: ...
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ class ProxyType(object): # "weakproxy"
|
||||
|
||||
class ReferenceType(Generic[_T]):
|
||||
# TODO rest of members
|
||||
def __call__(self) -> Optional[_T]:
|
||||
...
|
||||
def __init__(self, o: _T, callback: Callable[[ReferenceType[_T]],
|
||||
Any] = ...) -> None: ...
|
||||
def __call__(self) -> Optional[_T]: ...
|
||||
|
||||
def ref(o: _T, callback: Callable[[ReferenceType[_T]],
|
||||
Any] = ...) -> ReferenceType[_T]: ...
|
||||
ref = ReferenceType
|
||||
|
||||
def getweakrefcount(object: Any) -> int: ...
|
||||
def getweakrefs(object: Any) -> int: ...
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
# NOTE: These are incomplete!
|
||||
|
||||
from typing import TypeVar
|
||||
from typing import TypeVar, Dict, Any
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
def deepcopy(x: _T) -> _T: ...
|
||||
def deepcopy(x: _T, memo: Dict[Any, Any] = ...) -> _T: ...
|
||||
def copy(x: _T) -> _T: ...
|
||||
|
||||
@@ -191,7 +191,7 @@ def nice(increment: int) -> int: ...
|
||||
|
||||
# TODO: plock, popen*, spawn*, P_*
|
||||
|
||||
def startfile(path: unicode, operation: str) -> None: ...
|
||||
def startfile(path: unicode, operation: str = ...) -> None: ... # Windows only
|
||||
def system(command: unicode) -> int: ...
|
||||
def times() -> Tuple[float, float, float, float, float]: ...
|
||||
def wait() -> Tuple[int, int]: ... # Unix only
|
||||
|
||||
@@ -4,10 +4,10 @@ class Template:
|
||||
def __init__(self) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def clone(self) -> Template: ...
|
||||
def debug(flag: bool) -> None: ...
|
||||
def append(cmd: str, kind: str) -> None: ...
|
||||
def prepend(cmd: str, kind: str) -> None: ...
|
||||
def open(file: str, mode: str) -> IO[Any]: ...
|
||||
def copy(infile: str, outfile: str) -> None: ...
|
||||
def debug(self, flag: bool) -> None: ...
|
||||
def append(self, cmd: str, kind: str) -> None: ...
|
||||
def prepend(self, cmd: str, kind: str) -> None: ...
|
||||
def open(self, file: str, mode: str) -> IO[Any]: ...
|
||||
def copy(self, infile: str, outfile: str) -> None: ...
|
||||
|
||||
def quote(s: str) -> str: ...
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
"""Stub file for the 'time' module."""
|
||||
# See https://docs.python.org/2/library/time.html
|
||||
|
||||
from typing import NamedTuple, Tuple, Union
|
||||
from typing import NamedTuple, Tuple, Union, Any
|
||||
|
||||
# ----- variables and constants -----
|
||||
accept2dyear = False
|
||||
accept2dyear = False
|
||||
altzone = 0
|
||||
daylight = 0
|
||||
timezone = 0
|
||||
tzname = ... # type: Tuple[str, str]
|
||||
|
||||
struct_time = NamedTuple('struct_time',
|
||||
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
|
||||
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
|
||||
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int)])
|
||||
class struct_time(NamedTuple('_struct_time',
|
||||
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
|
||||
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
|
||||
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int)])):
|
||||
def __init__(self, o: Tuple[int, int, int,
|
||||
int, int, int,
|
||||
int, int, int], _arg: Any = ...) -> None: ...
|
||||
|
||||
_TIME_TUPLE = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
|
||||
|
||||
@@ -4,7 +4,15 @@
|
||||
|
||||
from typing import Any
|
||||
import UserDict
|
||||
from _weakref import getweakrefcount as getweakrefcount, getweakrefs as getweakrefs, ref as ref, proxy as proxy, CallableProxyType as CallableProxyType, ProxyType as ProxyType, ReferenceType as ReferenceType
|
||||
from _weakref import (
|
||||
getweakrefcount as getweakrefcount,
|
||||
getweakrefs as getweakrefs,
|
||||
ref as ref,
|
||||
proxy as proxy,
|
||||
CallableProxyType as CallableProxyType,
|
||||
ProxyType as ProxyType,
|
||||
ReferenceType as ReferenceType
|
||||
)
|
||||
from _weakrefset import WeakSet as WeakSet
|
||||
from exceptions import ReferenceError as ReferenceError
|
||||
|
||||
|
||||
Reference in New Issue
Block a user