Skip to content

Commit ade686c

Browse files
committed
Remove Undefined from stubs
Part of #680
1 parent d65af01 commit ade686c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1351
-1364
lines changed

stubs/2.7/__future__.pyi

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
from typing import Undefined
2-
31
class _Feature: pass
42

5-
absolute_import = Undefined(_Feature)
6-
division = Undefined(_Feature)
7-
generators = Undefined(_Feature)
8-
nested_scopes = Undefined(_Feature)
9-
print_function = Undefined(_Feature)
10-
unicode_literals = Undefined(_Feature)
11-
with_statement = Undefined(_Feature)
3+
absolute_import = None # type: _Feature
4+
division = None # type: _Feature
5+
generators = None # type: _Feature
6+
nested_scopes = None # type: _Feature
7+
print_function = None # type: _Feature
8+
unicode_literals = None # type: _Feature
9+
with_statement = None # type: _Feature

stubs/2.7/builtins.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Stubs for builtins (Python 2.7)
22

33
from typing import (
4-
Undefined, TypeVar, Iterator, Iterable, overload,
4+
TypeVar, Iterator, Iterable, overload,
55
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
66
AbstractSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
77
SupportsRound, IO, BinaryIO, Union, AnyStr
@@ -23,7 +23,7 @@ property = object()
2323

2424
class object:
2525
__doc__ = ''
26-
__class__ = Undefined # type: type
26+
__class__ = None # type: type
2727

2828
def __init__(self) -> None: pass
2929
def __eq__(self, o: object) -> bool: pass
@@ -35,7 +35,7 @@ class object:
3535
class type:
3636
__name__ = ''
3737
__module__ = ''
38-
__dict__ = Undefined # type: Dict[unicode, Any]
38+
__dict__ = None # type: Dict[unicode, Any]
3939

4040
def __init__(self, o: object) -> None: pass
4141
# TODO: __new__ may have to be special and not a static method.
@@ -578,7 +578,7 @@ class list(Sequence[_T], Reversible[_T], Generic[_T]):
578578
def append(self, object: _T) -> None: pass
579579
def extend(self, iterable: Iterable[_T]) -> None: pass
580580
def pop(self, index: int = -1) -> _T: pass
581-
def index(self, object: _T, start: int = 0, stop: int = Undefined(int)) -> int: pass
581+
def index(self, object: _T, start: int = 0, stop: int = None) -> int: pass
582582
def count(self, object: _T) -> int: pass
583583
def insert(self, index: int, object: _T) -> None: pass
584584
def remove(self, object: _T) -> None: pass
@@ -709,16 +709,16 @@ class xrange(Sized, Iterable[int], Reversible[int]):
709709
class module:
710710
__name__ = ''
711711
__file__ = ''
712-
__dict__ = Undefined # type: Dict[unicode, Any]
712+
__dict__ = None # type: Dict[unicode, Any]
713713

714-
True = Undefined # type: bool
715-
False = Undefined # type: bool
714+
True = None # type: bool
715+
False = None # type: bool
716716
__debug__ = False
717717

718718
long = int
719719
bytes = str
720720

721-
NotImplemented = Undefined # type: Any
721+
NotImplemented = None # type: Any
722722

723723
def abs(n: SupportsAbs[_T]) -> _T: pass
724724
def all(i: Iterable) -> bool: pass
@@ -841,7 +841,7 @@ def __import__(name: unicode,
841841
# Exceptions
842842

843843
class BaseException:
844-
args = Undefined # type: Any
844+
args = None # type: Any
845845
def __init__(self, *args: Any) -> None: pass
846846
def with_traceback(self, tb: Any) -> BaseException: pass
847847

stubs/2.7/difflib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
# TODO: Support unicode?
66

77
from typing import (
8-
TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic, Undefined
8+
TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic
99
)
1010

1111
_T = TypeVar('_T')
1212

1313
class SequenceMatcher(Generic[_T]):
1414
def __init__(self, isjunk: Callable[[_T], bool] = None,
15-
a: Sequence[_T] = Undefined, b: Sequence[_T] = Undefined,
15+
a: Sequence[_T] = b: Sequence[_T],
1616
autojunk: bool = True) -> None: pass
1717
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: pass
1818
def set_seq1(self, a: Sequence[_T]) -> None: pass

stubs/2.7/re.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# based on: http://docs.python.org/2.7/library/re.html
66

77
from typing import (
8-
Undefined, List, Iterator, overload, Callable, Tuple, Sequence, Dict,
8+
List, Iterator, overload, Callable, Tuple, Sequence, Dict,
99
Generic, AnyStr, Match, Pattern
1010
)
1111

stubs/2.7/sys.pyi

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,54 @@
66
# Partially adapted to Python 2.7 by Jukka Lehtosalo.
77

88
from typing import (
9-
Undefined, List, Sequence, Any, Dict, Tuple, BinaryIO, overload
9+
List, Sequence, Any, Dict, Tuple, BinaryIO, overload
1010
)
1111

1212
# ----- sys variables -----
1313
abiflags = ''
14-
argv = Undefined(List[str])
14+
argv = None # type: List[str]
1515
byteorder = ''
16-
builtin_module_names = Undefined(Sequence[str]) # actually a tuple of strings
16+
builtin_module_names = None # type: Sequence[str] # actually a tuple of strings
1717
copyright = ''
1818
#dllhandle = 0 # Windows only
1919
dont_write_bytecode = False
20-
__displayhook__ = Undefined(Any) # contains the original value of displayhook
21-
__excepthook__ = Undefined(Any) # contains the original value of excepthook
20+
__displayhook__ = None # type: Any # contains the original value of displayhook
21+
__excepthook__ = None # type: Any # contains the original value of excepthook
2222
exec_prefix = ''
2323
executable = ''
2424
float_repr_style = ''
2525
hexversion = 0 # this is a 32-bit int
26-
last_type = Undefined(Any)
27-
last_value = Undefined(Any)
28-
last_traceback = Undefined(Any)
26+
last_type = None # type: Any
27+
last_value = None # type: Any
28+
last_traceback = None # type: Any
2929
maxsize = 0
3030
maxunicode = 0
31-
meta_path = Undefined(List[Any])
32-
modules = Undefined(Dict[str, Any])
33-
path = Undefined(List[str])
34-
path_hooks = Undefined(List[Any]) # TODO precise type; function, path to finder
35-
path_importer_cache = Undefined(Dict[str, Any]) # TODO precise type
31+
meta_path = None # type: List[Any]
32+
modules = None # type: Dict[str, Any]
33+
path = None # type: List[str]
34+
path_hooks = None # type: List[Any] # TODO precise type; function, path to finder
35+
path_importer_cache = None # type: Dict[str, Any] # TODO precise type
3636
platform = ''
3737
prefix = ''
3838
ps1 = ''
3939
ps2 = ''
40-
stdin = Undefined(BinaryIO)
41-
stdout = Undefined(BinaryIO)
42-
stderr = Undefined(BinaryIO)
43-
__stdin__ = Undefined(BinaryIO)
44-
__stdout__ = Undefined(BinaryIO)
45-
__stderr__ = Undefined(BinaryIO)
46-
subversion = Undefined(Tuple[str, str, str])
40+
stdin = None # type: BinaryIO
41+
stdout = None # type: BinaryIO
42+
stderr = None # type: BinaryIO
43+
__stdin__ = None # type: BinaryIO
44+
__stdout__ = None # type: BinaryIO
45+
__stderr__ = None # type: BinaryIO
46+
subversion = None # type: Tuple[str, str, str]
4747
tracebacklimit = 0
4848
version = ''
4949
api_version = 0
50-
warnoptions = Undefined(Any)
50+
warnoptions = None # type: Any
5151
# Each entry is a tuple of the form (action, message, category, module,
5252
# lineno)
5353
#winver = '' # Windows only
54-
_xoptions = Undefined(Dict[Any, Any])
54+
_xoptions = None # type: Dict[Any, Any]
5555

56-
flags = Undefined(_flags)
56+
flags = None # type: _flags
5757
class _flags:
5858
debug = 0
5959
division_warning = 0
@@ -69,7 +69,7 @@ class _flags:
6969
quiet = 0
7070
hash_randomization = 0
7171

72-
float_info = Undefined(_float_info)
72+
float_info = None # type: _float_info
7373
class _float_info:
7474
epsilon = 0.0 # DBL_EPSILON
7575
dig = 0 # DBL_DIG
@@ -83,22 +83,22 @@ class _float_info:
8383
radix = 0 # FLT_RADIX
8484
rounds = 0 # FLT_ROUNDS
8585

86-
hash_info = Undefined(_hash_info)
86+
hash_info = None # type: _hash_info
8787
class _hash_info:
8888
width = 0 # width in bits used for hash values
8989
modulus = 0 # prime modulus P used for numeric hash scheme
9090
inf = 0 # hash value returned for a positive infinity
9191
nan = 0 # hash value returned for a nan
9292
imag = 0 # multiplier used for the imaginary part of a complex number
9393

94-
int_info = Undefined(_int_info)
94+
int_info = None # type: _int_info
9595
class _int_info:
9696
bits_per_digit = 0 # number of bits held in each digit. Python integers
9797
# are stored internally in
9898
# base 2**int_info.bits_per_digit
9999
sizeof_digit = 0 # size in bytes of C type used to represent a digit
100100

101-
version_info = Undefined(_version_info)
101+
version_info = None # type: _version_info
102102
class _version_info:
103103
major = 0
104104
minor = 0

stubs/2.7/typing.pyi

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ from abc import abstractmethod, ABCMeta
77

88
cast = object()
99
overload = object()
10-
Undefined = object()
1110
Any = object()
1211
TypeVar = object()
1312
Generic = object()
@@ -242,12 +241,12 @@ class Match(Generic[AnyStr]):
242241
pos = 0
243242
endpos = 0
244243
lastindex = 0
245-
lastgroup = Undefined(AnyStr)
246-
string = Undefined(AnyStr)
244+
lastgroup = None # type: AnyStr
245+
string = None # type: AnyStr
247246

248247
# The regular expression object whose match() or search() method produced
249248
# this match instance.
250-
re = Undefined('Pattern[AnyStr]')
249+
re = None # type: 'Pattern[AnyStr]'
251250

252251
def expand(self, template: AnyStr) -> AnyStr: pass
253252

@@ -272,7 +271,7 @@ class Pattern(Generic[AnyStr]):
272271
flags = 0
273272
groupindex = 0
274273
groups = 0
275-
pattern = Undefined(AnyStr)
274+
pattern = None # type: AnyStr
276275

277276
def search(self, string: AnyStr, pos: int = 0,
278277
endpos: int = -1) -> Match[AnyStr]: pass

stubs/3.2/__future__.pyi

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
from typing import Undefined
2-
31
class _Feature: pass
42

5-
absolute_import = Undefined(_Feature)
6-
division = Undefined(_Feature)
7-
generators = Undefined(_Feature)
8-
nested_scopes = Undefined(_Feature)
9-
print_function = Undefined(_Feature)
10-
unicode_literals = Undefined(_Feature)
11-
with_statement = Undefined(_Feature)
3+
absolute_import = ... # type: _Feature
4+
division = ... # type: _Feature
5+
generators = ... # type: _Feature
6+
nested_scopes = ... # type: _Feature
7+
print_function = ... # type: _Feature
8+
unicode_literals = ... # type: _Feature
9+
with_statement = ... # type: _Feature

stubs/3.2/_dummy_thread.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# NOTE: These are incomplete!
44

5-
from typing import Undefined, Any
5+
from typing import Any
66

77
class LockType:
88
def acquire(self) -> None: pass

stubs/3.2/_io.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# NOTE: This dynamically typed stub was automatically generated by stubgen.
44

5-
from typing import Any, Undefined
5+
from typing import Any
66

77
class _IOBase:
88
def __init__(self, *args, **kwargs): pass
@@ -15,7 +15,7 @@ class _IOBase:
1515
def readable(self): pass
1616
def readline(self, size: int = -1): pass
1717
def readlines(self, hint: int = -1): pass
18-
def seek(self, offset, whence=Undefined): pass
18+
def seek(self, offset, whence): pass
1919
def seekable(self): pass
2020
def tell(self): pass
2121
def truncate(self, size: int = None) -> int: pass
@@ -39,9 +39,9 @@ class _RawIOBase(_IOBase):
3939
def readall(self): pass
4040

4141
class _TextIOBase(_IOBase):
42-
encoding = Undefined(Any)
43-
errors = Undefined(Any)
44-
newlines = Undefined(Any)
42+
encoding = ... # type: Any
43+
errors = ... # type: Any
44+
newlines = ... # type: Any
4545
def detach(self): pass
4646
def read(self, size: int = -1): pass
4747
def readline(self, size: int = -1): pass

0 commit comments

Comments
 (0)