diff --git a/lib-typing/3.2/test_typing.py b/lib-typing/3.2/test_typing.py index 35630102d29c..c37e1130a117 100644 --- a/lib-typing/3.2/test_typing.py +++ b/lib-typing/3.2/test_typing.py @@ -8,12 +8,12 @@ import mock # 3rd party install, for PY3.2. from typing import Any -from typing import TypeVar, T, KT, VT, AnyStr +from typing import TypeVar, AnyStr +from typing import T, KT, VT # Not in __all__. from typing import Union, Optional from typing import Tuple from typing import Callable from typing import Generic -from typing import Undefined from typing import cast from typing import get_type_hints from typing import no_type_check, no_type_check_decorator @@ -23,19 +23,6 @@ import typing -class ConstantsTests(TestCase): - - def test_py23(self): - assert isinstance(typing.PY2, bool) - assert isinstance(typing.PY3, bool) - assert typing.PY3 == (not typing.PY2) - - def test_poswin(self): - assert isinstance(typing.POSIX, bool) - assert isinstance(typing.WINDOWS, bool) - assert typing.POSIX == (not typing.WINDOWS) - - class Employee: pass @@ -120,39 +107,78 @@ def test_any_is_subclass(self): class TypeVarTests(TestCase): - def test_isinstance(self): - self.assertNotIsInstance(42, T) - self.assertIsInstance(b'b', AnyStr) - self.assertIsInstance('s', AnyStr) - self.assertNotIsInstance(42, AnyStr) + def test_basic_plain(self): + T = TypeVar('T') + # Nothing is an instance if T. + with self.assertRaises(TypeError): + isinstance('', T) + # Every class is a subclass of T. + assert issubclass(int, T) + assert issubclass(str, T) + # T equals itself. + assert T == T + # T is a subclass of itself. + assert issubclass(T, T) + + def test_basic_constrained(self): + A = TypeVar('A', str, bytes) + # Nothing is an instance of A. + with self.assertRaises(TypeError): + isinstance('', A) + # Only str and bytes are subclasses of A. + assert issubclass(str, A) + assert issubclass(bytes, A) + assert not issubclass(int, A) + # A equals itself. + assert A == A + # A is a subclass of itself. + assert issubclass(A, A) - def test_issubclass(self): - self.assertTrue(issubclass(T, Any)) - self.assertFalse(issubclass(int, T)) - self.assertTrue(issubclass(bytes, AnyStr)) - self.assertTrue(issubclass(str, AnyStr)) - self.assertTrue(issubclass(T, T)) - self.assertTrue(issubclass(AnyStr, AnyStr)) + def test_constrained_error(self): + with self.assertRaises(TypeError): + X = TypeVar('X', int) + + def test_union_unique(self): + X = TypeVar('X') + Y = TypeVar('Y') + assert X != Y + assert Union[X] == X + assert Union[X] != Union[X, Y] + assert Union[X, X] == X + assert Union[X, int] != Union[X] + assert Union[X, int] != Union[int] + assert Union[X, int].__union_params__ == (X, int) + assert Union[X, int].__union_set_params__ == {X, int} + + def test_union_constrained(self): + A = TypeVar('A', str, bytes) + assert Union[A, str] != Union[A] def test_repr(self): self.assertEqual(repr(T), '~T') self.assertEqual(repr(KT), '~KT') self.assertEqual(repr(VT), '~VT') self.assertEqual(repr(AnyStr), '~AnyStr') + T_co = TypeVar('T_co', covariant=True) + self.assertEqual(repr(T_co), '+T_co') + T_contra = TypeVar('T_contra', contravariant=True) + self.assertEqual(repr(T_contra), '-T_contra') def test_no_redefinition(self): self.assertNotEqual(TypeVar('T'), TypeVar('T')) self.assertNotEqual(TypeVar('T', int, str), TypeVar('T', int, str)) def test_subclass_as_unions(self): - self.assertTrue(issubclass(TypeVar('T', int, str), - TypeVar('T', int, str))) - self.assertTrue(issubclass(TypeVar('T', int), TypeVar('T', int, str))) - self.assertTrue(issubclass(TypeVar('T', int, str), - TypeVar('T', str, int))) + # None of these are true -- each type var is its own world. + self.assertFalse(issubclass(TypeVar('T', int, str), + TypeVar('T', int, str))) + self.assertFalse(issubclass(TypeVar('T', int, float), + TypeVar('T', int, float, str))) + self.assertFalse(issubclass(TypeVar('T', int, str), + TypeVar('T', str, int))) A = TypeVar('A', int, str) B = TypeVar('B', int, str, float) - self.assertTrue(issubclass(A, B)) + self.assertFalse(issubclass(A, B)) self.assertFalse(issubclass(B, A)) def test_cannot_subclass_vars(self): @@ -169,53 +195,17 @@ def test_cannot_instantiate_vars(self): with self.assertRaises(TypeError): TypeVar('A')() - def test_bind(self): - self.assertNotIsInstance(42, T) # Baseline. - with T.bind(int): - self.assertIsInstance(42, T) - self.assertNotIsInstance(3.14, T) - self.assertTrue(issubclass(int, T)) - self.assertFalse(issubclass(T, int)) - self.assertFalse(issubclass(float, T)) - self.assertNotIsInstance(42, T) # Baseline restored. - - def test_bind_reuse(self): - self.assertNotIsInstance(42, T) # Baseline. - bv = T.bind(int) - with bv: - self.assertIsInstance(42, T) # Bound. - self.assertNotIsInstance(3.14, T) - self.assertNotIsInstance(42, T) # Baseline restored. - # Reusing bv will work. - with bv: - self.assertIsInstance(42, T) # Bound. - self.assertNotIsInstance(3.14, T) - # Reusing bv recursively won't work. - with self.assertRaises(TypeError): - with bv: - self.assertFalse("Should not get here") - # Rebinding T explicitly will work. - with T.bind(float): - self.assertIsInstance(3.14, T) - self.assertNotIsInstance(42, T) - # Now the previous binding should be restored. - self.assertIsInstance(42, T) - self.assertNotIsInstance(3.14, T) - self.assertNotIsInstance(42, T) # Baseline restored. - - def test_bind_fail(self): - # This essentially tests what happens when __enter__() raises - # an exception. __exit__() won't be called, but the - # VarBinding and the TypeVar are still in consistent states. - bv = T.bind(int) - with mock.patch('typing.TypeVar._bind', side_effect=RuntimeError): - with self.assertRaises(RuntimeError): - with bv: - self.assertFalse("Should not get here") - self.assertNotIsInstance(42, T) - with bv: - self.assertIsInstance(42, T) - self.assertNotIsInstance(42, T) + def test_bound(self): + X = TypeVar('X', bound=Employee) + assert issubclass(Employee, X) + assert issubclass(Manager, X) + assert not issubclass(int, X) + + def test_bound_errors(self): + with self.assertRaises(TypeError): + TypeVar('X', bound=42) + with self.assertRaises(TypeError): + TypeVar('X', str, float, bound=Employee) class UnionTests(TestCase): @@ -327,6 +317,16 @@ def test_empty(self): with self.assertRaises(TypeError): Union[()] + def test_issubclass_union(self): + assert issubclass(Union[int, str], Union) + assert not issubclass(int, Union) + + def test_isinstance_union(self): + # Nothing is an instance of bare Union. + assert not isinstance(42, Union) + assert not isinstance(int, Union) + assert not isinstance(Union[int, str], Union) + class TypeVarUnionTests(TestCase): @@ -335,10 +335,10 @@ def test_simpler(self): B = TypeVar('B', int, str) assert issubclass(A, A) assert issubclass(B, B) - assert issubclass(B, A) + assert not issubclass(B, A) assert issubclass(A, Union[int, str, float]) - assert issubclass(Union[int, str, float], A) - assert issubclass(Union[int, str], B) + assert not issubclass(Union[int, str, float], A) + assert not issubclass(Union[int, str], B) assert issubclass(B, Union[int, str]) assert not issubclass(A, B) assert not issubclass(Union[int, str, float], B) @@ -349,53 +349,13 @@ def test_var_union_subclass(self): self.assertTrue(issubclass(KT, Union[KT, VT])) def test_var_union(self): - TU = TypeVar('TU', Union[int, float]) - self.assertIsInstance(42, TU) - self.assertIsInstance(3.14, TU) - self.assertNotIsInstance('', TU) - with TU.bind(int): - # The effective binding is the union. - self.assertIsInstance(42, TU) - self.assertIsInstance(3.14, TU) - self.assertNotIsInstance('', TU) + TU = TypeVar('TU', Union[int, float], None) + assert issubclass(int, TU) + assert issubclass(float, TU) + with self.assertRaises(TypeError): + isinstance(42, TU) with self.assertRaises(TypeError): - with TU.bind(str): - self.assertFalse("Should not get here") - - def test_var_union_and_more_precise(self): - TU = TypeVar('TU', Union[int, float], int) - with TU.bind(int): - # The binding is ambiguous, but the second alternative - # is strictly more precise. Choose the more precise match. - # The effective binding is int. - self.assertIsInstance(42, TU) - self.assertNotIsInstance(3.14, TU) - self.assertNotIsInstance('', TU) - with TU.bind(float): - # The effective binding is the union. - self.assertIsInstance(42, TU) - self.assertIsInstance(3.14, TU) - self.assertNotIsInstance('', TU) - - def test_var_union_overlapping(self): - TU = TypeVar('TU', Union[int, float], Union[float, str]) - with TU.bind(int): - # The effective binding is the first union. - self.assertIsInstance(42, TU) - self.assertIsInstance(3.14, TU) - self.assertNotIsInstance('', TU) - with TU.bind(float): - # The binding is ambiguous, but neither constraint is a - # subclass of the other. Choose the first match. - # The effective binding is the first union. - self.assertIsInstance(42, TU) - self.assertIsInstance(3.14, TU) - self.assertNotIsInstance('', TU) - with TU.bind(str): - # The effective binding is the second union. - self.assertNotIsInstance(42, TU) - self.assertIsInstance(3.14, TU) - self.assertIsInstance('', TU) + isinstance('', TU) class TupleTests(TestCase): @@ -422,10 +382,33 @@ class MyTuple(tuple): pass self.assertTrue(issubclass(MyTuple, Tuple)) + def test_tuple_ellipsis(self): + t = Tuple[int, ...] + assert isinstance((), t) + assert isinstance((1,), t) + assert isinstance((1, 2), t) + assert isinstance((1, 2, 3), t) + assert not isinstance((3.14,), t) + assert not isinstance((1, 2, 3.14,), t) + + def test_tuple_ellipsis_subclass(self): + + class B: + pass + + class C(B): + pass + + assert not issubclass(Tuple[B], Tuple[B, ...]) + assert issubclass(Tuple[C, ...], Tuple[B, ...]) + assert not issubclass(Tuple[C, ...], Tuple[B]) + assert not issubclass(Tuple[C], Tuple[B, ...]) + def test_repr(self): self.assertEqual(repr(Tuple), 'typing.Tuple') self.assertEqual(repr(Tuple[()]), 'typing.Tuple[]') self.assertEqual(repr(Tuple[int, float]), 'typing.Tuple[int, float]') + self.assertEqual(repr(Tuple[int, ...]), 'typing.Tuple[int, ...]') def test_errors(self): with self.assertRaises(TypeError): @@ -573,7 +556,7 @@ def test_cannot_instantiate(self): with self.assertRaises(TypeError): c() - def test_callable_varargs(self): + def test_varargs(self): ct = Callable[..., int] def foo(a, b) -> int: @@ -589,6 +572,14 @@ def baz(*, x, y, z) -> int: self.assertIsInstance(bar, ct) self.assertIsInstance(baz, ct) + def test_repr(self): + ct0 = Callable[[], bool] + self.assertEqual(repr(ct0), 'typing.Callable[[], bool]') + ct2 = Callable[[str, float], int] + self.assertEqual(repr(ct2), 'typing.Callable[[str, float], int]') + ctv = Callable[..., str] + self.assertEqual(repr(ctv), 'typing.Callable[..., str]') + XK = TypeVar('XK', str, bytes) XV = TypeVar('XV') @@ -634,6 +625,26 @@ def test_supports_float(self): assert issubclass(float, typing.SupportsFloat) assert not issubclass(str, typing.SupportsFloat) + def test_supports_complex(self): + + # Note: complex itself doesn't have __complex__. + class C: + def __complex__(self): + return 0j + + assert issubclass(C, typing.SupportsComplex) + assert not issubclass(str, typing.SupportsComplex) + + def test_supports_bytes(self): + + # Note: bytes itself doesn't have __bytes__. + class B: + def __bytes__(self): + return b'' + + assert issubclass(B, typing.SupportsBytes) + assert not issubclass(str, typing.SupportsBytes) + def test_supports_abs(self): assert issubclass(float, typing.SupportsAbs) assert issubclass(int, typing.SupportsAbs) @@ -653,7 +664,7 @@ class GenericTests(TestCase): def test_basics(self): X = SimpleMapping[str, Any] - Y = SimpleMapping[AnyStr, str] + Y = SimpleMapping[XK, str] X[str, str] Y[str, str] with self.assertRaises(TypeError): @@ -666,13 +677,6 @@ def test_repr(self): __name__ + '.' + 'SimpleMapping[~XK, ~XV]') self.assertEqual(repr(MySimpleMapping), __name__ + '.' + 'MySimpleMapping[~XK, ~XV]') - A = TypeVar('A', str) # Must be a subclass of XK. - B = TypeVar('B') - - class X(SimpleMapping[A, B]): - pass - - self.assertEqual(repr(X).split('.')[-1], 'X[~A, ~B]') def test_errors(self): with self.assertRaises(TypeError): @@ -767,34 +771,71 @@ def append(self, x: int): a.append(42) assert a.get() == [1, 42] + def test_type_erasure(self): + T = TypeVar('T') -class UndefinedTest(TestCase): - - def test_basics(self): - x = Undefined(int) - x = Undefined(Any) - x = Undefined(Union[int, str]) - x = Undefined(None) - - def test_errors(self): - with self.assertRaises(TypeError): - x = Undefined(42) - u = Undefined(int) - with self.assertRaises(TypeError): - {u: 42} - - def test_repr(self): - self.assertEqual(repr(Undefined(Any)), 'typing.Undefined(typing.Any)') - - def test_type_alias(self): - # These simply must not fail. - Undefined(typing.re.Pattern) - Undefined(typing.re.Pattern[str]) - Undefined(typing.re.Pattern[bytes]) - Undefined(typing.re.Pattern[Any]) - - -class CastTest(TestCase): + class Node(Generic[T]): + def __init__(self, label: T, left: 'Node[T]' = None, right: 'Node[T]' = None): + self.label = label # type: T + self.left = left # type: Optional[Node[T]] + self.right = right # type: Optional[Node[T]] + + def foo(x: T): + a = Node(x) + b = Node[T](x) + c = Node[Any](x) + assert type(a) is Node + assert type(b) is Node + assert type(c) is Node + + foo(42) + + +class VarianceTests(TestCase): + + def test_invariance(self): + # Because of invariance, List[subclass of X] is not a subclass + # of List[X], and ditto for MutableSequence. + assert not issubclass(typing.List[Manager], typing.List[Employee]) + assert not issubclass(typing.MutableSequence[Manager], + typing.MutableSequence[Employee]) + # It's still reflexive. + assert issubclass(typing.List[Employee], typing.List[Employee]) + assert issubclass(typing.MutableSequence[Employee], + typing.MutableSequence[Employee]) + + def test_covariance_tuple(self): + # Check covariace for Tuple (which are really special cases). + assert issubclass(Tuple[Manager], Tuple[Employee]) + assert not issubclass(Tuple[Employee], Tuple[Manager]) + # And pairwise. + assert issubclass(Tuple[Manager, Manager], Tuple[Employee, Employee]) + assert not issubclass(Tuple[Employee, Employee], + Tuple[Manager, Employee]) + # And using ellipsis. + assert issubclass(Tuple[Manager, ...], Tuple[Employee, ...]) + assert not issubclass(Tuple[Employee, ...], Tuple[Manager, ...]) + + def test_covariance_sequence(self): + # Check covariance for Sequence (which is just a generic class + # for this purpose, but using a covariant type variable). + assert issubclass(typing.Sequence[Manager], typing.Sequence[Employee]) + assert not issubclass(typing.Sequence[Employee], + typing.Sequence[Manager]) + + def test_covariance_mapping(self): + # Ditto for Mapping (a generic class with two parameters). + assert issubclass(typing.Mapping[Employee, Manager], + typing.Mapping[Employee, Employee]) + assert issubclass(typing.Mapping[Manager, Employee], + typing.Mapping[Employee, Employee]) + assert not issubclass(typing.Mapping[Employee, Manager], + typing.Mapping[Manager, Manager]) + assert not issubclass(typing.Mapping[Manager, Employee], + typing.Mapping[Manager, Manager]) + + +class CastTests(TestCase): def test_basics(self): assert cast(int, 42) == 42 @@ -812,7 +853,7 @@ def test_errors(self): cast('hello', 42) -class ForwardRefTest(TestCase): +class ForwardRefTests(TestCase): def test_basics(self): @@ -837,15 +878,15 @@ def add_right(self, node: 'Node[T]' = None): self.add_both(None, node) t = Node[int] - both_hints = get_type_hints(t.add_both) + both_hints = get_type_hints(t.add_both, globals(), locals()) assert both_hints['left'] == both_hints['right'] == Optional[Node[T]] assert both_hints['stuff'] == Optional[int] assert 'blah' not in both_hints - left_hints = get_type_hints(t.add_left) + left_hints = get_type_hints(t.add_left, globals(), locals()) assert left_hints['node'] == Optional[Node[T]] - right_hints = get_type_hints(t.add_right) + right_hints = get_type_hints(t.add_right, globals(), locals()) assert right_hints['node'] == Optional[Node[T]] def test_union_forward(self): @@ -853,21 +894,24 @@ def test_union_forward(self): def foo(a: Union['T']): pass - self.assertEqual(get_type_hints(foo), {'a': Union[T]}) + self.assertEqual(get_type_hints(foo, globals(), locals()), + {'a': Union[T]}) def test_tuple_forward(self): def foo(a: Tuple['T']): pass - self.assertEqual(get_type_hints(foo), {'a': Tuple[T]}) + self.assertEqual(get_type_hints(foo, globals(), locals()), + {'a': Tuple[T]}) def test_callable_forward(self): def foo(a: Callable[['T'], 'T']): pass - self.assertEqual(get_type_hints(foo), {'a': Callable[[T], T]}) + self.assertEqual(get_type_hints(foo, globals(), locals()), + {'a': Callable[[T], T]}) def test_syntax_error(self): @@ -882,13 +926,21 @@ def foo(a: 'Node[T'): with self.assertRaises(SyntaxError): get_type_hints(foo) + def test_type_error(self): + + def foo(a: Tuple['42']): + pass + + with self.assertRaises(TypeError): + get_type_hints(foo) + def test_name_error(self): def foo(a: 'Noode[T]'): pass with self.assertRaises(NameError): - get_type_hints(foo) + get_type_hints(foo, locals()) def test_no_type_check(self): @@ -899,6 +951,18 @@ def foo(a: 'whatevers') -> {}: th = get_type_hints(foo) self.assertEqual(th, {}) + def test_no_type_check_class(self): + + @no_type_check + class C: + def foo(a: 'whatevers') -> {}: + pass + + cth = get_type_hints(C.foo) + self.assertEqual(cth, {}) + ith = get_type_hints(C().foo) + self.assertEqual(ith, {}) + def test_meta_no_type_check(self): @no_type_check_decorator @@ -911,9 +975,29 @@ def magic_decorator(deco): def foo(a: 'whatevers') -> {}: pass + @magic_decorator + class C: + def foo(a: 'whatevers') -> {}: + pass + self.assertEqual(foo.__name__, 'foo') th = get_type_hints(foo) self.assertEqual(th, {}) + cth = get_type_hints(C.foo) + self.assertEqual(cth, {}) + ith = get_type_hints(C().foo) + self.assertEqual(ith, {}) + + def test_default_globals(self): + code = ("class C:\n" + " def foo(self, a: 'C') -> 'D': pass\n" + "class D:\n" + " def bar(self, b: 'D') -> C: pass\n" + ) + ns = {} + exec(code, ns) + hints = get_type_hints(ns['C'].foo) + assert hints == {'a': ns['C'], 'return': ns['D']} class OverloadTests(TestCase): @@ -994,6 +1078,7 @@ def test_list(self): def test_set(self): assert issubclass(set, typing.Set) + assert not issubclass(frozenset, typing.Set) assert isinstance(set(), typing.Set) assert not isinstance({}, typing.Set) t = typing.Set[int] @@ -1001,6 +1086,17 @@ def test_set(self): assert isinstance({42}, t) assert not isinstance({''}, t) + def test_frozenset(self): + assert issubclass(frozenset, typing.FrozenSet) + assert not issubclass(set, typing.FrozenSet) + assert isinstance(frozenset(), typing.FrozenSet) + assert not isinstance({}, typing.FrozenSet) + t = typing.FrozenSet[int] + assert isinstance(frozenset(), t) + assert isinstance(frozenset({42}), t) + assert not isinstance(frozenset({''}), t) + assert not isinstance({42}, t) + def test_mapping_views(self): # TODO: These tests are kind of lame. assert isinstance({}.keys(), typing.KeysView) @@ -1018,6 +1114,126 @@ def test_dict(self): assert not isinstance({'': 42}, t) assert not isinstance({'': ''}, t) + def test_no_list_instantiation(self): + with self.assertRaises(TypeError): + typing.List() + with self.assertRaises(TypeError): + typing.List[T]() + with self.assertRaises(TypeError): + typing.List[int]() + + def test_list_subclass_instantiation(self): + + class MyList(typing.List[int]): + pass + + a = MyList() + assert isinstance(a, MyList) + + def test_no_dict_instantiation(self): + with self.assertRaises(TypeError): + typing.Dict() + with self.assertRaises(TypeError): + typing.Dict[KT, VT]() + with self.assertRaises(TypeError): + typing.Dict[str, int]() + + def test_dict_subclass_instantiation(self): + + class MyDict(typing.Dict[str, int]): + pass + + d = MyDict() + assert isinstance(d, MyDict) + + def test_no_set_instantiation(self): + with self.assertRaises(TypeError): + typing.Set() + with self.assertRaises(TypeError): + typing.Set[T]() + with self.assertRaises(TypeError): + typing.Set[int]() + + def test_set_subclass_instantiation(self): + + class MySet(typing.Set[int]): + pass + + d = MySet() + assert isinstance(d, MySet) + + def test_no_frozenset_instantiation(self): + with self.assertRaises(TypeError): + typing.FrozenSet() + with self.assertRaises(TypeError): + typing.FrozenSet[T]() + with self.assertRaises(TypeError): + typing.FrozenSet[int]() + + def test_frozenset_subclass_instantiation(self): + + class MyFrozenSet(typing.FrozenSet[int]): + pass + + d = MyFrozenSet() + assert isinstance(d, MyFrozenSet) + + def test_no_tuple_instantiation(self): + with self.assertRaises(TypeError): + Tuple() + with self.assertRaises(TypeError): + Tuple[T]() + with self.assertRaises(TypeError): + Tuple[int]() + + def test_generator(self): + def foo(): + yield 42 + g = foo() + assert issubclass(type(g), typing.Generator) + assert isinstance(g, typing.Generator) + assert not isinstance(foo, typing.Generator) + assert issubclass(typing.Generator[Manager, Employee, Manager], + typing.Generator[Employee, Manager, Employee]) + assert not issubclass(typing.Generator[Manager, Manager, Manager], + typing.Generator[Employee, Employee, Employee]) + + def test_no_generator_instantiation(self): + with self.assertRaises(TypeError): + typing.Generator() + with self.assertRaises(TypeError): + typing.Generator[T, T, T]() + with self.assertRaises(TypeError): + typing.Generator[int, int, int]() + + def test_subclassing(self): + + class MMA(typing.MutableMapping): + pass + + with self.assertRaises(TypeError): # It's abstract + MMA() + + class MMC(MMA): + def __len__(self): + return 0 + + assert len(MMC()) == 0 + + class MMB(typing.MutableMapping[KT, VT]): + def __len__(self): + return 0 + + assert len(MMB()) == 0 + assert len(MMB[str, str]()) == 0 + assert len(MMB[KT, VT]()) == 0 + + def test_recursive_dict(self): + D = typing.Dict[int, 'D'] # Uses a _ForwardRef + assert isinstance({}, D) # Easy + assert isinstance({0: {}}, D) # Touches _ForwardRef + assert isinstance({0: {0: {}}}, D) # Etc... + class NamedTupleTests(TestCase): @@ -1077,16 +1293,16 @@ class RETests(TestCase): def test_basics(self): pat = re.compile('[a-z]+', re.I) - assert isinstance(pat, Pattern) + assert issubclass(pat.__class__, Pattern) assert isinstance(pat, Pattern[str]) assert not isinstance(pat, Pattern[bytes]) assert issubclass(type(pat), Pattern) assert issubclass(type(pat), Pattern[str]) mat = pat.search('12345abcde.....') - assert isinstance(mat, Match) - assert isinstance(mat, Match[str]) - assert not isinstance(mat, Match[bytes]) + assert issubclass(mat.__class__, Match) + assert issubclass(mat.__class__, Match[str]) + assert issubclass(mat.__class__, Match[bytes]) # Sad but true. assert issubclass(type(mat), Match) assert issubclass(type(mat), Match[str]) @@ -1127,17 +1343,23 @@ def test_re_submodule(self): assert set(__all__) == set(['Match', 'Pattern']) assert __name__ == 'typing.re' + def test_cannot_subclass(self): + with self.assertRaises(TypeError) as ex: + + class A(typing.Match): + pass + + assert str(ex.exception) == "A type alias cannot be subclassed" + class AllTests(TestCase): """Tests for __all__.""" def test_all(self): from typing import __all__ as a - # Don't test everything, just spot-check the first and last of every category. + # Just spot-check the first and last of every category. assert 'AbstractSet' in a assert 'ValuesView' in a - assert 'POSIX' in a - assert 'WINDOWS' in a assert 'cast' in a assert 'overload' in a assert 'io' in a diff --git a/lib-typing/3.2/typing.py b/lib-typing/3.2/typing.py index d1ba5b542967..38e07ad50b75 100644 --- a/lib-typing/3.2/typing.py +++ b/lib-typing/3.2/typing.py @@ -1,5 +1,6 @@ # TODO: -# Support Python 3.2 +# - Generic[T, T] is invalid +# - Look for TODO below # TODO nits: # Get rid of asserts that are the caller's fault. @@ -9,7 +10,6 @@ from abc import abstractmethod, abstractproperty import collections import functools -import inspect import re as stdlib_re # Avoid confusion with the re we export. import sys import types @@ -21,63 +21,59 @@ # Please keep __all__ alphabetized within each category. __all__ = [ - # Generic classes and special types. - 'AbstractSet', + # Super-special typing primitives. 'Any', - 'AnyStr', - 'ByteString', 'Callable', - 'Container', - 'Dict', 'Generic', + 'Optional', + 'TypeVar', + 'Union', + 'Tuple', + + # ABCs (from collections.abc). + 'AbstractSet', # collections.abc.Set. + 'ByteString', + 'Container', 'Hashable', 'ItemsView', 'Iterable', 'Iterator', 'KeysView', - 'List', 'Mapping', 'MappingView', 'MutableMapping', 'MutableSequence', 'MutableSet', - 'NamedTuple', - 'Optional', - 'Reversible', 'Sequence', - 'Set', 'Sized', + 'ValuesView', + + # Structural checks, a.k.a. protocols. + 'Reversible', 'SupportsAbs', 'SupportsFloat', 'SupportsInt', 'SupportsRound', - 'Tuple', - 'TypeVar', - 'Undefined', - 'Union', - 'ValuesView', - # Compile-time constants. - 'POSIX', - 'PY2', - 'PY3', - 'WINDOWS', - # Functions and decorators. + + # Concrete collection types. + 'Dict', + 'List', + 'Set', + 'NamedTuple', # Not really a type. + 'Generator', + + # One-off things. + 'AnyStr', 'cast', 'get_type_hints', 'no_type_check', 'no_type_check_decorator', 'overload', + # Submodules. 'io', 're', - ] - - -# Simple constants defined in the PEP. -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] >= 3 -WINDOWS = sys.platform == 'win32' -POSIX = not WINDOWS +] def _qualname(x): @@ -152,6 +148,12 @@ def __new__(cls, arg): self.__forward_code__ = code self.__forward_evaluated__ = False self.__forward_value__ = None + typing_globals = globals() + frame = sys._getframe(1) + while frame is not None and frame.f_globals is typing_globals: + frame = frame.f_back + assert frame is not None + self.__forward_frame__ = frame return self def _eval_type(self, globalns, localns): @@ -162,11 +164,38 @@ def _eval_type(self, globalns, localns): raise TypeError('ForwardRef globalns must be a dict -- got %r' % (globalns,)) if not self.__forward_evaluated__: - self.__forward_value__ = eval(self.__forward_code__, - globalns, localns) + if globalns is None and localns is None: + globalns = localns = {} + elif globalns is None: + globalns = localns + elif localns is None: + localns = globalns + self.__forward_value__ = _type_check( + eval(self.__forward_code__, globalns, localns), + "Forward references must evaluate to types.") self.__forward_evaluated__ = True return self.__forward_value__ + def __subclasscheck__(self, cls): + if not self.__forward_evaluated__: + globalns = self.__forward_frame__.f_globals + localns = self.__forward_frame__.f_locals + try: + self._eval_type(globalns, localns) + except NameError: + return False # Too early. + return issubclass(cls, self.__forward_value__) + + def __instancecheck__(self, obj): + if not self.__forward_evaluated__: + globalns = self.__forward_frame__.f_globals + localns = self.__forward_frame__.f_locals + try: + self._eval_type(globalns, localns) + except NameError: + return False # Too early. + return isinstance(obj, self.__forward_value__) + def __repr__(self): return '_ForwardRef(%r)' % (self.__forward_arg__,) @@ -182,9 +211,22 @@ class _TypeAlias: False. """ - def __init__(self, name, type_var, impl_type, type_checker): + def __new__(cls, *args, **kwds): """Constructor. + This only exists to give a better error message in case + someone tries to subclass a type alias (not a good idea). + """ + if (len(args) == 3 and + isinstance(args[0], str) and + isinstance(args[1], tuple)): + # Close enough. + raise TypeError("A type alias cannot be subclassed") + return object.__new__(cls) + + def __init__(self, name, type_var, impl_type, type_checker): + """Initializer. + Args: name: The name, e.g. 'Pattern'. type_var: The type parameter, e.g. AnyStr, or the @@ -209,9 +251,10 @@ def __getitem__(self, parameter): assert isinstance(parameter, type), repr(parameter) if not isinstance(self.type_var, TypeVar): raise TypeError("%s cannot be further parameterized." % self) - if not issubclass(parameter, self.type_var): - raise TypeError("%s is not a valid substitution for %s." % - (parameter, self.type_var)) + if self.type_var.__constraints__: + if not issubclass(parameter, Union[self.type_var.__constraints__]): + raise TypeError("%s is not a valid substitution for %s." % + (parameter, self.type_var)) return self.__class__(self.name, parameter, self.impl_type, self.type_checker) @@ -312,172 +355,101 @@ class TypeVar(TypingMeta, metaclass=TypingMeta, _root=True): Usage:: - T1 = TypeVar('T1') # Unconstrained - T2 = TypeVar('T2', t1, t2, ...) # Constrained to any of (t1, t2, ...) + T = TypeVar('T') # Can be anything + A = TypeVar('A', str, bytes) # Must be str or bytes - For an unconstrained type variable T, isinstance(x, T) is false - for all x, and similar for issubclass(cls, T). Example:: + Type variables exist primarily for the benefit of static type + checkers. They serve as the parameters for generic types as well + as for generic function definitions. See class Generic for more + information on generic types. Generic functions work as follows: - T = TypeVar('T') - assert not isinstance(42, T) - assert not issubclass(int, T) + def repeat(x: T, n: int) -> Sequence[T]: + '''Return a list containing n references to x.''' + return [x]*n - For a constrained type variable T, isinstance(x, T) is true for - any x that is an instance of at least one of T's constraints, - and similar for issubclass(cls, T). Example:: + def longest(x: A, y: A) -> A: + '''Return the longest of two strings.''' + return x if len(x) >= len(y) else y - AnyStr = TypeVar('AnyStr', str, bytes) - # AnyStr behaves similar to Union[str, bytes] (but not exactly!) - assert not isinstance(42, AnyStr) - assert isinstance('', AnyStr) - assert isinstance(b'', AnyStr) - assert not issubclass(int, AnyStr) - assert issubclass(str, AnyStr) - assert issubclass(bytes, AnyStr) + The latter example's signature is essentially the overloading + of (str, str) -> str and (bytes, bytes) -> bytes. Also note + that if the arguments are instances of some subclass of str, + the return type is still plain str. - Type variables that are distinct objects are never equal (even if - created with the same parameters). + At runtime, isinstance(x, T) will raise TypeError. However, + issubclass(C, T) is true for any class C, and issubclass(str, A) + and issubclass(bytes, A) are true, and issubclass(int, A) is + false. - You can temporarily *bind* a type variable to a specific type by - calling its bind() method and using the result as a context - manager (i.e., in a with-statement). Example:: + Type variables may be marked covariant or contravariant by passing + covariant=True or contravariant=True. See PEP 484 for more + details. By default type variables are invariant. - with T.bind(int): - # In this block, T is nearly an alias for int. - assert isinstance(42, T) - assert issubclass(int, T) - - There is still a difference between T and int; issubclass(T, int) - is False. However, issubclass(int, T) is true. - - Binding a constrained type variable will replace the binding type - with the most derived of its constraints that matches. Example:: - - class MyStr(str): - pass - - with AnyStr.bind(MyStr): - # In this block, AnyStr is an alias for str, not for MyStr. - assert isinstance('', AnyStr) - assert issubclass(str, AnyStr) - assert not isinstance(b'', AnyStr) - assert not issubclass(bytes, AnyStr) + Type variables can be introspected. e.g.: + T.__name__ == 'T' + T.__constraints__ == () + T.__covariant__ == False + T.__contravariant__ = False + A.__constraints__ == (str, bytes) """ - def __new__(cls, name, *constraints): + def __new__(cls, name, *constraints, bound=None, + covariant=False, contravariant=False): self = super().__new__(cls, name, (Final,), {}, _root=True) + if covariant and contravariant: + raise ValueError("Bivariant type variables are not supported.") + self.__covariant__ = bool(covariant) + self.__contravariant__ = bool(contravariant) + if constraints and bound is not None: + raise TypeError("Constraints cannot be combined with bound=...") + if constraints and len(constraints) == 1: + raise TypeError("A single constraint is not allowed") msg = "TypeVar(name, constraint, ...): constraints must be types." self.__constraints__ = tuple(_type_check(t, msg) for t in constraints) - self.__binding__ = None + if bound: + self.__bound__ = _type_check(bound, "Bound must be a type.") + else: + self.__bound__ = None return self def _has_type_var(self): return True def __repr__(self): - return '~' + self.__name__ + if self.__covariant__: + prefix = '+' + elif self.__contravariant__: + prefix = '-' + else: + prefix = '~' + return prefix + self.__name__ def __instancecheck__(self, instance): - if self.__binding__ is not None: - return isinstance(instance, self.__binding__) - elif not self.__constraints__: - return False - else: - return isinstance(instance, Union[self.__constraints__]) + raise TypeError("Type variables cannot be used with isinstance().") def __subclasscheck__(self, cls): - if cls is Any: - return True + # TODO: Make this raise TypeError too? if cls is self: return True - elif self.__binding__ is not None: - return issubclass(cls, self.__binding__) - elif not self.__constraints__: - return False - else: - return issubclass(cls, Union[self.__constraints__]) - - def bind(self, binding): - binding = _type_check(binding, "TypeVar.bind(t): t must be a type.") + if cls is Any: + return True + if self.__bound__ is not None: + return issubclass(cls, self.__bound__) if self.__constraints__: - best = None - for t in self.__constraints__: - if (issubclass(binding, t) and - (best is None or issubclass(t, best))): - best = t - if best is None: - raise TypeError( - "TypeVar.bind(t): t must match one of the constraints.") - binding = best - return VarBinding(self, binding) - - def _bind(self, binding): - old_binding = self.__binding__ - self.__binding__ = binding - return old_binding - - def _unbind(self, binding, old_binding): - assert self.__binding__ is binding, (self.__binding__, - binding, old_binding) - self.__binding__ = old_binding - - -# Compatibility for for mypy's typevar(). -def typevar(name, values=()): - return TypeVar(name, *values) - - -class VarBinding: - """TypeVariable binding returned by TypeVar.bind().""" - - # TODO: This is not thread-safe. We could solve this in one of - # two ways: by using a lock or by using thread-local state. But - # either of these feels overly heavy, and still doesn't work - # e.g. in an asyncio Task. - - def __init__(self, var, binding): - assert isinstance(var, TypeVar), (var, binding) - assert isinstance(binding, type), (var, binding) - self._var = var - self._binding = binding - self._old_binding = None - self._entered = False - - def __enter__(self): - if self._entered: - # This checks for the following scenario: - # bv = T.bind() - # with bv: - # with bv: # Will raise here. - # ... - # However, the following scenario is OK (if somewhat odd): - # bv = T.bind() - # with bv: - # ... - # with bv: - # ... - # The following scenario is also fine: - # with T.bind(): - # with T.bind(): - # ... - raise TypeError("Cannot reuse variable binding recursively.") - self._old_binding = self._var._bind(self._binding) - self._entered = True - - def __exit__(self, *args): - try: - self._var._unbind(self._binding, self._old_binding) - finally: - self._entered = False - self._old_binding = None + return any(issubclass(cls, c) for c in self.__constraints__) + return True # Some unconstrained type variables. These are used by the container types. -# TODO: Don't export these. T = TypeVar('T') # Any type. KT = TypeVar('KT') # Key type. VT = TypeVar('VT') # Value type. +T_co = TypeVar('T_co', covariant=True) # Any type covariant containers. +V_co = TypeVar('V_co', covariant=True) # Any type covariant containers. +KT_co = TypeVar('KT_co', covariant=True) # Key type covariant containers. +VT_co = TypeVar('VT_co', covariant=True) # Value type covariant containers. +T_contra = TypeVar('T_contra', contravariant=True) # Ditto contravariant. # A useful type variable with constraints. This represents string types. # TODO: What about bytearray, memoryview? @@ -514,11 +486,16 @@ def __new__(cls, name, bases, namespace, parameters=None, _root=False): # E.g. Union[int, Employee, Manager] == Union[int, Employee]. # If Any or object is present it will be the sole survivor. # If both Any and object are present, Any wins. + # Never discard type variables, except against Any. + # (In particular, Union[str, AnyStr] != AnyStr.) all_params = set(params) for t1 in params: if t1 is Any: return Any - if any(issubclass(t1, t2) for t2 in all_params - {t1}): + if isinstance(t1, TypeVar): + continue + if any(issubclass(t1, t2) + for t2 in all_params - {t1} if not isinstance(t2, TypeVar)): all_params.remove(t1) # It's not a union if there's only one type left. if len(all_params) == 1: @@ -572,7 +549,8 @@ def __hash__(self): return hash(self.__union_set_params__) def __instancecheck__(self, instance): - return any(isinstance(instance, t) for t in self.__union_params__) + return (self.__union_set_params__ is not None and + any(isinstance(instance, t) for t in self.__union_params__)) def __subclasscheck__(self, cls): if cls is Any: @@ -609,7 +587,7 @@ class Union(Final, metaclass=UnionMeta, _root=True): - Unions of a single argument vanish, e.g.:: - Union[int] == int # The constructore actually returns int + Union[int] == int # The constructor actually returns int - Redundant arguments are skipped, e.g.:: @@ -671,9 +649,11 @@ class Optional(Final, metaclass=OptionalMeta, _root=True): class TupleMeta(TypingMeta): """Metaclass for Tuple.""" - def __new__(cls, name, bases, namespace, parameters=None, _root=False): + def __new__(cls, name, bases, namespace, parameters=None, + use_ellipsis=False, _root=False): self = super().__new__(cls, name, bases, namespace, _root=_root) self.__tuple_params__ = parameters + self.__tuple_use_ellipsis__ = use_ellipsis return self def _has_type_var(self): @@ -697,8 +677,11 @@ def _eval_type(self, globalns, localns): def __repr__(self): r = super().__repr__() if self.__tuple_params__ is not None: + params = [_type_repr(p) for p in self.__tuple_params__] + if self.__tuple_use_ellipsis__: + params.append('...') r += '[%s]' % ( - ', '.join(_type_repr(p) for p in self.__tuple_params__)) + ', '.join(params)) return r def __getitem__(self, parameters): @@ -706,10 +689,17 @@ def __getitem__(self, parameters): raise TypeError("Cannot re-parameterize %r" % (self,)) if not isinstance(parameters, tuple): parameters = (parameters,) - msg = "Class[arg, ...]: each arg must be a type." + if len(parameters) == 2 and parameters[1] == Ellipsis: + parameters = parameters[:1] + use_ellipsis = True + msg = "Tuple[t, ...]: t must be a type." + else: + use_ellipsis = False + msg = "Tuple[t0, t1, ...]: each t must be a type." parameters = tuple(_type_check(p, msg) for p in parameters) return self.__class__(self.__name__, self.__bases__, - dict(self.__dict__), parameters, _root=True) + dict(self.__dict__), parameters, + use_ellipsis=use_ellipsis, _root=True) def __eq__(self, other): if not isinstance(other, TupleMeta): @@ -724,9 +714,13 @@ def __instancecheck__(self, t): return False if self.__tuple_params__ is None: return True - return (len(t) == len(self.__tuple_params__) and - all(isinstance(x, p) - for x, p in zip(t, self.__tuple_params__))) + if self.__tuple_use_ellipsis__: + p = self.__tuple_params__[0] + return all(isinstance(x, p) for x in t) + else: + return (len(t) == len(self.__tuple_params__) and + all(isinstance(x, p) + for x, p in zip(t, self.__tuple_params__))) def __subclasscheck__(self, cls): if cls is Any: @@ -741,6 +735,8 @@ def __subclasscheck__(self, cls): return True if cls.__tuple_params__ is None: return False # ??? + if cls.__tuple_use_ellipsis__ != self.__tuple_use_ellipsis__: + return False # Covariance. return (len(self.__tuple_params__) == len(cls.__tuple_params__) and all(issubclass(x, p) @@ -802,10 +798,12 @@ def _eval_type(self, globalns, localns): def __repr__(self): r = super().__repr__() if self.__args__ is not None or self.__result__ is not None: - r += '%s[[%s], %s]' % (_qualname(self), - ', '.join(_type_repr(t) - for t in self.__args__), - _type_repr(self.__result__)) + if self.__args__ is Ellipsis: + args_r = '...' + else: + args_r = '[%s]' % ', '.join(_type_repr(t) + for t in self.__args__) + r += '[%s, %s]' % (args_r, _type_repr(self.__result__)) return r def __getitem__(self, parameters): @@ -836,6 +834,7 @@ def __instancecheck__(self, instance): assert self.__args__ is not None assert self.__result__ is not None my_args, my_result = self.__args__, self.__result__ + import inspect # TODO: Avoid this import. # Would it be better to use Signature objects? try: (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, @@ -902,15 +901,44 @@ class Callable(Final, metaclass=CallableMeta, _root=True): """ +def _gorg(a): + """Return the farthest origin of a generic class.""" + assert isinstance(a, GenericMeta) + while a.__origin__ is not None: + a = a.__origin__ + return a + + +def _geqv(a, b): + """Return whether two generic classes are equivalent. + + The intention is to consider generic class X and any of its + parameterized forms (X[T], X[int], etc.) as equivalent. + + However, X is not equivalent to a subclass of X. + + The relation is reflexive, symmetric and transitive. + """ + assert isinstance(a, GenericMeta) and isinstance(b, GenericMeta) + # Reduce each to its origin. + return _gorg(a) is _gorg(b) + + class GenericMeta(TypingMeta, abc.ABCMeta): """Metaclass for generic types.""" # TODO: Constrain more how Generic is used; only a few # standard patterns should be allowed. + # TODO: Use a more precise rule than matching __name__ to decide + # whether two classes are the same. Also, save the formal + # parameters. (These things are related! A solution lies in + # using origin.) + __extra__ = None - def __new__(cls, name, bases, namespace, parameters=None, extra=None): + def __new__(cls, name, bases, namespace, + parameters=None, origin=None, extra=None): if parameters is None: # Extract parameters from direct base classes. Only # direct bases are considered and only those that are @@ -944,6 +972,7 @@ def __new__(cls, name, bases, namespace, parameters=None, extra=None): self.__extra__ = extra # Else __extra__ is inherited, eventually from the # (meta-)class default above. + self.__origin__ = origin return self def _has_type_var(self): @@ -963,7 +992,7 @@ def __repr__(self): def __eq__(self, other): if not isinstance(other, GenericMeta): return NotImplemented - return (self.__name__ == other.__name__ and + return (_geqv(self, other) and self.__parameters__ == other.__parameters__) def __hash__(self): @@ -986,9 +1015,13 @@ def __getitem__(self, params): raise TypeError("Cannot change parameter count from %d to %d" % (len(self.__parameters__), len(params))) for new, old in zip(params, self.__parameters__): - if isinstance(old, TypeVar) and not old.__constraints__: - # Substituting for an unconstrained TypeVar is always OK. - continue + if isinstance(old, TypeVar): + if not old.__constraints__: + # Substituting for an unconstrained TypeVar is OK. + continue + if issubclass(new, Union[old.__constraints__]): + # Specializing a constrained type variable is OK. + continue if not issubclass(new, old): raise TypeError( "Cannot substitute %s for %s in %s" % @@ -996,14 +1029,47 @@ def __getitem__(self, params): return self.__class__(self.__name__, self.__bases__, dict(self.__dict__), - parameters=params, extra=self.__extra__) + parameters=params, + origin=self, + extra=self.__extra__) def __subclasscheck__(self, cls): if cls is Any: return True + if isinstance(cls, GenericMeta): + # For a class C(Generic[T]) where T is co-variant, + # C[X] is a subclass of C[Y] iff X is a subclass of Y. + origin = self.__origin__ + if origin is not None and origin is cls.__origin__: + assert len(self.__parameters__) == len(origin.__parameters__) + assert len(cls.__parameters__) == len(origin.__parameters__) + for p_self, p_cls, p_origin in zip(self.__parameters__, + cls.__parameters__, + origin.__parameters__): + if isinstance(p_origin, TypeVar): + if p_origin.__covariant__: + # Covariant -- p_cls must be a subclass of p_self. + if not issubclass(p_cls, p_self): + break + elif p_origin.__contravariant__: + # Contravariant. I think it's the opposite. :-) + if not issubclass(p_self, p_cls): + break + else: + # Invariant -- p_cls and p_self must equal. + if p_self != p_cls: + break + else: + # If the origin's parameter is not a typevar, + # insist on invariance. + if p_self != p_cls: + break + else: + return True + # If we break out of the loop, the superclass gets a chance. if super().__subclasscheck__(cls): return True - if self.__extra__ is None: + if self.__extra__ is None or isinstance(cls, GenericMeta): return False return issubclass(cls, self.__extra__) @@ -1043,47 +1109,13 @@ def lookup_name(mapping: Mapping[X, Y], key: X, default: Y) -> Y: # Same body as above. """ - -class Undefined: - """An undefined value. - - Example:: - - x = Undefined(typ) - - This tells the type checker that x has the given type but its - value should be considered undefined. At runtime x is an instance - of Undefined. The actual type can be introspected by looking at - x.__type__ and its str() and repr() are defined, but any other - operations or attributes will raise an exception. - - An alternative syntax is also supported: - - x = Undefined # type: typ - - This has the same meaning to the static type checker but uses less - overhead at run-time, at the cost of not being introspectible. - - NOTE: Do not under any circumstances check for Undefined. We - don't want this to become something developers rely upon, like - JavaScript's undefined. Code that returns or uses an Undefined - value in any way should be considered broken. Static type - checkers should warn about using potentially Undefined values. - """ - - __slots__ = ['__type__'] - - def __new__(cls, typ): - typ = _type_check(typ, "Undefined(t): t must be a type.") - self = super().__new__(cls) - self.__type__ = typ - return self - - __hash__ = None - - def __repr__(self): - return '%s(%s)' % (_type_repr(self.__class__), - _type_repr(self.__type__)) + def __new__(cls, *args, **kwds): + next_in_mro = object + # Look for the last occurrence of Generic or Generic[...]. + for i, c in enumerate(cls.__mro__[:-1]): + if isinstance(c, GenericMeta) and _gorg(c) is Generic: + next_in_mro = cls.__mro__[i+1] + return next_in_mro.__new__(_gorg(cls)) def cast(typ, val): @@ -1103,7 +1135,7 @@ def _get_defaults(func): pos_count = code.co_argcount kw_count = code.co_kwonlyargcount arg_names = code.co_varnames - kwarg_names = arg_names[pos_count:pos_count+kw_count] + kwarg_names = arg_names[pos_count:pos_count + kw_count] arg_names = arg_names[:pos_count] defaults = func.__defaults__ or () kwdefaults = func.__kwdefaults__ @@ -1126,8 +1158,9 @@ def get_type_hints(obj, globalns=None, localns=None): (unless you are familiar with how eval() and exec() work). The search order is locals first, then globals. - - If no dict arguments are passed, the defaults are taken from the - globals and locals of the caller, respectively. + - If no dict arguments are passed, an attempt is made to use the + globals from obj, and these are also used as the locals. If the + object does not appear to have globals, an exception is raised. - If one dict argument is passed, it is used for both globals and locals. @@ -1138,9 +1171,9 @@ def get_type_hints(obj, globalns=None, localns=None): if getattr(obj, '__no_type_check__', None): return {} if globalns is None: - globalns = sys._getframe(1).f_globals + globalns = getattr(obj, '__globals__', {}) if localns is None: - localns = sys._getframe(1).f_locals + localns = globalns elif localns is None: localns = globalns defaults = _get_defaults(obj) @@ -1156,13 +1189,22 @@ def get_type_hints(obj, globalns=None, localns=None): # TODO: Also support this as a class decorator. -def no_type_check(func): +def no_type_check(arg): """Decorator to indicate that annotations are not type hints. - This mutates the function in place. + The argument must be a class or function; if it is a class, it + applies recursively to all methods defined in that class (but not + to methods defined in its superclasses or subclasses). + + This mutates the function(s) in place. """ - func.__no_type_check__ = True - return func + if isinstance(arg, type): + for obj in arg.__dict__.values(): + if isinstance(obj, types.FunctionType): + obj.__no_type_check__ = True + else: + arg.__no_type_check__ = True + return arg def no_type_check_decorator(decorator): @@ -1185,18 +1227,14 @@ def overload(func): raise RuntimeError("Overloading is only supported in library stubs") -class _Protocol(Generic): - """Internal base class for protocol classes. +class _ProtocolMeta(GenericMeta): + """Internal metaclass for _Protocol. - This implements a simple-minded structural isinstance check - (similar but more general than the one-offs in collections.abc - such as Hashable). + This exists so _Protocol classes can be generic without deriving + from Generic. """ - _is_protocol = True - - @classmethod - def __subclasshook__(self, cls): + def __subclasscheck__(self, cls): if not self._is_protocol: # No structural checks since this isn't a protocol. return NotImplemented @@ -1210,10 +1248,9 @@ def __subclasshook__(self, cls): for attr in attrs: if not any(attr in d.__dict__ for d in cls.__mro__): - return NotImplemented + return False return True - @classmethod def _get_protocol_attrs(self): # Get all Protocol base classes. protocol_bases = [] @@ -1236,23 +1273,36 @@ def _get_protocol_attrs(self): attr != '_is_protocol' and attr != '__dict__' and attr != '_get_protocol_attrs' and + attr != '__parameters__' and + attr != '__origin__' and attr != '__module__'): attrs.add(attr) return attrs +class _Protocol(metaclass=_ProtocolMeta): + """Internal base class for protocol classes. + + This implements a simple-minded structural isinstance check + (similar but more general than the one-offs in collections.abc + such as Hashable). + """ + + _is_protocol = True + + # Various ABCs mimicking those in collections.abc. # A few are simply re-exported for completeness. Hashable = collections_abc.Hashable # Not generic. -class Iterable(Generic[T], extra=collections_abc.Iterable): +class Iterable(Generic[T_co], extra=collections_abc.Iterable): pass -class Iterator(Iterable, extra=collections_abc.Iterator): +class Iterator(Iterable[T_co], extra=collections_abc.Iterator): pass @@ -1270,6 +1320,20 @@ def __float__(self) -> float: pass +class SupportsComplex(_Protocol): + + @abstractmethod + def __complex__(self) -> complex: + pass + + +class SupportsBytes(_Protocol): + + @abstractmethod + def __bytes__(self) -> bytes: + pass + + class SupportsAbs(_Protocol[T]): @abstractmethod @@ -1294,35 +1358,37 @@ def __reversed__(self) -> 'Iterator[T]': Sized = collections_abc.Sized # Not generic. -class Container(Generic[T], extra=collections_abc.Container): +class Container(Generic[T_co], extra=collections_abc.Container): pass # Callable was defined earlier. -class AbstractSet(Sized, Iterable, Container, extra=collections_abc.Set): +class AbstractSet(Sized, Iterable[T_co], Container[T_co], + extra=collections_abc.Set): pass -class MutableSet(AbstractSet, extra=collections_abc.MutableSet): +class MutableSet(AbstractSet[T], extra=collections_abc.MutableSet): pass -class Mapping(Sized, Iterable[KT], Container[KT], Generic[KT, VT], +class Mapping(Sized, Iterable[KT_co], Container[KT_co], Generic[KT_co, VT_co], extra=collections_abc.Mapping): pass -class MutableMapping(Mapping, extra=collections_abc.MutableMapping): +class MutableMapping(Mapping[KT, VT], extra=collections_abc.MutableMapping): pass -class Sequence(Sized, Iterable, Container, extra=collections_abc.Sequence): +class Sequence(Sized, Iterable[T_co], Container[T_co], + extra=collections_abc.Sequence): pass -class MutableSequence(Sequence, extra=collections_abc.MutableSequence): +class MutableSequence(Sequence[T], extra=collections_abc.MutableSequence): pass @@ -1345,8 +1411,13 @@ def __instancecheck__(self, obj): return True -class List(list, MutableSequence, metaclass=_ListMeta): - pass +class List(list, MutableSequence[T], metaclass=_ListMeta): + + def __new__(cls, *args, **kwds): + if _geqv(cls, List): + raise TypeError("Type List cannot be instantiated; " + "use list() instead") + return list.__new__(cls, *args, **kwds) class _SetMeta(GenericMeta): @@ -1361,24 +1432,59 @@ def __instancecheck__(self, obj): return True -class Set(set, MutableSet, metaclass=_SetMeta): - pass +class Set(set, MutableSet[T], metaclass=_SetMeta): + + def __new__(cls, *args, **kwds): + if _geqv(cls, Set): + raise TypeError("Type Set cannot be instantiated; " + "use set() instead") + return set.__new__(cls, *args, **kwds) + + +class _FrozenSetMeta(_SetMeta): + """This metaclass ensures set is not a subclass of FrozenSet. + Without this metaclass, set would be considered a subclass of + FrozenSet, because FrozenSet.__extra__ is collections.abc.Set, and + set is a subclass of that. + """ + + def __subclasscheck__(self, cls): + if issubclass(cls, Set): + return False + return super().__subclasscheck__(cls) + + def __instancecheck__(self, obj): + if issubclass(obj.__class__, Set): + return False + return super().__instancecheck__(obj) + + +class FrozenSet(frozenset, AbstractSet[T_co], metaclass=_FrozenSetMeta): -class MappingView(Sized, Iterable, extra=collections_abc.MappingView): + def __new__(cls, *args, **kwds): + if _geqv(cls, FrozenSet): + raise TypeError("Type FrozenSet cannot be instantiated; " + "use frozenset() instead") + return frozenset.__new__(cls, *args, **kwds) + + +class MappingView(Sized, Iterable[T_co], extra=collections_abc.MappingView): pass -class KeysView(MappingView, Set[KT], extra=collections_abc.KeysView): +class KeysView(MappingView[KT_co], AbstractSet[KT_co], + extra=collections_abc.KeysView): pass -# TODO: Enable Set[Tuple[KT, VT]] instead of Generic[KT, VT]. -class ItemsView(MappingView, Generic[KT, VT], extra=collections_abc.ItemsView): +# TODO: Enable Set[Tuple[KT_co, VT_co]] instead of Generic[KT_co, VT_co]. +class ItemsView(MappingView, Generic[KT_co, VT_co], + extra=collections_abc.ItemsView): pass -class ValuesView(MappingView, extra=collections_abc.ValuesView): +class ValuesView(MappingView[VT_co], extra=collections_abc.ValuesView): pass @@ -1395,8 +1501,32 @@ def __instancecheck__(self, obj): return True -class Dict(dict, MutableMapping, metaclass=_DictMeta): - pass +class Dict(dict, MutableMapping[KT, VT], metaclass=_DictMeta): + + def __new__(cls, *args, **kwds): + if _geqv(cls, Dict): + raise TypeError("Type Dict cannot be instantiated; " + "use dict() instead") + return dict.__new__(cls, *args, **kwds) + + +# Determine what base class to use for Generator. +if hasattr(collections_abc, 'Generator'): + # Sufficiently recent versions of 3.5 have a Generator ABC. + _G_base = collections_abc.Generator +else: + # Fall back on the exact type. + _G_base = types.GeneratorType + + +class Generator(Iterator[T_co], Generic[T_co, T_contra, V_co], + extra=_G_base): + + def __new__(cls, *args, **kwds): + if _geqv(cls, Generator): + raise TypeError("Type Generator cannot be instantiated; " + "create a subclass instead") + return super().__new__(cls, *args, **kwds) def NamedTuple(typename, fields): diff --git a/mypy/checker.py b/mypy/checker.py index 451aa731e8d3..25823ab0afdb 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -15,7 +15,7 @@ BytesExpr, UnicodeExpr, FloatExpr, OpExpr, UnaryExpr, CastExpr, SuperExpr, TypeApplication, DictExpr, SliceExpr, FuncExpr, TempNode, SymbolTableNode, Context, ListComprehension, ConditionalExpr, GeneratorExpr, - Decorator, SetExpr, PassStmt, TypeVarExpr, UndefinedExpr, PrintStmt, + Decorator, SetExpr, PassStmt, TypeVarExpr, PrintStmt, LITERAL_TYPE, BreakStmt, ContinueStmt, ComparisonExpr, StarExpr, YieldFromExpr, YieldFromStmt, NamedTupleExpr, SetComprehension, DictionaryComprehension, ComplexExpr, EllipsisNode, TypeAliasExpr, @@ -1004,13 +1004,9 @@ def check_multi_assignment(self, lvalues: List[Node], if not msg: msg = messages.INCOMPATIBLE_TYPES_IN_ASSIGNMENT - # First handle case where rvalue is of form Undefined, ... - rvalue_type = get_undefined_tuple(rvalue, self.named_type('builtins.tuple')) - undefined_rvalue = True - if not rvalue_type: - # Infer the type of an ordinary rvalue expression. - rvalue_type = self.accept(rvalue) # TODO maybe elsewhere; redundant - undefined_rvalue = False + # Infer the type of an ordinary rvalue expression. + rvalue_type = self.accept(rvalue) # TODO maybe elsewhere; redundant + undefined_rvalue = False if isinstance(rvalue_type, AnyType): for lv in lvalues: @@ -1243,13 +1239,7 @@ def narrow_type_from_binder(self, expr: Node, known_type: Type) -> Type: def check_simple_assignment(self, lvalue_type: Type, rvalue: Node, context: Node, msg: str = messages.INCOMPATIBLE_TYPES_IN_ASSIGNMENT) -> Type: - """Checks the assignment of rvalue to a lvalue of type lvalue_type.""" - if refers_to_fullname(rvalue, 'typing.Undefined'): - # The rvalue is just 'Undefined'; this is always valid. - # Infer the type of 'Undefined' from the lvalue type. - self.store_type(rvalue, lvalue_type) - return None - elif self.is_stub and isinstance(rvalue, EllipsisNode): + if self.is_stub and isinstance(rvalue, EllipsisNode): # '...' is always a valid initializer in a stub. return AnyType() else: @@ -1797,9 +1787,6 @@ def visit_generator_expr(self, e: GeneratorExpr) -> Type: def visit_dictionary_comprehension(self, e: DictionaryComprehension) -> Type: return self.expr_checker.visit_dictionary_comprehension(e) - def visit_undefined_expr(self, e: UndefinedExpr) -> Type: - return self.expr_checker.visit_undefined_expr(e) - def visit_temp_node(self, e: TempNode) -> Type: return e.type @@ -1981,21 +1968,6 @@ def map_type_from_supertype(typ: Type, sub_info: TypeInfo, return expand_type_by_instance(typ, inst_type) -def get_undefined_tuple(rvalue: Node, tuple_type: Instance) -> Type: - """Get tuple type corresponding to a tuple of Undefined values. - - The type is Tuple[Any, ...]. If rvalue is not of the right form, return - None. - """ - if isinstance(rvalue, TupleExpr): - for item in rvalue.items: - if not refers_to_fullname(item, 'typing.Undefined'): - break - else: - return TupleType([AnyType()] * len(rvalue.items), tuple_type) - return None - - def find_isinstance_check(node: Node, type_map: Dict[Node, Type]) -> Tuple[Node, Type, Type, int]: """Check if node is an isinstance(variable, type) check. diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index ee1b01ce8aaa..bef5dcf6a7fe 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -12,7 +12,7 @@ OpExpr, UnaryExpr, IndexExpr, CastExpr, TypeApplication, ListExpr, TupleExpr, DictExpr, FuncExpr, SuperExpr, SliceExpr, Context, ListComprehension, GeneratorExpr, SetExpr, MypyFile, Decorator, - UndefinedExpr, ConditionalExpr, ComparisonExpr, TempNode, SetComprehension, + ConditionalExpr, ComparisonExpr, TempNode, SetComprehension, DictionaryComprehension, ComplexExpr, EllipsisNode, LITERAL_TYPE, TypeAliasExpr ) @@ -1197,9 +1197,6 @@ def check_for_comp(self, e: Union[GeneratorExpr, DictionaryComprehension]) -> No self.accept(condition) self.chk.binder.pop_frame() - def visit_undefined_expr(self, e: UndefinedExpr) -> Type: - return e.type - def visit_conditional_expr(self, e: ConditionalExpr) -> Type: cond_type = self.accept(e.cond) self.check_not_void(cond_type, e) diff --git a/mypy/nodes.py b/mypy/nodes.py index 7a1c0a745192..ea9e3cced71f 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -1278,22 +1278,6 @@ def accept(self, visitor: NodeVisitor[T]) -> T: return visitor.visit_conditional_expr(self) -class UndefinedExpr(Node): - """Expression None # type: type, used as an initializer. - - This is used to declare the type of a variable without initializing with - a proper value. For example: - - x = None # type: List[int] - """ - - def __init__(self, type: 'mypy.types.Type') -> None: - self.type = type - - def accept(self, visitor: NodeVisitor[T]) -> T: - return visitor.visit_undefined_expr(self) - - class TypeApplication(Node): """Type application expr[type, ...]""" diff --git a/mypy/semanal.py b/mypy/semanal.py index afc8f4a90d51..35efce55419e 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -54,7 +54,7 @@ GlobalDecl, SuperExpr, DictExpr, CallExpr, RefExpr, OpExpr, UnaryExpr, SliceExpr, CastExpr, TypeApplication, Context, SymbolTable, SymbolTableNode, BOUND_TVAR, UNBOUND_TVAR, ListComprehension, GeneratorExpr, - FuncExpr, MDEF, FuncBase, Decorator, SetExpr, UndefinedExpr, TypeVarExpr, + FuncExpr, MDEF, FuncBase, Decorator, SetExpr, TypeVarExpr, StrExpr, PrintStmt, ConditionalExpr, PromoteExpr, ComparisonExpr, StarExpr, ARG_POS, ARG_NAMED, MroError, type_aliases, YieldFromStmt, YieldFromExpr, NamedTupleExpr, NonlocalDecl, @@ -821,7 +821,6 @@ def visit_assignment_stmt(self, s: AssignmentStmt) -> None: if s.type: s.type = self.anal_type(s.type) else: - s.type = self.infer_type_from_undefined(s.rvalue) # For simple assignments, allow binding type aliases. if (s.type is None and len(s.lvalues) == 1 and isinstance(s.lvalues[0], NameExpr)): @@ -988,13 +987,6 @@ def check_lvalue_validity(self, node: Node, ctx: Context) -> None: if isinstance(node, (FuncDef, TypeInfo, TypeVarExpr)): self.fail('Invalid assignment target', ctx) - def infer_type_from_undefined(self, rvalue: Node) -> Type: - if isinstance(rvalue, CallExpr): - if isinstance(rvalue.analyzed, UndefinedExpr): - undef = cast(UndefinedExpr, rvalue.analyzed) - return undef.type - return None - def store_declared_types(self, lvalue: Node, typ: Type) -> None: if isinstance(typ, StarType) and not isinstance(lvalue, StarExpr): self.fail('Star type only allowed for starred expressions', lvalue) @@ -1476,7 +1468,7 @@ def visit_call_expr(self, expr: CallExpr) -> None: """Analyze a call expression. Some call expressions are recognized as special forms, including - cast(...), Undefined(...) and Any(...). + cast(...) and Any(...). """ expr.callee.accept(self) if refers_to_fullname(expr.callee, 'typing.cast'): @@ -1501,18 +1493,6 @@ def visit_call_expr(self, expr: CallExpr) -> None: expr.analyzed = CastExpr(expr.args[0], AnyType()) expr.analyzed.line = expr.line expr.analyzed.accept(self) - elif refers_to_fullname(expr.callee, 'typing.Undefined'): - # Special form Undefined(...). - if not self.check_fixed_args(expr, 1, 'Undefined'): - return - try: - type = expr_to_unanalyzed_type(expr.args[0]) - except TypeTranslationError: - self.fail('Argument to Undefined is not a type', expr) - return - expr.analyzed = UndefinedExpr(type) - expr.analyzed.line = expr.line - expr.analyzed.accept(self) elif refers_to_fullname(expr.callee, 'typing._promote'): # Special form _promote(...). if not self.check_fixed_args(expr, 1, '_promote'): @@ -1625,9 +1605,6 @@ def visit_cast_expr(self, expr: CastExpr) -> None: expr.expr.accept(self) expr.type = self.anal_type(expr.type) - def visit_undefined_expr(self, expr: UndefinedExpr) -> None: - expr.type = self.anal_type(expr.type) - def visit_type_application(self, expr: TypeApplication) -> None: expr.expr.accept(self) for i in range(len(expr.types)): @@ -2006,9 +1983,6 @@ def visit_assignment_stmt(self, s: AssignmentStmt) -> None: self.analyze(s.type) super().visit_assignment_stmt(s) - def visit_undefined_expr(self, e: UndefinedExpr) -> None: - self.analyze(e.type) - def visit_cast_expr(self, e: CastExpr) -> None: self.analyze(e.type) super().visit_cast_expr(e) diff --git a/mypy/strconv.py b/mypy/strconv.py index 5b14789f0896..39303971b987 100644 --- a/mypy/strconv.py +++ b/mypy/strconv.py @@ -378,9 +378,6 @@ def visit_index_expr(self, o): def visit_super_expr(self, o): return self.dump([o.name], o) - def visit_undefined_expr(self, o): - return 'UndefinedExpr:{}({})'.format(o.line, o.type) - def visit_type_application(self, o): return self.dump([o.expr, ('Types', o.types)], o) diff --git a/mypy/test/data/pythoneval.test b/mypy/test/data/pythoneval.test index 447a3f6828d1..3f6d4fa7054f 100644 --- a/mypy/test/data/pythoneval.test +++ b/mypy/test/data/pythoneval.test @@ -33,12 +33,12 @@ def f(): f() [out] 'x' True -[1] typing.Sequence[~T] True -{1: 3} typing.Sequence[~T] False - typing.Iterator[~T] True -'x' typing.Iterable[~T] True -{} typing.Mapping[~KT, ~VT] True -{1} typing.AbstractSet[~T] True +[1] typing.Sequence[+T_co] True +{1: 3} typing.Sequence[+T_co] False + typing.Iterator[+T_co] True +'x' typing.Iterable[+T_co] True +{} typing.Mapping[+KT_co, +VT_co] True +{1} typing.AbstractSet[+T_co] True [case testSized] from typing import Sized diff --git a/mypy/test/testtypegen.py b/mypy/test/testtypegen.py index c23388529b66..924ac558953d 100644 --- a/mypy/test/testtypegen.py +++ b/mypy/test/testtypegen.py @@ -45,7 +45,7 @@ def run_test(self, testcase): nodes = map.keys() # Ignore NameExpr nodes of variables with explicit (trivial) types - # to simplify output. Also ignore 'Undefined' nodes. + # to simplify output. searcher = VariableDefinitionNodeSearcher() for file in result.files.values(): file.accept(searcher) @@ -86,9 +86,6 @@ def visit_assignment_stmt(self, s): for lvalue in s.lvalues: if isinstance(lvalue, NameExpr): self.nodes.add(lvalue) - if (isinstance(s.rvalue, NameExpr) - and s.rvalue.fullname == 'typing.Undefined'): - self.nodes.add(s.rvalue) def ignore_node(node): diff --git a/mypy/treetransform.py b/mypy/treetransform.py index 5f67cfeedd90..0425f23b65ec 100644 --- a/mypy/treetransform.py +++ b/mypy/treetransform.py @@ -15,7 +15,7 @@ ConditionalExpr, DictExpr, SetExpr, NameExpr, IntExpr, StrExpr, BytesExpr, UnicodeExpr, FloatExpr, CallExpr, SuperExpr, MemberExpr, IndexExpr, SliceExpr, OpExpr, UnaryExpr, FuncExpr, TypeApplication, PrintStmt, - SymbolTable, RefExpr, UndefinedExpr, TypeVarExpr, PromoteExpr, + SymbolTable, RefExpr, TypeVarExpr, PromoteExpr, ComparisonExpr, TempNode, StarExpr, YieldFromStmt, YieldFromExpr, NamedTupleExpr, NonlocalDecl, SetComprehension, DictionaryComprehension, ComplexExpr, TypeAliasExpr @@ -367,9 +367,6 @@ def visit_index_expr(self, node: IndexExpr) -> Node: new.analyzed.set_line(node.analyzed.line) return new - def visit_undefined_expr(self, node: UndefinedExpr) -> Node: - return UndefinedExpr(self.type(node.type)) - def visit_type_application(self, node: TypeApplication) -> TypeApplication: return TypeApplication(self.node(node.expr), self.types(node.types)) diff --git a/mypy/visitor.py b/mypy/visitor.py index 0d33225aa8d7..31c8ee91dd46 100644 --- a/mypy/visitor.py +++ b/mypy/visitor.py @@ -184,9 +184,6 @@ def visit_set_expr(self, o: 'mypy.nodes.SetExpr') -> T: def visit_index_expr(self, o: 'mypy.nodes.IndexExpr') -> T: pass - def visit_undefined_expr(self, o: 'mypy.nodes.UndefinedExpr') -> T: - pass - def visit_type_application(self, o: 'mypy.nodes.TypeApplication') -> T: pass diff --git a/stubs/2.7/__future__.pyi b/stubs/2.7/__future__.pyi index 4c20971f6bf7..21db863c8765 100644 --- a/stubs/2.7/__future__.pyi +++ b/stubs/2.7/__future__.pyi @@ -1,11 +1,9 @@ -from typing import Undefined - class _Feature: pass -absolute_import = Undefined(_Feature) -division = Undefined(_Feature) -generators = Undefined(_Feature) -nested_scopes = Undefined(_Feature) -print_function = Undefined(_Feature) -unicode_literals = Undefined(_Feature) -with_statement = Undefined(_Feature) +absolute_import = None # type: _Feature +division = None # type: _Feature +generators = None # type: _Feature +nested_scopes = None # type: _Feature +print_function = None # type: _Feature +unicode_literals = None # type: _Feature +with_statement = None # type: _Feature diff --git a/stubs/2.7/builtins.pyi b/stubs/2.7/builtins.pyi index 00d4b87fd74d..d2c7c6fc61e3 100644 --- a/stubs/2.7/builtins.pyi +++ b/stubs/2.7/builtins.pyi @@ -1,7 +1,7 @@ # Stubs for builtins (Python 2.7) from typing import ( - Undefined, TypeVar, Iterator, Iterable, overload, + TypeVar, Iterator, Iterable, overload, Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set, AbstractSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, IO, BinaryIO, Union, AnyStr @@ -23,7 +23,7 @@ property = object() class object: __doc__ = '' - __class__ = Undefined # type: type + __class__ = None # type: type def __init__(self) -> None: pass def __eq__(self, o: object) -> bool: pass @@ -35,7 +35,7 @@ class object: class type: __name__ = '' __module__ = '' - __dict__ = Undefined # type: Dict[unicode, Any] + __dict__ = None # type: Dict[unicode, Any] def __init__(self, o: object) -> None: pass # TODO: __new__ may have to be special and not a static method. @@ -578,7 +578,7 @@ class list(Sequence[_T], Reversible[_T], Generic[_T]): def append(self, object: _T) -> None: pass def extend(self, iterable: Iterable[_T]) -> None: pass def pop(self, index: int = -1) -> _T: pass - def index(self, object: _T, start: int = 0, stop: int = Undefined(int)) -> int: pass + def index(self, object: _T, start: int = 0, stop: int = None) -> int: pass def count(self, object: _T) -> int: pass def insert(self, index: int, object: _T) -> None: pass def remove(self, object: _T) -> None: pass @@ -709,16 +709,16 @@ class xrange(Sized, Iterable[int], Reversible[int]): class module: __name__ = '' __file__ = '' - __dict__ = Undefined # type: Dict[unicode, Any] + __dict__ = None # type: Dict[unicode, Any] -True = Undefined # type: bool -False = Undefined # type: bool +True = None # type: bool +False = None # type: bool __debug__ = False long = int bytes = str -NotImplemented = Undefined # type: Any +NotImplemented = None # type: Any def abs(n: SupportsAbs[_T]) -> _T: pass def all(i: Iterable) -> bool: pass @@ -841,7 +841,7 @@ def __import__(name: unicode, # Exceptions class BaseException: - args = Undefined # type: Any + args = None # type: Any def __init__(self, *args: Any) -> None: pass def with_traceback(self, tb: Any) -> BaseException: pass diff --git a/stubs/2.7/difflib.pyi b/stubs/2.7/difflib.pyi index 7fee705283bf..605a29885ac5 100644 --- a/stubs/2.7/difflib.pyi +++ b/stubs/2.7/difflib.pyi @@ -5,14 +5,14 @@ # TODO: Support unicode? from typing import ( - TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic, Undefined + TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic ) _T = TypeVar('_T') class SequenceMatcher(Generic[_T]): def __init__(self, isjunk: Callable[[_T], bool] = None, - a: Sequence[_T] = Undefined, b: Sequence[_T] = Undefined, + a: Sequence[_T] = None, b: Sequence[_T] = None, autojunk: bool = True) -> None: pass def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: pass def set_seq1(self, a: Sequence[_T]) -> None: pass diff --git a/stubs/2.7/re.pyi b/stubs/2.7/re.pyi index 1441bdfaf985..dbbf6c69a423 100644 --- a/stubs/2.7/re.pyi +++ b/stubs/2.7/re.pyi @@ -5,7 +5,7 @@ # based on: http://docs.python.org/2.7/library/re.html from typing import ( - Undefined, List, Iterator, overload, Callable, Tuple, Sequence, Dict, + List, Iterator, overload, Callable, Tuple, Sequence, Dict, Generic, AnyStr, Match, Pattern ) diff --git a/stubs/2.7/sys.pyi b/stubs/2.7/sys.pyi index 5ea0b16e260a..dc546103cae4 100644 --- a/stubs/2.7/sys.pyi +++ b/stubs/2.7/sys.pyi @@ -6,54 +6,54 @@ # Partially adapted to Python 2.7 by Jukka Lehtosalo. from typing import ( - Undefined, List, Sequence, Any, Dict, Tuple, BinaryIO, overload + List, Sequence, Any, Dict, Tuple, BinaryIO, overload ) # ----- sys variables ----- abiflags = '' -argv = Undefined(List[str]) +argv = None # type: List[str] byteorder = '' -builtin_module_names = Undefined(Sequence[str]) # actually a tuple of strings +builtin_module_names = None # type: Sequence[str] # actually a tuple of strings copyright = '' #dllhandle = 0 # Windows only dont_write_bytecode = False -__displayhook__ = Undefined(Any) # contains the original value of displayhook -__excepthook__ = Undefined(Any) # contains the original value of excepthook +__displayhook__ = None # type: Any # contains the original value of displayhook +__excepthook__ = None # type: Any # contains the original value of excepthook exec_prefix = '' executable = '' float_repr_style = '' hexversion = 0 # this is a 32-bit int -last_type = Undefined(Any) -last_value = Undefined(Any) -last_traceback = Undefined(Any) +last_type = None # type: Any +last_value = None # type: Any +last_traceback = None # type: Any maxsize = 0 maxunicode = 0 -meta_path = Undefined(List[Any]) -modules = Undefined(Dict[str, Any]) -path = Undefined(List[str]) -path_hooks = Undefined(List[Any]) # TODO precise type; function, path to finder -path_importer_cache = Undefined(Dict[str, Any]) # TODO precise type +meta_path = None # type: List[Any] +modules = None # type: Dict[str, Any] +path = None # type: List[str] +path_hooks = None # type: List[Any] # TODO precise type; function, path to finder +path_importer_cache = None # type: Dict[str, Any] # TODO precise type platform = '' prefix = '' ps1 = '' ps2 = '' -stdin = Undefined(BinaryIO) -stdout = Undefined(BinaryIO) -stderr = Undefined(BinaryIO) -__stdin__ = Undefined(BinaryIO) -__stdout__ = Undefined(BinaryIO) -__stderr__ = Undefined(BinaryIO) -subversion = Undefined(Tuple[str, str, str]) +stdin = None # type: BinaryIO +stdout = None # type: BinaryIO +stderr = None # type: BinaryIO +__stdin__ = None # type: BinaryIO +__stdout__ = None # type: BinaryIO +__stderr__ = None # type: BinaryIO +subversion = None # type: Tuple[str, str, str] tracebacklimit = 0 version = '' api_version = 0 -warnoptions = Undefined(Any) +warnoptions = None # type: Any # Each entry is a tuple of the form (action, message, category, module, # lineno) #winver = '' # Windows only -_xoptions = Undefined(Dict[Any, Any]) +_xoptions = None # type: Dict[Any, Any] -flags = Undefined(_flags) +flags = None # type: _flags class _flags: debug = 0 division_warning = 0 @@ -69,7 +69,7 @@ class _flags: quiet = 0 hash_randomization = 0 -float_info = Undefined(_float_info) +float_info = None # type: _float_info class _float_info: epsilon = 0.0 # DBL_EPSILON dig = 0 # DBL_DIG @@ -83,7 +83,7 @@ class _float_info: radix = 0 # FLT_RADIX rounds = 0 # FLT_ROUNDS -hash_info = Undefined(_hash_info) +hash_info = None # type: _hash_info class _hash_info: width = 0 # width in bits used for hash values modulus = 0 # prime modulus P used for numeric hash scheme @@ -91,14 +91,14 @@ class _hash_info: nan = 0 # hash value returned for a nan imag = 0 # multiplier used for the imaginary part of a complex number -int_info = Undefined(_int_info) +int_info = None # type: _int_info class _int_info: bits_per_digit = 0 # number of bits held in each digit. Python integers # are stored internally in # base 2**int_info.bits_per_digit sizeof_digit = 0 # size in bytes of C type used to represent a digit -version_info = Undefined(_version_info) +version_info = None # type: _version_info class _version_info: major = 0 minor = 0 diff --git a/stubs/2.7/typing.pyi b/stubs/2.7/typing.pyi index 458ed1cafea5..ddc064c65d2a 100644 --- a/stubs/2.7/typing.pyi +++ b/stubs/2.7/typing.pyi @@ -7,7 +7,6 @@ from abc import abstractmethod, ABCMeta cast = object() overload = object() -Undefined = object() Any = object() TypeVar = object() Generic = object() @@ -242,12 +241,12 @@ class Match(Generic[AnyStr]): pos = 0 endpos = 0 lastindex = 0 - lastgroup = Undefined(AnyStr) - string = Undefined(AnyStr) + lastgroup = None # type: AnyStr + string = None # type: AnyStr # The regular expression object whose match() or search() method produced # this match instance. - re = Undefined('Pattern[AnyStr]') + re = None # type: 'Pattern[AnyStr]' def expand(self, template: AnyStr) -> AnyStr: pass @@ -272,7 +271,7 @@ class Pattern(Generic[AnyStr]): flags = 0 groupindex = 0 groups = 0 - pattern = Undefined(AnyStr) + pattern = None # type: AnyStr def search(self, string: AnyStr, pos: int = 0, endpos: int = -1) -> Match[AnyStr]: pass diff --git a/stubs/3.2/__future__.pyi b/stubs/3.2/__future__.pyi index 4c20971f6bf7..0b4350fd4af7 100644 --- a/stubs/3.2/__future__.pyi +++ b/stubs/3.2/__future__.pyi @@ -1,11 +1,9 @@ -from typing import Undefined - class _Feature: pass -absolute_import = Undefined(_Feature) -division = Undefined(_Feature) -generators = Undefined(_Feature) -nested_scopes = Undefined(_Feature) -print_function = Undefined(_Feature) -unicode_literals = Undefined(_Feature) -with_statement = Undefined(_Feature) +absolute_import = ... # type: _Feature +division = ... # type: _Feature +generators = ... # type: _Feature +nested_scopes = ... # type: _Feature +print_function = ... # type: _Feature +unicode_literals = ... # type: _Feature +with_statement = ... # type: _Feature diff --git a/stubs/3.2/_dummy_thread.pyi b/stubs/3.2/_dummy_thread.pyi index b53256224f8b..d6afb2ba159e 100644 --- a/stubs/3.2/_dummy_thread.pyi +++ b/stubs/3.2/_dummy_thread.pyi @@ -2,7 +2,7 @@ # NOTE: These are incomplete! -from typing import Undefined, Any +from typing import Any class LockType: def acquire(self) -> None: pass diff --git a/stubs/3.2/_io.pyi b/stubs/3.2/_io.pyi index 6552d9eb10f5..48600c643828 100644 --- a/stubs/3.2/_io.pyi +++ b/stubs/3.2/_io.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, Undefined +from typing import Any class _IOBase: def __init__(self, *args, **kwargs): pass @@ -15,7 +15,7 @@ class _IOBase: def readable(self): pass def readline(self, size: int = -1): pass def readlines(self, hint: int = -1): pass - def seek(self, offset, whence=Undefined): pass + def seek(self, offset, whence=...): pass def seekable(self): pass def tell(self): pass def truncate(self, size: int = None) -> int: pass @@ -39,9 +39,9 @@ class _RawIOBase(_IOBase): def readall(self): pass class _TextIOBase(_IOBase): - encoding = Undefined(Any) - errors = Undefined(Any) - newlines = Undefined(Any) + encoding = ... # type: Any + errors = ... # type: Any + newlines = ... # type: Any def detach(self): pass def read(self, size: int = -1): pass def readline(self, size: int = -1): pass diff --git a/stubs/3.2/_locale.pyi b/stubs/3.2/_locale.pyi index d9e0907bc4e6..61d320b15de8 100644 --- a/stubs/3.2/_locale.pyi +++ b/stubs/3.2/_locale.pyi @@ -2,72 +2,72 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Iterable +from typing import Iterable -ABDAY_1 = Undefined(int) -ABDAY_2 = Undefined(int) -ABDAY_3 = Undefined(int) -ABDAY_4 = Undefined(int) -ABDAY_5 = Undefined(int) -ABDAY_6 = Undefined(int) -ABDAY_7 = Undefined(int) -ABMON_1 = Undefined(int) -ABMON_10 = Undefined(int) -ABMON_11 = Undefined(int) -ABMON_12 = Undefined(int) -ABMON_2 = Undefined(int) -ABMON_3 = Undefined(int) -ABMON_4 = Undefined(int) -ABMON_5 = Undefined(int) -ABMON_6 = Undefined(int) -ABMON_7 = Undefined(int) -ABMON_8 = Undefined(int) -ABMON_9 = Undefined(int) -ALT_DIGITS = Undefined(int) -AM_STR = Undefined(int) -CHAR_MAX = Undefined(int) -CODESET = Undefined(int) -CRNCYSTR = Undefined(int) -DAY_1 = Undefined(int) -DAY_2 = Undefined(int) -DAY_3 = Undefined(int) -DAY_4 = Undefined(int) -DAY_5 = Undefined(int) -DAY_6 = Undefined(int) -DAY_7 = Undefined(int) -D_FMT = Undefined(int) -D_T_FMT = Undefined(int) -ERA = Undefined(int) -ERA_D_FMT = Undefined(int) -ERA_D_T_FMT = Undefined(int) -ERA_T_FMT = Undefined(int) -LC_ALL = Undefined(int) -LC_COLLATE = Undefined(int) -LC_CTYPE = Undefined(int) -LC_MESSAGES = Undefined(int) -LC_MONETARY = Undefined(int) -LC_NUMERIC = Undefined(int) -LC_TIME = Undefined(int) -MON_1 = Undefined(int) -MON_10 = Undefined(int) -MON_11 = Undefined(int) -MON_12 = Undefined(int) -MON_2 = Undefined(int) -MON_3 = Undefined(int) -MON_4 = Undefined(int) -MON_5 = Undefined(int) -MON_6 = Undefined(int) -MON_7 = Undefined(int) -MON_8 = Undefined(int) -MON_9 = Undefined(int) -NOEXPR = Undefined(int) -PM_STR = Undefined(int) -RADIXCHAR = Undefined(int) -THOUSEP = Undefined(int) -T_FMT = Undefined(int) -T_FMT_AMPM = Undefined(int) -YESEXPR = Undefined(int) -_DATE_FMT = Undefined(int) +ABDAY_1 = ... # type: int +ABDAY_2 = ... # type: int +ABDAY_3 = ... # type: int +ABDAY_4 = ... # type: int +ABDAY_5 = ... # type: int +ABDAY_6 = ... # type: int +ABDAY_7 = ... # type: int +ABMON_1 = ... # type: int +ABMON_10 = ... # type: int +ABMON_11 = ... # type: int +ABMON_12 = ... # type: int +ABMON_2 = ... # type: int +ABMON_3 = ... # type: int +ABMON_4 = ... # type: int +ABMON_5 = ... # type: int +ABMON_6 = ... # type: int +ABMON_7 = ... # type: int +ABMON_8 = ... # type: int +ABMON_9 = ... # type: int +ALT_DIGITS = ... # type: int +AM_STR = ... # type: int +CHAR_MAX = ... # type: int +CODESET = ... # type: int +CRNCYSTR = ... # type: int +DAY_1 = ... # type: int +DAY_2 = ... # type: int +DAY_3 = ... # type: int +DAY_4 = ... # type: int +DAY_5 = ... # type: int +DAY_6 = ... # type: int +DAY_7 = ... # type: int +D_FMT = ... # type: int +D_T_FMT = ... # type: int +ERA = ... # type: int +ERA_D_FMT = ... # type: int +ERA_D_T_FMT = ... # type: int +ERA_T_FMT = ... # type: int +LC_ALL = ... # type: int +LC_COLLATE = ... # type: int +LC_CTYPE = ... # type: int +LC_MESSAGES = ... # type: int +LC_MONETARY = ... # type: int +LC_NUMERIC = ... # type: int +LC_TIME = ... # type: int +MON_1 = ... # type: int +MON_10 = ... # type: int +MON_11 = ... # type: int +MON_12 = ... # type: int +MON_2 = ... # type: int +MON_3 = ... # type: int +MON_4 = ... # type: int +MON_5 = ... # type: int +MON_6 = ... # type: int +MON_7 = ... # type: int +MON_8 = ... # type: int +MON_9 = ... # type: int +NOEXPR = ... # type: int +PM_STR = ... # type: int +RADIXCHAR = ... # type: int +THOUSEP = ... # type: int +T_FMT = ... # type: int +T_FMT_AMPM = ... # type: int +YESEXPR = ... # type: int +_DATE_FMT = ... # type: int def bind_textdomain_codeset(domain, codeset): pass def bindtextdomain(domain, dir): pass diff --git a/stubs/3.2/_thread.pyi b/stubs/3.2/_thread.pyi index e70c209631aa..e57a126b6a3c 100644 --- a/stubs/3.2/_thread.pyi +++ b/stubs/3.2/_thread.pyi @@ -2,10 +2,10 @@ # NOTE: These are incomplete! -from typing import Undefined, Any +from typing import Any def _count() -> int: pass -_dangling = Undefined(Any) +_dangling = ... # type: Any class LockType: def acquire(self) -> None: pass diff --git a/stubs/3.2/argparse.pyi b/stubs/3.2/argparse.pyi index 4018df79d48a..af184336224c 100644 --- a/stubs/3.2/argparse.pyi +++ b/stubs/3.2/argparse.pyi @@ -2,14 +2,14 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any, Sequence +from typing import Any, Sequence -SUPPRESS = Undefined(Any) -OPTIONAL = Undefined(Any) -ZERO_OR_MORE = Undefined(Any) -ONE_OR_MORE = Undefined(Any) -PARSER = Undefined(Any) -REMAINDER = Undefined(Any) +SUPPRESS = ... # type: Any +OPTIONAL = ... # type: Any +ZERO_OR_MORE = ... # type: Any +ONE_OR_MORE = ... # type: Any +PARSER = ... # type: Any +REMAINDER = ... # type: Any class _AttributeHolder: pass @@ -29,23 +29,23 @@ class ArgumentDefaultsHelpFormatter(HelpFormatter): pass class MetavarTypeHelpFormatter(HelpFormatter): pass class ArgumentError(Exception): - argument_name = Undefined(Any) - message = Undefined(Any) + argument_name = ... # type: Any + message = ... # type: Any def __init__(self, argument, message): pass class ArgumentTypeError(Exception): pass class Action(_AttributeHolder): - option_strings = Undefined(Any) - dest = Undefined(Any) - nargs = Undefined(Any) - const = Undefined(Any) - default = Undefined(Any) - type = Undefined(Any) - choices = Undefined(Any) - required = Undefined(Any) - help = Undefined(Any) - metavar = Undefined(Any) + option_strings = ... # type: Any + dest = ... # type: Any + nargs = ... # type: Any + const = ... # type: Any + default = ... # type: Any + type = ... # type: Any + choices = ... # type: Any + required = ... # type: Any + help = ... # type: Any + metavar = ... # type: Any def __init__(self, option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None): pass def __call__(self, parser, namespace, values, option_string=None): pass @@ -81,17 +81,17 @@ class _CountAction(Action): def __call__(self, parser, namespace, values, option_string=None): pass class _HelpAction(Action): - def __init__(self, option_strings, dest=Undefined, default=Undefined, help=None): pass + def __init__(self, option_strings, dest=..., default=..., help=None): pass def __call__(self, parser, namespace, values, option_string=None): pass class _VersionAction(Action): - version = Undefined(Any) - def __init__(self, option_strings, version=None, dest=Undefined, default=Undefined, + version = ... # type: Any + def __init__(self, option_strings, version=None, dest=..., default=..., help=''): pass def __call__(self, parser, namespace, values, option_string=None): pass class _SubParsersAction(Action): - def __init__(self, option_strings, prog, parser_class, dest=Undefined, help=None, + def __init__(self, option_strings, prog, parser_class, dest=..., help=None, metavar=None): pass def add_parser(self, name, **kwargs): pass def __call__(self, parser, namespace, values, option_string=None): pass @@ -107,10 +107,10 @@ class Namespace(_AttributeHolder): def __contains__(self, key): pass class _ActionsContainer: - description = Undefined(Any) - argument_default = Undefined(Any) - prefix_chars = Undefined(Any) - conflict_handler = Undefined(Any) + description = ... # type: Any + argument_default = ... # type: Any + prefix_chars = ... # type: Any + conflict_handler = ... # type: Any def __init__(self, description, prefix_chars, argument_default, conflict_handler): pass def register(self, registry_name, value, object): pass def set_defaults(self, **kwargs): pass @@ -131,22 +131,22 @@ class _ActionsContainer: def add_mutually_exclusive_group(self, **kwargs): pass class _ArgumentGroup(_ActionsContainer): - title = Undefined(Any) + title = ... # type: Any def __init__(self, container, title=None, description=None, **kwargs): pass class _MutuallyExclusiveGroup(_ArgumentGroup): - required = Undefined(Any) + required = ... # type: Any def __init__(self, container, required=False): pass class ArgumentParser(_AttributeHolder, _ActionsContainer): - prog = Undefined(Any) - usage = Undefined(Any) - epilog = Undefined(Any) - formatter_class = Undefined(Any) - fromfile_prefix_chars = Undefined(Any) - add_help = Undefined(Any) - def __init__(self, prog=None, usage=None, description=None, epilog=None, parents=Undefined, - formatter_class=Undefined, prefix_chars='', fromfile_prefix_chars=None, + prog = ... # type: Any + usage = ... # type: Any + epilog = ... # type: Any + formatter_class = ... # type: Any + fromfile_prefix_chars = ... # type: Any + add_help = ... # type: Any + def __init__(self, prog=None, usage=None, description=None, epilog=None, parents=..., + formatter_class=..., prefix_chars='', fromfile_prefix_chars=None, argument_default=None, conflict_handler='', add_help=True): pass def add_subparsers(self, **kwargs): pass def parse_args(self, args: Sequence[str] = None, namespace=None) -> Any: pass diff --git a/stubs/3.2/builtins.pyi b/stubs/3.2/builtins.pyi index 85e0755d69d4..48a1bbbd6ad9 100644 --- a/stubs/3.2/builtins.pyi +++ b/stubs/3.2/builtins.pyi @@ -1,7 +1,7 @@ # Stubs for builtins from typing import ( - Undefined, TypeVar, Iterator, Iterable, overload, + TypeVar, Iterator, Iterable, overload, Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic, Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString @@ -28,7 +28,7 @@ _byte_types = Union[bytes, bytearray] class object: __doc__ = '' - __class__ = Undefined # type: type + __class__ = ... # type: type def __init__(self) -> None: pass def __eq__(self, o: object) -> bool: pass @@ -41,7 +41,7 @@ class type: __name__ = '' __qualname__ = '' __module__ = '' - __dict__ = Undefined # type: Dict[str, Any] + __dict__ = ... # type: Dict[str, Any] def __init__(self, o: object) -> None: pass @staticmethod @@ -431,7 +431,7 @@ class function: __name__ = '' __qualname__ = '' __module__ = '' - __code__ = Undefined(Any) + __code__ = ... # type: Any class list(MutableSequence[_T], Generic[_T]): @overload @@ -443,7 +443,7 @@ class list(MutableSequence[_T], Generic[_T]): def append(self, object: _T) -> None: pass def extend(self, iterable: Iterable[_T]) -> None: pass def pop(self, index: int = -1) -> _T: pass - def index(self, object: _T, start: int = 0, stop: int = Undefined(int)) -> int: pass + def index(self, object: _T, start: int = 0, stop: int = ...) -> int: pass def count(self, object: _T) -> int: pass def insert(self, index: int, object: _T) -> None: pass def remove(self, object: _T) -> None: pass @@ -594,13 +594,13 @@ class module: # TODO not defined in builtins! __name__ = '' __file__ = '' - __dict__ = Undefined # type: Dict[str, Any] + __dict__ = ... # type: Dict[str, Any] -True = Undefined # type: bool -False = Undefined # type: bool +True = ... # type: bool +False = ... # type: bool __debug__ = False -NotImplemented = Undefined # type: Any +NotImplemented = ... # type: Any def abs(n: SupportsAbs[_T]) -> _T: pass def all(i: Iterable) -> bool: pass @@ -718,7 +718,7 @@ Ellipsis = ellipsis() # Exceptions class BaseException: - args = Undefined # type: Any + args = ... # type: Any def __init__(self, *args: Any) -> None: pass def with_traceback(self, tb: Any) -> BaseException: pass @@ -776,11 +776,11 @@ class TypeError(Exception): pass class UnboundLocalError(NameError): pass class UnicodeError(ValueError): pass class UnicodeDecodeError(UnicodeError): - encoding = Undefined(str) - object = Undefined(bytes) - start = Undefined(int) - end = Undefined(int) - reason = Undefined(str) + encoding = ... # type: str + object = ... # type: bytes + start = ... # type: int + end = ... # type: int + reason = ... # type: str def __init__(self, __encoding: str, __object: bytes, __start: int, __end: int, __reason: str) -> None: pass class UnicodeEncodeError(UnicodeError): pass diff --git a/stubs/3.2/codecs.pyi b/stubs/3.2/codecs.pyi index 2985c800db26..95b0b8b273ac 100644 --- a/stubs/3.2/codecs.pyi +++ b/stubs/3.2/codecs.pyi @@ -1,4 +1,4 @@ -from typing import Any, BinaryIO, Callable, Undefined +from typing import Any, BinaryIO, Callable BOM_UTF8 = b'' @@ -20,7 +20,7 @@ def lookup(encoding: str) -> CodecInfo: def getwriter(encoding: str) -> Callable[[BinaryIO], StreamWriter]: pass class IncrementalDecoder: - errors = Undefined(Any) + errors = ... # type: Any def __init__(self, errors=''): pass def decode(self, input, final=False): pass def reset(self): pass diff --git a/stubs/3.2/collections.pyi b/stubs/3.2/collections.pyi index b5666e8c2cd4..84198d944dd9 100644 --- a/stubs/3.2/collections.pyi +++ b/stubs/3.2/collections.pyi @@ -9,7 +9,7 @@ from typing import ( TypeVar, Iterable, Generic, Iterator, Dict, overload, - Mapping, List, Tuple, Undefined, Callable, Set, Sequence, Sized, + Mapping, List, Tuple, Callable, Set, Sequence, Sized, Optional, Union ) import typing @@ -90,7 +90,7 @@ class OrderedDict(Dict[_KT, _VT], Generic[_KT, _VT]): class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]): - default_factory = Undefined(Callable[[], _VT]) + default_factory = ... # type: Callable[[], _VT] @overload def __init__(self) -> None: pass diff --git a/stubs/3.2/csv.pyi b/stubs/3.2/csv.pyi index fc89bb520b77..91b2faca4a2c 100644 --- a/stubs/3.2/csv.pyi +++ b/stubs/3.2/csv.pyi @@ -2,76 +2,76 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any -QUOTE_ALL = Undefined(int) -QUOTE_MINIMAL = Undefined(int) -QUOTE_NONE = Undefined(int) -QUOTE_NONNUMERIC = Undefined(int) +QUOTE_ALL = ... # type: int +QUOTE_MINIMAL = ... # type: int +QUOTE_NONE = ... # type: int +QUOTE_NONNUMERIC = ... # type: int class Error(Exception): pass -def writer(csvfile, dialect=Undefined, **fmtparams): pass -def reader(csvfile, dialect=Undefined, **fmtparams): pass -def register_dialect(name, dialect=Undefined, **fmtparams): pass +def writer(csvfile, dialect=..., **fmtparams): pass +def reader(csvfile, dialect=..., **fmtparams): pass +def register_dialect(name, dialect=..., **fmtparams): pass def unregister_dialect(name): pass def get_dialect(name): pass def list_dialects(): pass -def field_size_limit(new_limit=Undefined): pass +def field_size_limit(new_limit=...): pass class Dialect: - delimiter = Undefined(Any) - quotechar = Undefined(Any) - escapechar = Undefined(Any) - doublequote = Undefined(Any) - skipinitialspace = Undefined(Any) - lineterminator = Undefined(Any) - quoting = Undefined(Any) + delimiter = ... # type: Any + quotechar = ... # type: Any + escapechar = ... # type: Any + doublequote = ... # type: Any + skipinitialspace = ... # type: Any + lineterminator = ... # type: Any + quoting = ... # type: Any def __init__(self): pass class excel(Dialect): - delimiter = Undefined(Any) - quotechar = Undefined(Any) - doublequote = Undefined(Any) - skipinitialspace = Undefined(Any) - lineterminator = Undefined(Any) - quoting = Undefined(Any) + delimiter = ... # type: Any + quotechar = ... # type: Any + doublequote = ... # type: Any + skipinitialspace = ... # type: Any + lineterminator = ... # type: Any + quoting = ... # type: Any class excel_tab(excel): - delimiter = Undefined(Any) + delimiter = ... # type: Any class unix_dialect(Dialect): - delimiter = Undefined(Any) - quotechar = Undefined(Any) - doublequote = Undefined(Any) - skipinitialspace = Undefined(Any) - lineterminator = Undefined(Any) - quoting = Undefined(Any) + delimiter = ... # type: Any + quotechar = ... # type: Any + doublequote = ... # type: Any + skipinitialspace = ... # type: Any + lineterminator = ... # type: Any + quoting = ... # type: Any class DictReader: - restkey = Undefined(Any) - restval = Undefined(Any) - reader = Undefined(Any) - dialect = Undefined(Any) - line_num = Undefined(Any) - fieldnames = Undefined(Any) # Actually a property + restkey = ... # type: Any + restval = ... # type: Any + reader = ... # type: Any + dialect = ... # type: Any + line_num = ... # type: Any + fieldnames = ... # type: Any # Actually a property def __init__(self, f, fieldnames=None, restkey=None, restval=None, dialect='', *args, **kwds): pass def __iter__(self): pass def __next__(self): pass class DictWriter: - fieldnames = Undefined(Any) - restval = Undefined(Any) - extrasaction = Undefined(Any) - writer = Undefined(Any) + fieldnames = ... # type: Any + restval = ... # type: Any + extrasaction = ... # type: Any + writer = ... # type: Any def __init__(self, f, fieldnames, restval='', extrasaction='', dialect='', *args, **kwds): pass def writeheader(self): pass def writerow(self, rowdict): pass def writerows(self, rowdicts): pass class Sniffer: - preferred = Undefined(Any) + preferred = ... # type: Any def __init__(self): pass def sniff(self, sample, delimiters=None): pass def has_header(self, sample): pass diff --git a/stubs/3.2/datetime.pyi b/stubs/3.2/datetime.pyi index 3e3a0c6ab573..7ca108f40c36 100644 --- a/stubs/3.2/datetime.pyi +++ b/stubs/3.2/datetime.pyi @@ -2,7 +2,7 @@ # NOTE: These are incomplete! -from typing import Optional, SupportsAbs, Tuple, Undefined, Union, overload +from typing import Optional, SupportsAbs, Tuple, Union, overload MINYEAR = 0 MAXYEAR = 0 @@ -14,9 +14,9 @@ class tzinfo: def fromutc(self, dt: datetime) -> datetime: pass class timezone(tzinfo): - utc = Undefined(tzinfo) - min = Undefined(tzinfo) - max = Undefined(tzinfo) + utc = ... # type: tzinfo + min = ... # type: tzinfo + max = ... # type: tzinfo def __init__(self, offset: timedelta, name: str = '') -> None: pass def __hash__(self) -> int: pass @@ -25,9 +25,9 @@ _tzinfo = tzinfo _timezone = timezone class date: - min = Undefined(date) - max = Undefined(date) - resolution = Undefined(timedelta) + min = ... # type: date + max = ... # type: date + resolution = ... # type: timedelta def __init__(self, year: int, month: int = None, day: int = None) -> None: pass @@ -67,9 +67,9 @@ class date: def isocalendar(self) -> Tuple[int, int, int]: pass class time: - min = Undefined(time) - max = Undefined(time) - resolution = Undefined(timedelta) + min = ... # type: time + max = ... # type: time + resolution = ... # type: timedelta def __init__(self, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0, tzinfo: tzinfo = None) -> None: pass @@ -103,9 +103,9 @@ _date = date _time = time class timedelta(SupportsAbs[timedelta]): - min = Undefined(timedelta) - max = Undefined(timedelta) - resolution = Undefined(timedelta) + min = ... # type: timedelta + max = ... # type: timedelta + resolution = ... # type: timedelta def __init__(self, days: int = 0, seconds: int = 0, microseconds: int = 0, milliseconds: int = 0, minutes: int = 0, hours: int = 0, @@ -147,9 +147,9 @@ class timedelta(SupportsAbs[timedelta]): class datetime: # TODO: Is a subclass of date, but this would make some types incompatible. - min = Undefined(datetime) - max = Undefined(datetime) - resolution = Undefined(timedelta) + min = ... # type: datetime + max = ... # type: datetime + resolution = ... # type: timedelta def __init__(self, year: int, month: int = None, day: int = None, hour: int = None, minute: int = None, second: int = None, microseconds: int = None, diff --git a/stubs/3.2/decimal.pyi b/stubs/3.2/decimal.pyi index 74720bf981a9..089848c9554e 100644 --- a/stubs/3.2/decimal.pyi +++ b/stubs/3.2/decimal.pyi @@ -1,28 +1,28 @@ # Stubs for decimal (Python 3.4) from typing import ( - Any, Undefined, Union, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, Sequence, + Any, Union, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, Sequence, Tuple, NamedTuple, Dict ) _Decimal = Union[Decimal, int] -BasicContext = Undefined(Context) -DefaultContext = Undefined(Context) -ExtendedContext = Undefined(Context) -HAVE_THREADS = Undefined(bool) -MAX_EMAX = Undefined(int) -MAX_PREC = Undefined(int) -MIN_EMIN = Undefined(int) -MIN_ETINY = Undefined(int) -ROUND_05UP = Undefined(str) -ROUND_CEILING = Undefined(str) -ROUND_DOWN = Undefined(str) -ROUND_FLOOR = Undefined(str) -ROUND_HALF_DOWN = Undefined(str) -ROUND_HALF_EVEN = Undefined(str) -ROUND_HALF_UP = Undefined(str) -ROUND_UP = Undefined(str) +BasicContext = ... # type: Context +DefaultContext = ... # type: Context +ExtendedContext = ... # type: Context +HAVE_THREADS = ... # type: bool +MAX_EMAX = ... # type: int +MAX_PREC = ... # type: int +MIN_EMIN = ... # type: int +MIN_ETINY = ... # type: int +ROUND_05UP = ... # type: str +ROUND_CEILING = ... # type: str +ROUND_DOWN = ... # type: str +ROUND_FLOOR = ... # type: str +ROUND_HALF_DOWN = ... # type: str +ROUND_HALF_EVEN = ... # type: str +ROUND_HALF_UP = ... # type: str +ROUND_UP = ... # type: str def getcontext() -> Context: pass def localcontext(ctx: Context = None) -> _ContextManager: pass @@ -38,13 +38,13 @@ class _ContextManager: def __exit__(self, t, v, tb) -> None: pass class Context: - Emax = Undefined(int) - Emin = Undefined(int) - capitals = Undefined(int) - clamp = Undefined(int) - prec = Undefined(int) - rounding = Undefined(str) - traps = Undefined(Dict[type, bool]) + Emax = ... # type: int + Emin = ... # type: int + capitals = ... # type: int + clamp = ... # type: int + prec = ... # type: int + rounding = ... # type: str + traps = ... # type: Dict[type, bool] def __init__(self, prec: int = None, rounding: str = None, Emin: int = None, Emax: int = None, capitals: int = None, clamp: int = None, flags=None, traps=None, _ignored_flags=None) -> None: pass diff --git a/stubs/3.2/difflib.pyi b/stubs/3.2/difflib.pyi index b5c8f62fa735..7a443685ec1c 100644 --- a/stubs/3.2/difflib.pyi +++ b/stubs/3.2/difflib.pyi @@ -3,14 +3,14 @@ # Based on https://docs.python.org/3.2/library/difflib.html from typing import ( - TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic, Undefined + TypeVar, Callable, Iterable, List, NamedTuple, Sequence, Tuple, Generic ) _T = TypeVar('_T') class SequenceMatcher(Generic[_T]): def __init__(self, isjunk: Callable[[_T], bool] = None, - a: Sequence[_T] = Undefined, b: Sequence[_T] = Undefined, + a: Sequence[_T] = ..., b: Sequence[_T] = ..., autojunk: bool = True) -> None: pass def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: pass def set_seq1(self, a: Sequence[_T]) -> None: pass diff --git a/stubs/3.2/docutils/examples.pyi b/stubs/3.2/docutils/examples.pyi index 9f960daf08d1..0abfc7b45d6e 100644 --- a/stubs/3.2/docutils/examples.pyi +++ b/stubs/3.2/docutils/examples.pyi @@ -1,3 +1,3 @@ -from typing import Undefined, Any +from typing import Any -html_parts = Undefined(Any) +html_parts = ... # type: Any diff --git a/stubs/3.2/email/_header_value_parser.pyi b/stubs/3.2/email/_header_value_parser.pyi index f0f34cd590f4..7c9dfdba29e1 100644 --- a/stubs/3.2/email/_header_value_parser.pyi +++ b/stubs/3.2/email/_header_value_parser.pyi @@ -2,30 +2,30 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any - -WSP = Undefined(Any) -CFWS_LEADER = Undefined(Any) -SPECIALS = Undefined(Any) -ATOM_ENDS = Undefined(Any) -DOT_ATOM_ENDS = Undefined(Any) -PHRASE_ENDS = Undefined(Any) -TSPECIALS = Undefined(Any) -TOKEN_ENDS = Undefined(Any) -ASPECIALS = Undefined(Any) -ATTRIBUTE_ENDS = Undefined(Any) -EXTENDED_ATTRIBUTE_ENDS = Undefined(Any) +from typing import Any + +WSP = ... # type: Any +CFWS_LEADER = ... # type: Any +SPECIALS = ... # type: Any +ATOM_ENDS = ... # type: Any +DOT_ATOM_ENDS = ... # type: Any +PHRASE_ENDS = ... # type: Any +TSPECIALS = ... # type: Any +TOKEN_ENDS = ... # type: Any +ASPECIALS = ... # type: Any +ATTRIBUTE_ENDS = ... # type: Any +EXTENDED_ATTRIBUTE_ENDS = ... # type: Any def quote_string(value): pass class _Folded: - maxlen = Undefined(Any) - policy = Undefined(Any) - lastlen = Undefined(Any) - stickyspace = Undefined(Any) - firstline = Undefined(Any) - done = Undefined(Any) - current = Undefined(Any) + maxlen = ... # type: Any + policy = ... # type: Any + lastlen = ... # type: Any + stickyspace = ... # type: Any + firstline = ... # type: Any + done = ... # type: Any + current = ... # type: Any def __init__(self, maxlen, policy): pass def newline(self): pass def finalize(self): pass @@ -33,8 +33,8 @@ class _Folded: def append_if_fits(self, token, stoken=None): pass class TokenList(list): - token_type = Undefined(Any) - defects = Undefined(Any) + token_type = ... # type: Any + defects = ... # type: Any def __init__(self, *args, **kw): pass @property def value(self): pass @@ -63,36 +63,36 @@ class WhiteSpaceTokenList(TokenList): def comments(self): pass class UnstructuredTokenList(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any def cte_encode(self, charset, policy): pass class Phrase(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any def cte_encode(self, charset, policy): pass class Word(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class CFWSList(WhiteSpaceTokenList): - token_type = Undefined(Any) + token_type = ... # type: Any def has_leading_comment(self): pass class Atom(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class Token(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class EncodedWord(TokenList): - token_type = Undefined(Any) - cte = Undefined(Any) - charset = Undefined(Any) - lang = Undefined(Any) + token_type = ... # type: Any + cte = ... # type: Any + charset = ... # type: Any + lang = ... # type: Any @property def encoded(self): pass class QuotedString(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def content(self): pass @property @@ -101,12 +101,12 @@ class QuotedString(TokenList): def stripped_value(self): pass class BareQuotedString(QuotedString): - token_type = Undefined(Any) + token_type = ... # type: Any @property def value(self): pass class Comment(WhiteSpaceTokenList): - token_type = Undefined(Any) + token_type = ... # type: Any def quote(self, value): pass @property def content(self): pass @@ -114,7 +114,7 @@ class Comment(WhiteSpaceTokenList): def comments(self): pass class AddressList(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def addresses(self): pass @property @@ -123,7 +123,7 @@ class AddressList(TokenList): def all_mailboxes(self): pass class Address(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def display_name(self): pass @property @@ -132,21 +132,21 @@ class Address(TokenList): def all_mailboxes(self): pass class MailboxList(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def mailboxes(self): pass @property def all_mailboxes(self): pass class GroupList(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def mailboxes(self): pass @property def all_mailboxes(self): pass class Group(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def mailboxes(self): pass @property @@ -155,7 +155,7 @@ class Group(TokenList): def display_name(self): pass class NameAddr(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def display_name(self): pass @property @@ -168,7 +168,7 @@ class NameAddr(TokenList): def addr_spec(self): pass class AngleAddr(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def local_part(self): pass @property @@ -179,12 +179,12 @@ class AngleAddr(TokenList): def addr_spec(self): pass class ObsRoute(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def domains(self): pass class Mailbox(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def display_name(self): pass @property @@ -197,24 +197,24 @@ class Mailbox(TokenList): def addr_spec(self): pass class InvalidMailbox(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def display_name(self): pass - local_part = Undefined(Any) + local_part = ... # type: Any class Domain(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def domain(self): pass class DotAtom(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class DotAtomText(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class AddrSpec(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def local_part(self): pass @property @@ -225,63 +225,63 @@ class AddrSpec(TokenList): def addr_spec(self): pass class ObsLocalPart(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class DisplayName(Phrase): - token_type = Undefined(Any) + token_type = ... # type: Any @property def display_name(self): pass @property def value(self): pass class LocalPart(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def value(self): pass @property def local_part(self): pass class DomainLiteral(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def domain(self): pass @property def ip(self): pass class MIMEVersion(TokenList): - token_type = Undefined(Any) - major = Undefined(Any) - minor = Undefined(Any) + token_type = ... # type: Any + major = ... # type: Any + minor = ... # type: Any class Parameter(TokenList): - token_type = Undefined(Any) - sectioned = Undefined(Any) - extended = Undefined(Any) - charset = Undefined(Any) + token_type = ... # type: Any + sectioned = ... # type: Any + extended = ... # type: Any + charset = ... # type: Any @property def section_number(self): pass @property def param_value(self): pass class InvalidParameter(Parameter): - token_type = Undefined(Any) + token_type = ... # type: Any class Attribute(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def stripped_value(self): pass class Section(TokenList): - token_type = Undefined(Any) - number = Undefined(Any) + token_type = ... # type: Any + number = ... # type: Any class Value(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def stripped_value(self): pass class MimeParameters(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any @property def params(self): pass @@ -292,27 +292,27 @@ class ParameterizedHeaderValue(TokenList): def parts(self): pass class ContentType(ParameterizedHeaderValue): - token_type = Undefined(Any) - maintype = Undefined(Any) - subtype = Undefined(Any) + token_type = ... # type: Any + maintype = ... # type: Any + subtype = ... # type: Any class ContentDisposition(ParameterizedHeaderValue): - token_type = Undefined(Any) - content_disposition = Undefined(Any) + token_type = ... # type: Any + content_disposition = ... # type: Any class ContentTransferEncoding(TokenList): - token_type = Undefined(Any) - cte = Undefined(Any) + token_type = ... # type: Any + cte = ... # type: Any class HeaderLabel(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class Header(TokenList): - token_type = Undefined(Any) + token_type = ... # type: Any class Terminal(str): - token_type = Undefined(Any) - defects = Undefined(Any) + token_type = ... # type: Any + defects = ... # type: Any def __new__(cls, value, token_type): pass @property def all_defects(self): pass @@ -328,13 +328,13 @@ class WhiteSpaceTerminal(Terminal): @property def value(self): pass def startswith_fws(self): pass - has_fws = Undefined(Any) + has_fws = ... # type: Any class ValueTerminal(Terminal): @property def value(self): pass def startswith_fws(self): pass - has_fws = Undefined(Any) + has_fws = ... # type: Any def as_encoded_word(self, charset): pass class EWWhiteSpaceTerminal(WhiteSpaceTerminal): @@ -342,11 +342,11 @@ class EWWhiteSpaceTerminal(WhiteSpaceTerminal): def value(self): pass @property def encoded(self): pass - has_fws = Undefined(Any) + has_fws = ... # type: Any -DOT = Undefined(Any) -ListSeparator = Undefined(Any) -RouteComponentMarker = Undefined(Any) +DOT = ... # type: Any +ListSeparator = ... # type: Any +RouteComponentMarker = ... # type: Any def get_fws(value): pass def get_encoded_word(value): pass diff --git a/stubs/3.2/email/_parseaddr.pyi b/stubs/3.2/email/_parseaddr.pyi index d8b38ea868bf..ae48158cf750 100644 --- a/stubs/3.2/email/_parseaddr.pyi +++ b/stubs/3.2/email/_parseaddr.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any def parsedate_tz(data): pass def parsedate(data): pass @@ -10,15 +10,15 @@ def mktime_tz(data): pass def quote(str): pass class AddrlistClass: - specials = Undefined(Any) - pos = Undefined(Any) - LWS = Undefined(Any) - CR = Undefined(Any) - FWS = Undefined(Any) - atomends = Undefined(Any) - phraseends = Undefined(Any) - field = Undefined(Any) - commentlist = Undefined(Any) + specials = ... # type: Any + pos = ... # type: Any + LWS = ... # type: Any + CR = ... # type: Any + FWS = ... # type: Any + atomends = ... # type: Any + phraseends = ... # type: Any + field = ... # type: Any + commentlist = ... # type: Any def __init__(self, field): pass def gotonext(self): pass def getaddrlist(self): pass @@ -34,7 +34,7 @@ class AddrlistClass: def getphraselist(self): pass class AddressList(AddrlistClass): - addresslist = Undefined(Any) + addresslist = ... # type: Any def __init__(self, field): pass def __len__(self): pass def __add__(self, other): pass diff --git a/stubs/3.2/email/_policybase.pyi b/stubs/3.2/email/_policybase.pyi index 279b9e4babfb..5552377168e2 100644 --- a/stubs/3.2/email/_policybase.pyi +++ b/stubs/3.2/email/_policybase.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class _PolicyBase: def __init__(self, **kw): pass @@ -11,10 +11,10 @@ class _PolicyBase: def __add__(self, other): pass class Policy(_PolicyBase): - raise_on_defect = Undefined(Any) - linesep = Undefined(Any) - cte_type = Undefined(Any) - max_line_length = Undefined(Any) + raise_on_defect = ... # type: Any + linesep = ... # type: Any + cte_type = ... # type: Any + max_line_length = ... # type: Any def handle_defect(self, obj, defect): pass def register_defect(self, obj, defect): pass def header_max_count(self, name): pass @@ -31,4 +31,4 @@ class Compat32(Policy): def fold(self, name, value): pass def fold_binary(self, name, value): pass -compat32 = Undefined(Any) +compat32 = ... # type: Any diff --git a/stubs/3.2/email/base64mime.pyi b/stubs/3.2/email/base64mime.pyi index f28a117ef03e..43b3db8bbc4c 100644 --- a/stubs/3.2/email/base64mime.pyi +++ b/stubs/3.2/email/base64mime.pyi @@ -2,12 +2,12 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any def header_length(bytearray): pass def header_encode(header_bytes, charset=''): pass -def body_encode(s, maxlinelen=76, eol=Undefined): pass +def body_encode(s, maxlinelen=76, eol=...): pass def decode(string): pass -body_decode = Undefined(Any) -decodestring = Undefined(Any) +body_decode = ... # type: Any +decodestring = ... # type: Any diff --git a/stubs/3.2/email/charset.pyi b/stubs/3.2/email/charset.pyi index 8229414e33b7..a7a1b5b5179a 100644 --- a/stubs/3.2/email/charset.pyi +++ b/stubs/3.2/email/charset.pyi @@ -2,20 +2,20 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any def add_charset(charset, header_enc=None, body_enc=None, output_charset=None): pass def add_alias(alias, canonical): pass def add_codec(charset, codecname): pass class Charset: - input_charset = Undefined(Any) - header_encoding = Undefined(Any) - body_encoding = Undefined(Any) - output_charset = Undefined(Any) - input_codec = Undefined(Any) - output_codec = Undefined(Any) - def __init__(self, input_charset=Undefined): pass + input_charset = ... # type: Any + header_encoding = ... # type: Any + body_encoding = ... # type: Any + output_charset = ... # type: Any + input_codec = ... # type: Any + output_codec = ... # type: Any + def __init__(self, input_charset=...): pass def __eq__(self, other): pass def __ne__(self, other): pass def get_body_encoding(self): pass diff --git a/stubs/3.2/email/contentmanager.pyi b/stubs/3.2/email/contentmanager.pyi index 5cf49efd8c56..aab975562a80 100644 --- a/stubs/3.2/email/contentmanager.pyi +++ b/stubs/3.2/email/contentmanager.pyi @@ -2,18 +2,18 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class ContentManager: - get_handlers = Undefined(Any) - set_handlers = Undefined(Any) + get_handlers = ... # type: Any + set_handlers = ... # type: Any def __init__(self): pass def add_get_handler(self, key, handler): pass def get_content(self, msg, *args, **kw): pass def add_set_handler(self, typekey, handler): pass def set_content(self, msg, obj, *args, **kw): pass -raw_data_manager = Undefined(Any) +raw_data_manager = ... # type: Any def get_text_content(msg, errors=''): pass def get_non_text_content(msg): pass diff --git a/stubs/3.2/email/errors.pyi b/stubs/3.2/email/errors.pyi index 0830c5798eb5..101e109bd3c3 100644 --- a/stubs/3.2/email/errors.pyi +++ b/stubs/3.2/email/errors.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class MessageError(Exception): pass class MessageParseError(MessageError): pass @@ -12,7 +12,7 @@ class MultipartConversionError(MessageError, TypeError): pass class CharsetError(MessageError): pass class MessageDefect(ValueError): - line = Undefined(Any) + line = ... # type: Any def __init__(self, line=None): pass class NoBoundaryInMultipartDefect(MessageDefect): pass @@ -22,7 +22,7 @@ class FirstHeaderLineIsContinuationDefect(MessageDefect): pass class MisplacedEnvelopeHeaderDefect(MessageDefect): pass class MissingHeaderBodySeparatorDefect(MessageDefect): pass -MalformedHeaderDefect = Undefined(Any) +MalformedHeaderDefect = ... # type: Any class MultipartInvariantViolationDefect(MessageDefect): pass class InvalidMultipartContentTransferEncodingDefect(MessageDefect): pass @@ -37,7 +37,7 @@ class InvalidHeaderDefect(HeaderDefect): pass class HeaderMissingRequiredValue(HeaderDefect): pass class NonPrintableDefect(HeaderDefect): - non_printables = Undefined(Any) + non_printables = ... # type: Any def __init__(self, non_printables): pass class ObsoleteHeaderDefect(HeaderDefect): pass diff --git a/stubs/3.2/email/feedparser.pyi b/stubs/3.2/email/feedparser.pyi index 9764f41fe72d..a0168807be19 100644 --- a/stubs/3.2/email/feedparser.pyi +++ b/stubs/3.2/email/feedparser.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class BufferedSubFile: def __init__(self): pass @@ -17,8 +17,8 @@ class BufferedSubFile: def __next__(self): pass class FeedParser: - policy = Undefined(Any) - def __init__(self, _factory=None, *, policy=Undefined): pass + policy = ... # type: Any + def __init__(self, _factory=None, *, policy=...): pass def feed(self, data): pass def close(self): pass diff --git a/stubs/3.2/email/generator.pyi b/stubs/3.2/email/generator.pyi index f1eb3ee5dad8..9f9afd301080 100644 --- a/stubs/3.2/email/generator.pyi +++ b/stubs/3.2/email/generator.pyi @@ -2,11 +2,11 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class Generator: - maxheaderlen = Undefined(Any) - policy = Undefined(Any) + maxheaderlen = ... # type: Any + policy = ... # type: Any def __init__(self, outfp, mangle_from_=True, maxheaderlen=None, *, policy=None): pass def write(self, s): pass def flatten(self, msg, unixfrom=False, linesep=None): pass diff --git a/stubs/3.2/email/headerregistry.pyi b/stubs/3.2/email/headerregistry.pyi index 12c6b255fed6..8705b694ca86 100644 --- a/stubs/3.2/email/headerregistry.pyi +++ b/stubs/3.2/email/headerregistry.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class Address: def __init__(self, display_name='', username='', domain='', addr_spec=None): pass @@ -35,17 +35,17 @@ class BaseHeader(str): def fold(self, policy): pass class UnstructuredHeader: - max_count = Undefined(Any) - value_parser = Undefined(Any) + max_count = ... # type: Any + value_parser = ... # type: Any @classmethod def parse(cls, value, kwds): pass class UniqueUnstructuredHeader(UnstructuredHeader): - max_count = Undefined(Any) + max_count = ... # type: Any class DateHeader: - max_count = Undefined(Any) - value_parser = Undefined(Any) + max_count = ... # type: Any + value_parser = ... # type: Any @classmethod def parse(cls, value, kwds): pass def init(self, *args, **kw): pass @@ -53,10 +53,10 @@ class DateHeader: def datetime(self): pass class UniqueDateHeader(DateHeader): - max_count = Undefined(Any) + max_count = ... # type: Any class AddressHeader: - max_count = Undefined(Any) + max_count = ... # type: Any @staticmethod def value_parser(value): pass @classmethod @@ -68,18 +68,18 @@ class AddressHeader: def addresses(self): pass class UniqueAddressHeader(AddressHeader): - max_count = Undefined(Any) + max_count = ... # type: Any class SingleAddressHeader(AddressHeader): @property def address(self): pass class UniqueSingleAddressHeader(SingleAddressHeader): - max_count = Undefined(Any) + max_count = ... # type: Any class MIMEVersionHeader: - max_count = Undefined(Any) - value_parser = Undefined(Any) + max_count = ... # type: Any + value_parser = ... # type: Any @classmethod def parse(cls, value, kwds): pass def init(self, *args, **kw): pass @@ -91,7 +91,7 @@ class MIMEVersionHeader: def version(self): pass class ParameterizedMIMEHeader: - max_count = Undefined(Any) + max_count = ... # type: Any @classmethod def parse(cls, value, kwds): pass def init(self, *args, **kw): pass @@ -99,7 +99,7 @@ class ParameterizedMIMEHeader: def params(self): pass class ContentTypeHeader(ParameterizedMIMEHeader): - value_parser = Undefined(Any) + value_parser = ... # type: Any def init(self, *args, **kw): pass @property def maintype(self): pass @@ -109,14 +109,14 @@ class ContentTypeHeader(ParameterizedMIMEHeader): def content_type(self): pass class ContentDispositionHeader(ParameterizedMIMEHeader): - value_parser = Undefined(Any) + value_parser = ... # type: Any def init(self, *args, **kw): pass @property def content_disposition(self): pass class ContentTransferEncodingHeader: - max_count = Undefined(Any) - value_parser = Undefined(Any) + max_count = ... # type: Any + value_parser = ... # type: Any @classmethod def parse(cls, value, kwds): pass def init(self, *args, **kw): pass @@ -124,10 +124,10 @@ class ContentTransferEncodingHeader: def cte(self): pass class HeaderRegistry: - registry = Undefined(Any) - base_class = Undefined(Any) - default_class = Undefined(Any) - def __init__(self, base_class=Undefined, default_class=Undefined, use_default_map=True): pass + registry = ... # type: Any + base_class = ... # type: Any + default_class = ... # type: Any + def __init__(self, base_class=..., default_class=..., use_default_map=True): pass def map_to_type(self, name, cls): pass def __getitem__(self, name): pass def __call__(self, name, value): pass diff --git a/stubs/3.2/email/message.pyi b/stubs/3.2/email/message.pyi index cd3e0e9ff7d5..f98d58a2d9e4 100644 --- a/stubs/3.2/email/message.pyi +++ b/stubs/3.2/email/message.pyi @@ -2,13 +2,13 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class Message: - policy = Undefined(Any) - preamble = Undefined(Any) - defects = Undefined(Any) - def __init__(self, policy=Undefined): pass + policy = ... # type: Any + preamble = ... # type: Any + defects = ... # type: Any + def __init__(self, policy=...): pass def as_string(self, unixfrom=False, maxheaderlen=0, policy=None): pass def __bytes__(self): pass def as_bytes(self, unixfrom=False, policy=None): pass @@ -56,7 +56,7 @@ class MIMEPart(Message): def __init__(self, policy=None): pass @property def is_attachment(self): pass - def get_body(self, preferencelist=Undefined): pass + def get_body(self, preferencelist=...): pass def iter_attachments(self): pass def iter_parts(self): pass def get_content(self, *args, *, content_manager=None, **kw): pass diff --git a/stubs/3.2/email/mime/application.pyi b/stubs/3.2/email/mime/application.pyi index 8d7cc5ce7743..07817fcaa822 100644 --- a/stubs/3.2/email/mime/application.pyi +++ b/stubs/3.2/email/mime/application.pyi @@ -2,8 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined from email.mime.nonmultipart import MIMENonMultipart class MIMEApplication(MIMENonMultipart): - def __init__(self, _data, _subtype='', _encoder=Undefined, **_params): pass + def __init__(self, _data, _subtype='', _encoder=..., **_params): pass diff --git a/stubs/3.2/email/mime/audio.pyi b/stubs/3.2/email/mime/audio.pyi index 5a6c48000662..ac2796698083 100644 --- a/stubs/3.2/email/mime/audio.pyi +++ b/stubs/3.2/email/mime/audio.pyi @@ -2,8 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined from email.mime.nonmultipart import MIMENonMultipart class MIMEAudio(MIMENonMultipart): - def __init__(self, _audiodata, _subtype=None, _encoder=Undefined, **_params): pass + def __init__(self, _audiodata, _subtype=None, _encoder=..., **_params): pass diff --git a/stubs/3.2/email/mime/image.pyi b/stubs/3.2/email/mime/image.pyi index 45dbcd6e1214..9add2b92a408 100644 --- a/stubs/3.2/email/mime/image.pyi +++ b/stubs/3.2/email/mime/image.pyi @@ -2,8 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined from email.mime.nonmultipart import MIMENonMultipart class MIMEImage(MIMENonMultipart): - def __init__(self, _imagedata, _subtype=None, _encoder=Undefined, **_params): pass + def __init__(self, _imagedata, _subtype=None, _encoder=..., **_params): pass diff --git a/stubs/3.2/email/parser.pyi b/stubs/3.2/email/parser.pyi index b0bd4c035529..ff6509fe9dfc 100644 --- a/stubs/3.2/email/parser.pyi +++ b/stubs/3.2/email/parser.pyi @@ -2,15 +2,15 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any import email.feedparser FeedParser = email.feedparser.FeedParser BytesFeedParser = email.feedparser.BytesFeedParser class Parser: - policy = Undefined(Any) - def __init__(self, _class=None, *, policy=Undefined): pass + policy = ... # type: Any + def __init__(self, _class=None, *, policy=...): pass def parse(self, fp, headersonly=False): pass def parsestr(self, text, headersonly=False): pass @@ -19,7 +19,7 @@ class HeaderParser(Parser): def parsestr(self, text, headersonly=True): pass class BytesParser: - parser = Undefined(Any) + parser = ... # type: Any def __init__(self, *args, **kw): pass def parse(self, fp, headersonly=False): pass def parsebytes(self, text, headersonly=False): pass diff --git a/stubs/3.2/email/policy.pyi b/stubs/3.2/email/policy.pyi index 2791ad51fb71..d6006f1bf72b 100644 --- a/stubs/3.2/email/policy.pyi +++ b/stubs/3.2/email/policy.pyi @@ -2,16 +2,16 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any import email._policybase Policy = email._policybase.Policy Compat32 = email._policybase.Compat32 class EmailPolicy(Policy): - refold_source = Undefined(Any) - header_factory = Undefined(Any) - content_manager = Undefined(Any) + refold_source = ... # type: Any + header_factory = ... # type: Any + content_manager = ... # type: Any def __init__(self, **kw): pass def header_max_count(self, name): pass def header_source_parse(self, sourcelines): pass @@ -20,7 +20,7 @@ class EmailPolicy(Policy): def fold(self, name, value): pass def fold_binary(self, name, value): pass -default = Undefined(Any) -strict = Undefined(Any) -SMTP = Undefined(Any) -HTTP = Undefined(Any) +default = ... # type: Any +strict = ... # type: Any +SMTP = ... # type: Any +HTTP = ... # type: Any diff --git a/stubs/3.2/email/quoprimime.pyi b/stubs/3.2/email/quoprimime.pyi index a719c74f6c2c..ba6f576c44eb 100644 --- a/stubs/3.2/email/quoprimime.pyi +++ b/stubs/3.2/email/quoprimime.pyi @@ -2,17 +2,17 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any def header_length(bytearray): pass def body_length(bytearray): pass def unquote(s): pass def quote(c): pass def header_encode(header_bytes, charset=''): pass -def body_encode(body, maxlinelen=76, eol=Undefined): pass -def decode(encoded, eol=Undefined): pass +def body_encode(body, maxlinelen=76, eol=...): pass +def decode(encoded, eol=...): pass -body_decode = Undefined(Any) -decodestring = Undefined(Any) +body_decode = ... # type: Any +decodestring = ... # type: Any def header_decode(s): pass diff --git a/stubs/3.2/errno.pyi b/stubs/3.2/errno.pyi index e94b7092bda8..e1f2ee311e37 100644 --- a/stubs/3.2/errno.pyi +++ b/stubs/3.2/errno.pyi @@ -2,9 +2,9 @@ # Based on http://docs.python.org/3.2/library/errno.html -from typing import Undefined, Dict +from typing import Dict -errorcode = Undefined(Dict[int, str]) +errorcode = ... # type: Dict[int, str] # TODO some of the names below are platform specific diff --git a/stubs/3.2/gettext.pyi b/stubs/3.2/gettext.pyi index 8b3f2b99e258..1e2c69ca1b70 100644 --- a/stubs/3.2/gettext.pyi +++ b/stubs/3.2/gettext.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class NullTranslations: def __init__(self, fp=None): pass @@ -18,8 +18,8 @@ class NullTranslations: def install(self, names=None): pass class GNUTranslations(NullTranslations): - LE_MAGIC = Undefined(Any) - BE_MAGIC = Undefined(Any) + LE_MAGIC = ... # type: Any + BE_MAGIC = ... # type: Any def lgettext(self, message): pass def lngettext(self, msgid1, msgid2, n): pass def gettext(self, message): pass @@ -36,4 +36,4 @@ def dngettext(domain, msgid1, msgid2, n): pass def gettext(message): pass def ngettext(msgid1, msgid2, n): pass -Catalog = Undefined(Any) +Catalog = ... # type: Any diff --git a/stubs/3.2/grp.pyi b/stubs/3.2/grp.pyi index c67618acd04b..5955a01fda7b 100644 --- a/stubs/3.2/grp.pyi +++ b/stubs/3.2/grp.pyi @@ -1,4 +1,4 @@ -from typing import List, Undefined +from typing import List # TODO group database entry object type @@ -6,7 +6,7 @@ class struct_group: gr_name = '' gr_passwd = '' gr_gid = 0 - gr_mem = Undefined(List[str]) + gr_mem = ... # type: List[str] def getgrgid(gid: int) -> struct_group: pass def getgrnam(name: str) -> struct_group: pass diff --git a/stubs/3.2/http/client.pyi b/stubs/3.2/http/client.pyi index de9cf404491e..f46fed1dd6c6 100644 --- a/stubs/3.2/http/client.pyi +++ b/stubs/3.2/http/client.pyi @@ -1,27 +1,27 @@ # Stubs for http.client (Python 3.4) -from typing import Undefined, Any, Dict +from typing import Any, Dict import email.message import io -responses = Undefined(Dict[int, str]) +responses = ... # type: Dict[int, str] class HTTPMessage(email.message.Message): def getallmatchingheaders(self, name): pass class HTTPResponse(io.RawIOBase): - fp = Undefined(Any) - debuglevel = Undefined(Any) - headers = Undefined(Any) - version = Undefined(Any) - status = Undefined(Any) - reason = Undefined(Any) - chunked = Undefined(Any) - chunk_left = Undefined(Any) - length = Undefined(Any) - will_close = Undefined(Any) + fp = ... # type: Any + debuglevel = ... # type: Any + headers = ... # type: Any + version = ... # type: Any + status = ... # type: Any + reason = ... # type: Any + chunked = ... # type: Any + chunk_left = ... # type: Any + length = ... # type: Any + will_close = ... # type: Any def __init__(self, sock, debuglevel=0, method=None, url=None): pass - code = Undefined(Any) + code = ... # type: Any def begin(self): pass def close(self): pass def flush(self): pass @@ -38,15 +38,15 @@ class HTTPResponse(io.RawIOBase): def getcode(self): pass class HTTPConnection: - response_class = Undefined(Any) - default_port = Undefined(Any) - auto_open = Undefined(Any) - debuglevel = Undefined(Any) - mss = Undefined(Any) - timeout = Undefined(Any) - source_address = Undefined(Any) - sock = Undefined(Any) - def __init__(self, host, port=None, timeout=Undefined, source_address=None): pass + response_class = ... # type: Any + default_port = ... # type: Any + auto_open = ... # type: Any + debuglevel = ... # type: Any + mss = ... # type: Any + timeout = ... # type: Any + source_address = ... # type: Any + sock = ... # type: Any + def __init__(self, host, port=None, timeout=..., source_address=None): pass def set_tunnel(self, host, port=None, headers=None): pass def set_debuglevel(self, level): pass def connect(self): pass @@ -55,16 +55,16 @@ class HTTPConnection: def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): pass def putheader(self, header, *values): pass def endheaders(self, message_body=None): pass - def request(self, method, url, body=None, headers=Undefined): pass + def request(self, method, url, body=None, headers=...): pass def getresponse(self): pass class HTTPSConnection(HTTPConnection): - default_port = Undefined(Any) - key_file = Undefined(Any) - cert_file = Undefined(Any) - def __init__(self, host, port=None, key_file=None, cert_file=None, timeout=Undefined, + default_port = ... # type: Any + key_file = ... # type: Any + cert_file = ... # type: Any + def __init__(self, host, port=None, key_file=None, cert_file=None, timeout=..., source_address=None, *, context=None, check_hostname=None): pass - sock = Undefined(Any) + sock = ... # type: Any def connect(self): pass class HTTPException(Exception): pass @@ -72,17 +72,17 @@ class NotConnected(HTTPException): pass class InvalidURL(HTTPException): pass class UnknownProtocol(HTTPException): - args = Undefined(Any) - version = Undefined(Any) + args = ... # type: Any + version = ... # type: Any def __init__(self, version): pass class UnknownTransferEncoding(HTTPException): pass class UnimplementedFileMode(HTTPException): pass class IncompleteRead(HTTPException): - args = Undefined(Any) - partial = Undefined(Any) - expected = Undefined(Any) + args = ... # type: Any + partial = ... # type: Any + expected = ... # type: Any def __init__(self, partial, expected=None): pass class ImproperConnectionState(HTTPException): pass @@ -91,8 +91,8 @@ class CannotSendHeader(ImproperConnectionState): pass class ResponseNotReady(ImproperConnectionState): pass class BadStatusLine(HTTPException): - args = Undefined(Any) - line = Undefined(Any) + args = ... # type: Any + line = ... # type: Any def __init__(self, line): pass class LineTooLong(HTTPException): diff --git a/stubs/3.2/http/cookiejar.pyi b/stubs/3.2/http/cookiejar.pyi index 368275ac8e97..680ae9c1aab2 100644 --- a/stubs/3.2/http/cookiejar.pyi +++ b/stubs/3.2/http/cookiejar.pyi @@ -2,25 +2,25 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class Cookie: - version = Undefined(Any) - name = Undefined(Any) - value = Undefined(Any) - port = Undefined(Any) - port_specified = Undefined(Any) - domain = Undefined(Any) - domain_specified = Undefined(Any) - domain_initial_dot = Undefined(Any) - path = Undefined(Any) - path_specified = Undefined(Any) - secure = Undefined(Any) - expires = Undefined(Any) - discard = Undefined(Any) - comment = Undefined(Any) - comment_url = Undefined(Any) - rfc2109 = Undefined(Any) + version = ... # type: Any + name = ... # type: Any + value = ... # type: Any + port = ... # type: Any + port_specified = ... # type: Any + domain = ... # type: Any + domain_specified = ... # type: Any + domain_initial_dot = ... # type: Any + path = ... # type: Any + path_specified = ... # type: Any + secure = ... # type: Any + expires = ... # type: Any + discard = ... # type: Any + comment = ... # type: Any + comment_url = ... # type: Any + rfc2109 = ... # type: Any def __init__(self, version, name, value, port, port_specified, domain, domain_specified, domain_initial_dot, path, path_specified, secure, expires, discard, comment, comment_url, rest, rfc2109=False): pass @@ -36,25 +36,25 @@ class CookiePolicy: def path_return_ok(self, path, request): pass class DefaultCookiePolicy(CookiePolicy): - DomainStrictNoDots = Undefined(Any) - DomainStrictNonDomain = Undefined(Any) - DomainRFC2965Match = Undefined(Any) - DomainLiberal = Undefined(Any) - DomainStrict = Undefined(Any) - netscape = Undefined(Any) - rfc2965 = Undefined(Any) - rfc2109_as_netscape = Undefined(Any) - hide_cookie2 = Undefined(Any) - strict_domain = Undefined(Any) - strict_rfc2965_unverifiable = Undefined(Any) - strict_ns_unverifiable = Undefined(Any) - strict_ns_domain = Undefined(Any) - strict_ns_set_initial_dollar = Undefined(Any) - strict_ns_set_path = Undefined(Any) + DomainStrictNoDots = ... # type: Any + DomainStrictNonDomain = ... # type: Any + DomainRFC2965Match = ... # type: Any + DomainLiberal = ... # type: Any + DomainStrict = ... # type: Any + netscape = ... # type: Any + rfc2965 = ... # type: Any + rfc2109_as_netscape = ... # type: Any + hide_cookie2 = ... # type: Any + strict_domain = ... # type: Any + strict_rfc2965_unverifiable = ... # type: Any + strict_ns_unverifiable = ... # type: Any + strict_ns_domain = ... # type: Any + strict_ns_set_initial_dollar = ... # type: Any + strict_ns_set_path = ... # type: Any def __init__(self, blocked_domains=None, allowed_domains=None, netscape=True, rfc2965=False, rfc2109_as_netscape=None, hide_cookie2=False, strict_domain=False, strict_rfc2965_unverifiable=True, strict_ns_unverifiable=False, - strict_ns_domain=Undefined, strict_ns_set_initial_dollar=False, + strict_ns_domain=..., strict_ns_set_initial_dollar=False, strict_ns_set_path=False): pass def blocked_domains(self): pass def set_blocked_domains(self, blocked_domains): pass @@ -82,12 +82,12 @@ class DefaultCookiePolicy(CookiePolicy): class Absent: pass class CookieJar: - non_word_re = Undefined(Any) - quote_re = Undefined(Any) - strict_domain_re = Undefined(Any) - domain_re = Undefined(Any) - dots_re = Undefined(Any) - magic_re = Undefined(Any) + non_word_re = ... # type: Any + quote_re = ... # type: Any + strict_domain_re = ... # type: Any + domain_re = ... # type: Any + dots_re = ... # type: Any + magic_re = ... # type: Any def __init__(self, policy=None): pass def set_policy(self, policy): pass def add_cookie_header(self, request): pass @@ -104,8 +104,8 @@ class CookieJar: class LoadError(OSError): pass class FileCookieJar(CookieJar): - filename = Undefined(Any) - delayload = Undefined(Any) + filename = ... # type: Any + delayload = ... # type: Any def __init__(self, filename=None, delayload=False, policy=None): pass def save(self, filename=None, ignore_discard=False, ignore_expires=False): pass def load(self, filename=None, ignore_discard=False, ignore_expires=False): pass @@ -116,6 +116,6 @@ class LWPCookieJar(FileCookieJar): def save(self, filename=None, ignore_discard=False, ignore_expires=False): pass class MozillaCookieJar(FileCookieJar): - magic_re = Undefined(Any) - header = Undefined(Any) + magic_re = ... # type: Any + header = ... # type: Any def save(self, filename=None, ignore_discard=False, ignore_expires=False): pass diff --git a/stubs/3.2/inspect.pyi b/stubs/3.2/inspect.pyi index 03b012eaf4c4..7161da217a01 100644 --- a/stubs/3.2/inspect.pyi +++ b/stubs/3.2/inspect.pyi @@ -1,6 +1,6 @@ # Stubs for inspect -from typing import Undefined, Any, Tuple, List, Callable +from typing import Any, Tuple, List, Callable _object = object @@ -10,10 +10,10 @@ def isclass(obj: object) -> bool: pass # namedtuple('Attribute', 'name kind defining_class object') class Attribute(tuple): - name = Undefined(str) - kind = Undefined(str) - defining_class = Undefined(type) - object = Undefined(_object) + name = ... # type: str + kind = ... # type: str + defining_class = ... # type: type + object = ... # type: _object def classify_class_attrs(cls: type) -> List[Attribute]: pass @@ -23,9 +23,9 @@ def getsourcelines(obj: object) -> Tuple[List[str], int]: pass # namedtuple('ArgSpec', 'args varargs keywords defaults') class ArgSpec(tuple): - args = Undefined(List[str]) - varargs = Undefined(str) - keywords = Undefined(str) - defaults = Undefined(tuple) + args = ... # type: List[str] + varargs = ... # type: str + keywords = ... # type: str + defaults = ... # type: tuple def getargspec(func: object) -> ArgSpec: pass diff --git a/stubs/3.2/io.pyi b/stubs/3.2/io.pyi index ea444449645e..085e0e625e4b 100644 --- a/stubs/3.2/io.pyi +++ b/stubs/3.2/io.pyi @@ -2,17 +2,15 @@ # Based on http://docs.python.org/3.2/library/io.html -DEFAULT_BUFFER_SIZE = 0 - -from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Undefined, Any +from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any import builtins import codecs import _io -DEFAULT_BUFFER_SIZE = Undefined(int) -SEEK_SET = Undefined(int) -SEEK_CUR = Undefined(int) -SEEK_END = Undefined(int) +DEFAULT_BUFFER_SIZE = 0 # type: int +SEEK_SET = ... # type: int +SEEK_CUR = ... # type: int +SEEK_END = ... # type: int open = builtins.open @@ -20,7 +18,7 @@ class BlockingIOError(OSError): pass class UnsupportedOperation(ValueError, OSError): pass class IncrementalNewlineDecoder(codecs.IncrementalDecoder): - newlines = Undefined(Any) + newlines = ... # type: Any def __init__(self, *args, **kwargs): pass def decode(self, input, final=False): pass def getstate(self): pass @@ -33,34 +31,34 @@ class BufferedIOBase(_io._BufferedIOBase, IOBase): pass class TextIOBase(_io._TextIOBase, IOBase): pass class FileIO(_io._RawIOBase): - closefd = Undefined(Any) - mode = Undefined(Any) - def __init__(self, name, mode=Undefined, closefd=Undefined, opener=Undefined): pass + closefd = ... # type: Any + mode = ... # type: Any + def __init__(self, name, mode=..., closefd=..., opener=...): pass def readinto(self, b): pass def write(self, b): pass class BufferedReader(_io._BufferedIOBase): - mode = Undefined(Any) - name = Undefined(Any) - raw = Undefined(Any) - def __init__(self, raw, buffer_size=Undefined): pass + mode = ... # type: Any + name = ... # type: Any + raw = ... # type: Any + def __init__(self, raw, buffer_size=...): pass def peek(self, size: int = -1): pass class BufferedWriter(_io._BufferedIOBase): - mode = Undefined(Any) - name = Undefined(Any) - raw = Undefined(Any) - def __init__(self, raw, buffer_size=Undefined): pass + mode = ... # type: Any + name = ... # type: Any + raw = ... # type: Any + def __init__(self, raw, buffer_size=...): pass class BufferedRWPair(_io._BufferedIOBase): - def __init__(self, reader, writer, buffer_size=Undefined): pass + def __init__(self, reader, writer, buffer_size=...): pass def peek(self, size: int = -1): pass class BufferedRandom(_io._BufferedIOBase): - mode = Undefined(Any) - name = Undefined(Any) - raw = Undefined(Any) - def __init__(self, raw, buffer_size=Undefined): pass + mode = ... # type: Any + name = ... # type: Any + raw = ... # type: Any + def __init__(self, raw, buffer_size=...): pass def peek(self, size: int = -1): pass class BytesIO(BinaryIO): diff --git a/stubs/3.2/locale.pyi b/stubs/3.2/locale.pyi index d65b21e39077..6814681e7782 100644 --- a/stubs/3.2/locale.pyi +++ b/stubs/3.2/locale.pyi @@ -8,10 +8,10 @@ def format(percent, value, grouping=False, monetary=False, *additional): pass def format_string(f, val, grouping=False): pass def currency(val, symbol=True, grouping=False, international=False): pass def str(val): pass -def atof(string, func=Undefined): pass +def atof(string, func=...): pass def atoi(str): pass def normalize(localename): pass -def getdefaultlocale(envvars=Undefined): pass -def getlocale(category=Undefined): pass -def resetlocale(category=Undefined): pass +def getdefaultlocale(envvars=...): pass +def getlocale(category=...): pass +def resetlocale(category=...): pass def getpreferredencoding(do_setlocale=True): pass diff --git a/stubs/3.2/logging/__init__.pyi b/stubs/3.2/logging/__init__.pyi index e2600e2c8d89..227b0aaf2131 100644 --- a/stubs/3.2/logging/__init__.pyi +++ b/stubs/3.2/logging/__init__.pyi @@ -2,41 +2,41 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any -CRITICAL = Undefined(Any) -FATAL = Undefined(Any) -ERROR = Undefined(Any) -WARNING = Undefined(Any) -WARN = Undefined(Any) -INFO = Undefined(Any) -DEBUG = Undefined(Any) -NOTSET = Undefined(Any) +CRITICAL = ... # type: Any +FATAL = ... # type: Any +ERROR = ... # type: Any +WARNING = ... # type: Any +WARN = ... # type: Any +INFO = ... # type: Any +DEBUG = ... # type: Any +NOTSET = ... # type: Any def getLevelName(level): pass def addLevelName(level, levelName): pass class LogRecord: - name = Undefined(Any) - msg = Undefined(Any) - args = Undefined(Any) - levelname = Undefined(Any) - levelno = Undefined(Any) - pathname = Undefined(Any) - filename = Undefined(Any) - module = Undefined(Any) - exc_info = Undefined(Any) - exc_text = Undefined(Any) - stack_info = Undefined(Any) - lineno = Undefined(Any) - funcName = Undefined(Any) - created = Undefined(Any) - msecs = Undefined(Any) - relativeCreated = Undefined(Any) - thread = Undefined(Any) - threadName = Undefined(Any) - processName = Undefined(Any) - process = Undefined(Any) + name = ... # type: Any + msg = ... # type: Any + args = ... # type: Any + levelname = ... # type: Any + levelno = ... # type: Any + pathname = ... # type: Any + filename = ... # type: Any + module = ... # type: Any + exc_info = ... # type: Any + exc_text = ... # type: Any + stack_info = ... # type: Any + lineno = ... # type: Any + funcName = ... # type: Any + created = ... # type: Any + msecs = ... # type: Any + relativeCreated = ... # type: Any + thread = ... # type: Any + threadName = ... # type: Any + processName = ... # type: Any + process = ... # type: Any def __init__(self, name, level, pathname, lineno, msg, args, exc_info, func=None, sinfo=None, **kwargs): pass def getMessage(self): pass @@ -46,35 +46,35 @@ def getLogRecordFactory(): pass def makeLogRecord(dict): pass class PercentStyle: - default_format = Undefined(Any) - asctime_format = Undefined(Any) - asctime_search = Undefined(Any) + default_format = ... # type: Any + asctime_format = ... # type: Any + asctime_search = ... # type: Any def __init__(self, fmt): pass def usesTime(self): pass def format(self, record): pass class StrFormatStyle(PercentStyle): - default_format = Undefined(Any) - asctime_format = Undefined(Any) - asctime_search = Undefined(Any) + default_format = ... # type: Any + asctime_format = ... # type: Any + asctime_search = ... # type: Any def format(self, record): pass class StringTemplateStyle(PercentStyle): - default_format = Undefined(Any) - asctime_format = Undefined(Any) - asctime_search = Undefined(Any) + default_format = ... # type: Any + asctime_format = ... # type: Any + asctime_search = ... # type: Any def __init__(self, fmt): pass def usesTime(self): pass def format(self, record): pass -BASIC_FORMAT = Undefined(Any) +BASIC_FORMAT = ... # type: Any class Formatter: - converter = Undefined(Any) - datefmt = Undefined(Any) + converter = ... # type: Any + datefmt = ... # type: Any def __init__(self, fmt=None, datefmt=None, style=''): pass - default_time_format = Undefined(Any) - default_msec_format = Undefined(Any) + default_time_format = ... # type: Any + default_msec_format = ... # type: Any def formatTime(self, record, datefmt=None): pass def formatException(self, ei): pass def usesTime(self): pass @@ -83,33 +83,33 @@ class Formatter: def format(self, record): pass class BufferingFormatter: - linefmt = Undefined(Any) + linefmt = ... # type: Any def __init__(self, linefmt=None): pass def formatHeader(self, records): pass def formatFooter(self, records): pass def format(self, records): pass class Filter: - name = Undefined(Any) - nlen = Undefined(Any) + name = ... # type: Any + nlen = ... # type: Any def __init__(self, name=''): pass def filter(self, record): pass class Filterer: - filters = Undefined(Any) + filters = ... # type: Any def __init__(self): pass def addFilter(self, filter): pass def removeFilter(self, filter): pass def filter(self, record): pass class Handler(Filterer): - level = Undefined(Any) - formatter = Undefined(Any) - def __init__(self, level=Undefined): pass + level = ... # type: Any + formatter = ... # type: Any + def __init__(self, level=...): pass def get_name(self): pass def set_name(self, name): pass - name = Undefined(Any) - lock = Undefined(Any) + name = ... # type: Any + lock = ... # type: Any def createLock(self): pass def acquire(self): pass def release(self): pass @@ -123,29 +123,29 @@ class Handler(Filterer): def handleError(self, record): pass class StreamHandler(Handler): - terminator = Undefined(Any) - stream = Undefined(Any) + terminator = ... # type: Any + stream = ... # type: Any def __init__(self, stream=None): pass def flush(self): pass def emit(self, record): pass class FileHandler(StreamHandler): - baseFilename = Undefined(Any) - mode = Undefined(Any) - encoding = Undefined(Any) - delay = Undefined(Any) - stream = Undefined(Any) + baseFilename = ... # type: Any + mode = ... # type: Any + encoding = ... # type: Any + delay = ... # type: Any + stream = ... # type: Any def __init__(self, filename, mode='', encoding=None, delay=False): pass def close(self): pass def emit(self, record): pass class _StderrHandler(StreamHandler): - def __init__(self, level=Undefined): pass + def __init__(self, level=...): pass -lastResort = Undefined(Any) +lastResort = ... # type: Any class PlaceHolder: - loggerMap = Undefined(Any) + loggerMap = ... # type: Any def __init__(self, alogger): pass def append(self, alogger): pass @@ -153,25 +153,25 @@ def setLoggerClass(klass): pass def getLoggerClass(): pass class Manager: - root = Undefined(Any) - disable = Undefined(Any) - emittedNoHandlerWarning = Undefined(Any) - loggerDict = Undefined(Any) - loggerClass = Undefined(Any) - logRecordFactory = Undefined(Any) + root = ... # type: Any + disable = ... # type: Any + emittedNoHandlerWarning = ... # type: Any + loggerDict = ... # type: Any + loggerClass = ... # type: Any + logRecordFactory = ... # type: Any def __init__(self, rootnode): pass def getLogger(self, name): pass def setLoggerClass(self, klass): pass def setLogRecordFactory(self, factory): pass class Logger(Filterer): - name = Undefined(Any) - level = Undefined(Any) - parent = Undefined(Any) - propagate = Undefined(Any) - handlers = Undefined(Any) - disabled = Undefined(Any) - def __init__(self, name, level=Undefined): pass + name = ... # type: Any + level = ... # type: Any + parent = ... # type: Any + propagate = ... # type: Any + handlers = ... # type: Any + disabled = ... # type: Any + def __init__(self, name, level=...): pass def setLevel(self, level): pass def debug(self, msg, *args, **kwargs): pass def info(self, msg, *args, **kwargs): pass @@ -180,7 +180,7 @@ class Logger(Filterer): def error(self, msg, *args, **kwargs): pass def exception(self, msg, *args, **kwargs): pass def critical(self, msg, *args, **kwargs): pass - fatal = Undefined(Any) + fatal = ... # type: Any def log(self, level, msg, *args, **kwargs): pass def findCaller(self, stack_info=False): pass def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, @@ -198,8 +198,8 @@ class RootLogger(Logger): def __init__(self, level): pass class LoggerAdapter: - logger = Undefined(Any) - extra = Undefined(Any) + logger = ... # type: Any + extra = ... # type: Any def __init__(self, logger, extra): pass def process(self, msg, kwargs): pass def debug(self, msg, *args, **kwargs): pass @@ -219,7 +219,7 @@ def basicConfig(**kwargs): pass def getLogger(name=None): pass def critical(msg, *args, **kwargs): pass -fatal = Undefined(Any) +fatal = ... # type: Any def error(msg, *args, **kwargs): pass def exception(msg, *args, **kwargs): pass @@ -233,7 +233,7 @@ def disable(level): pass class NullHandler(Handler): def handle(self, record): pass def emit(self, record): pass - lock = Undefined(Any) + lock = ... # type: Any def createLock(self): pass def captureWarnings(capture): pass diff --git a/stubs/3.2/logging/handlers.pyi b/stubs/3.2/logging/handlers.pyi index 2b4ba5b75788..2a8012dee7eb 100644 --- a/stubs/3.2/logging/handlers.pyi +++ b/stubs/3.2/logging/handlers.pyi @@ -2,72 +2,72 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any import logging -threading = Undefined(Any) -DEFAULT_TCP_LOGGING_PORT = Undefined(Any) -DEFAULT_UDP_LOGGING_PORT = Undefined(Any) -DEFAULT_HTTP_LOGGING_PORT = Undefined(Any) -DEFAULT_SOAP_LOGGING_PORT = Undefined(Any) -SYSLOG_UDP_PORT = Undefined(Any) -SYSLOG_TCP_PORT = Undefined(Any) +threading = ... # type: Any +DEFAULT_TCP_LOGGING_PORT = ... # type: Any +DEFAULT_UDP_LOGGING_PORT = ... # type: Any +DEFAULT_HTTP_LOGGING_PORT = ... # type: Any +DEFAULT_SOAP_LOGGING_PORT = ... # type: Any +SYSLOG_UDP_PORT = ... # type: Any +SYSLOG_TCP_PORT = ... # type: Any class BaseRotatingHandler(logging.FileHandler): - mode = Undefined(Any) - encoding = Undefined(Any) - namer = Undefined(Any) - rotator = Undefined(Any) + mode = ... # type: Any + encoding = ... # type: Any + namer = ... # type: Any + rotator = ... # type: Any def __init__(self, filename, mode, encoding=None, delay=False): pass def emit(self, record): pass def rotation_filename(self, default_name): pass def rotate(self, source, dest): pass class RotatingFileHandler(BaseRotatingHandler): - maxBytes = Undefined(Any) - backupCount = Undefined(Any) + maxBytes = ... # type: Any + backupCount = ... # type: Any def __init__(self, filename, mode='', maxBytes=0, backupCount=0, encoding=None, delay=False): pass - stream = Undefined(Any) + stream = ... # type: Any def doRollover(self): pass def shouldRollover(self, record): pass class TimedRotatingFileHandler(BaseRotatingHandler): - when = Undefined(Any) - backupCount = Undefined(Any) - utc = Undefined(Any) - atTime = Undefined(Any) - interval = Undefined(Any) - suffix = Undefined(Any) - extMatch = Undefined(Any) - dayOfWeek = Undefined(Any) - rolloverAt = Undefined(Any) + when = ... # type: Any + backupCount = ... # type: Any + utc = ... # type: Any + atTime = ... # type: Any + interval = ... # type: Any + suffix = ... # type: Any + extMatch = ... # type: Any + dayOfWeek = ... # type: Any + rolloverAt = ... # type: Any def __init__(self, filename, when='', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None): pass def computeRollover(self, currentTime): pass def shouldRollover(self, record): pass def getFilesToDelete(self): pass - stream = Undefined(Any) + stream = ... # type: Any def doRollover(self): pass class WatchedFileHandler(logging.FileHandler): def __init__(self, filename, mode='', encoding=None, delay=False): pass - stream = Undefined(Any) + stream = ... # type: Any def emit(self, record): pass class SocketHandler(logging.Handler): - host = Undefined(Any) - port = Undefined(Any) - address = Undefined(Any) - sock = Undefined(Any) - closeOnError = Undefined(Any) - retryTime = Undefined(Any) - retryStart = Undefined(Any) - retryMax = Undefined(Any) - retryFactor = Undefined(Any) + host = ... # type: Any + port = ... # type: Any + address = ... # type: Any + sock = ... # type: Any + closeOnError = ... # type: Any + retryTime = ... # type: Any + retryStart = ... # type: Any + retryMax = ... # type: Any + retryFactor = ... # type: Any def __init__(self, host, port): pass def makeSocket(self, timeout=1): pass - retryPeriod = Undefined(Any) + retryPeriod = ... # type: Any def createSocket(self): pass def send(self, s): pass def makePickle(self, record): pass @@ -76,75 +76,75 @@ class SocketHandler(logging.Handler): def close(self): pass class DatagramHandler(SocketHandler): - closeOnError = Undefined(Any) + closeOnError = ... # type: Any def __init__(self, host, port): pass def makeSocket(self, timeout=1): pass # TODO: Actually does not have the timeout argument. def send(self, s): pass class SysLogHandler(logging.Handler): - LOG_EMERG = Undefined(Any) - LOG_ALERT = Undefined(Any) - LOG_CRIT = Undefined(Any) - LOG_ERR = Undefined(Any) - LOG_WARNING = Undefined(Any) - LOG_NOTICE = Undefined(Any) - LOG_INFO = Undefined(Any) - LOG_DEBUG = Undefined(Any) - LOG_KERN = Undefined(Any) - LOG_USER = Undefined(Any) - LOG_MAIL = Undefined(Any) - LOG_DAEMON = Undefined(Any) - LOG_AUTH = Undefined(Any) - LOG_SYSLOG = Undefined(Any) - LOG_LPR = Undefined(Any) - LOG_NEWS = Undefined(Any) - LOG_UUCP = Undefined(Any) - LOG_CRON = Undefined(Any) - LOG_AUTHPRIV = Undefined(Any) - LOG_FTP = Undefined(Any) - LOG_LOCAL0 = Undefined(Any) - LOG_LOCAL1 = Undefined(Any) - LOG_LOCAL2 = Undefined(Any) - LOG_LOCAL3 = Undefined(Any) - LOG_LOCAL4 = Undefined(Any) - LOG_LOCAL5 = Undefined(Any) - LOG_LOCAL6 = Undefined(Any) - LOG_LOCAL7 = Undefined(Any) - priority_names = Undefined(Any) - facility_names = Undefined(Any) - priority_map = Undefined(Any) - address = Undefined(Any) - facility = Undefined(Any) - socktype = Undefined(Any) - unixsocket = Undefined(Any) - socket = Undefined(Any) - formatter = Undefined(Any) - def __init__(self, address=Undefined, facility=Undefined, socktype=None): pass + LOG_EMERG = ... # type: Any + LOG_ALERT = ... # type: Any + LOG_CRIT = ... # type: Any + LOG_ERR = ... # type: Any + LOG_WARNING = ... # type: Any + LOG_NOTICE = ... # type: Any + LOG_INFO = ... # type: Any + LOG_DEBUG = ... # type: Any + LOG_KERN = ... # type: Any + LOG_USER = ... # type: Any + LOG_MAIL = ... # type: Any + LOG_DAEMON = ... # type: Any + LOG_AUTH = ... # type: Any + LOG_SYSLOG = ... # type: Any + LOG_LPR = ... # type: Any + LOG_NEWS = ... # type: Any + LOG_UUCP = ... # type: Any + LOG_CRON = ... # type: Any + LOG_AUTHPRIV = ... # type: Any + LOG_FTP = ... # type: Any + LOG_LOCAL0 = ... # type: Any + LOG_LOCAL1 = ... # type: Any + LOG_LOCAL2 = ... # type: Any + LOG_LOCAL3 = ... # type: Any + LOG_LOCAL4 = ... # type: Any + LOG_LOCAL5 = ... # type: Any + LOG_LOCAL6 = ... # type: Any + LOG_LOCAL7 = ... # type: Any + priority_names = ... # type: Any + facility_names = ... # type: Any + priority_map = ... # type: Any + address = ... # type: Any + facility = ... # type: Any + socktype = ... # type: Any + unixsocket = ... # type: Any + socket = ... # type: Any + formatter = ... # type: Any + def __init__(self, address=..., facility=..., socktype=None): pass def encodePriority(self, facility, priority): pass def close(self): pass def mapPriority(self, levelName): pass - ident = Undefined(Any) - append_nul = Undefined(Any) + ident = ... # type: Any + append_nul = ... # type: Any def emit(self, record): pass class SMTPHandler(logging.Handler): - username = Undefined(Any) - fromaddr = Undefined(Any) - toaddrs = Undefined(Any) - subject = Undefined(Any) - secure = Undefined(Any) - timeout = Undefined(Any) + username = ... # type: Any + fromaddr = ... # type: Any + toaddrs = ... # type: Any + subject = ... # type: Any + secure = ... # type: Any + timeout = ... # type: Any def __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None, timeout=0.0): pass def getSubject(self, record): pass def emit(self, record): pass class NTEventLogHandler(logging.Handler): - appname = Undefined(Any) - dllname = Undefined(Any) - logtype = Undefined(Any) - deftype = Undefined(Any) - typemap = Undefined(Any) + appname = ... # type: Any + dllname = ... # type: Any + logtype = ... # type: Any + deftype = ... # type: Any + typemap = ... # type: Any def __init__(self, appname, dllname=None, logtype=''): pass def getMessageID(self, record): pass def getEventCategory(self, record): pass @@ -153,18 +153,18 @@ class NTEventLogHandler(logging.Handler): def close(self): pass class HTTPHandler(logging.Handler): - host = Undefined(Any) - url = Undefined(Any) - method = Undefined(Any) - secure = Undefined(Any) - credentials = Undefined(Any) + host = ... # type: Any + url = ... # type: Any + method = ... # type: Any + secure = ... # type: Any + credentials = ... # type: Any def __init__(self, host, url, method='', secure=False, credentials=None): pass def mapLogRecord(self, record): pass def emit(self, record): pass class BufferingHandler(logging.Handler): - capacity = Undefined(Any) - buffer = Undefined(Any) + capacity = ... # type: Any + buffer = ... # type: Any def __init__(self, capacity): pass def shouldFlush(self, record): pass def emit(self, record): pass @@ -172,25 +172,25 @@ class BufferingHandler(logging.Handler): def close(self): pass class MemoryHandler(BufferingHandler): - flushLevel = Undefined(Any) - target = Undefined(Any) - def __init__(self, capacity, flushLevel=Undefined, target=None): pass + flushLevel = ... # type: Any + target = ... # type: Any + def __init__(self, capacity, flushLevel=..., target=None): pass def shouldFlush(self, record): pass def setTarget(self, target): pass - buffer = Undefined(Any) + buffer = ... # type: Any def flush(self): pass def close(self): pass class QueueHandler(logging.Handler): - queue = Undefined(Any) + queue = ... # type: Any def __init__(self, queue): pass def enqueue(self, record): pass def prepare(self, record): pass def emit(self, record): pass class QueueListener: - queue = Undefined(Any) - handlers = Undefined(Any) + queue = ... # type: Any + handlers = ... # type: Any def __init__(self, queue, *handlers): pass def dequeue(self, block): pass def start(self): pass diff --git a/stubs/3.2/os/__init__.pyi b/stubs/3.2/os/__init__.pyi index f1946fb5bff9..43547b22310b 100644 --- a/stubs/3.2/os/__init__.pyi +++ b/stubs/3.2/os/__init__.pyi @@ -4,7 +4,7 @@ # based on http://docs.python.org/3.2/library/os.html from typing import ( - Undefined, Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr, + Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr, Optional, Generic ) from builtins import OSError as error @@ -64,12 +64,12 @@ X_OK = 0 class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): def copy(self) -> _Environ[AnyStr]: pass -environ = Undefined(_Environ[str]) -environb = Undefined(_Environ[bytes]) +environ = ... # type: _Environ[str] +environb = ... # type: _Environ[bytes] -confstr_names = Undefined(Dict[str, int]) # Unix only -pathconf_names = Undefined(Dict[str, int]) # Unix only -sysconf_names = Undefined(Dict[str, int]) # Unix only +confstr_names = ... # type: Dict[str, int] # Unix only +pathconf_names = ... # type: Dict[str, int] # Unix only +sysconf_names = ... # type: Dict[str, int] # Unix only EX_OK = 0 # Unix only EX_USAGE = 0 # Unix only diff --git a/stubs/3.2/re.pyi b/stubs/3.2/re.pyi index 87b0979d85bd..e0923a579dc5 100644 --- a/stubs/3.2/re.pyi +++ b/stubs/3.2/re.pyi @@ -6,7 +6,7 @@ # and http://hg.python.org/cpython/file/618ea5612e83/Lib/re.py from typing import ( - Undefined, List, Iterator, Callable, Tuple, Sequence, Dict, Union, + List, Iterator, Callable, Tuple, Sequence, Dict, Union, Generic, AnyStr, Match, Pattern ) diff --git a/stubs/3.2/requests/__init__.pyi b/stubs/3.2/requests/__init__.pyi index 59ecea193e34..65ddc1cefe0e 100644 --- a/stubs/3.2/requests/__init__.pyi +++ b/stubs/3.2/requests/__init__.pyi @@ -1,6 +1,6 @@ # Stubs for requests (based on version 2.6.0, Python 3) -from typing import Undefined, Any +from typing import Any from . import models from . import api from . import sessions @@ -8,10 +8,10 @@ from . import status_codes from . import exceptions import logging -__title__ = Undefined(Any) -__build__ = Undefined(Any) -__license__ = Undefined(Any) -__copyright__ = Undefined(Any) +__title__ = ... # type: Any +__build__ = ... # type: Any +__license__ = ... # type: Any +__copyright__ = ... # type: Any Request = models.Request Response = models.Response diff --git a/stubs/3.2/requests/adapters.pyi b/stubs/3.2/requests/adapters.pyi index 6a881c685c02..fbd3e985f6b3 100644 --- a/stubs/3.2/requests/adapters.pyi +++ b/stubs/3.2/requests/adapters.pyi @@ -1,6 +1,6 @@ # Stubs for requests.adapters (Python 3) -from typing import Undefined, Any +from typing import Any from . import models from .packages.urllib3 import poolmanager from .packages.urllib3 import response @@ -37,9 +37,9 @@ SSLError = exceptions.SSLError ProxyError = exceptions.ProxyError RetryError = exceptions.RetryError -DEFAULT_POOLBLOCK = Undefined(Any) -DEFAULT_POOLSIZE = Undefined(Any) -DEFAULT_RETRIES = Undefined(Any) +DEFAULT_POOLBLOCK = ... # type: Any +DEFAULT_POOLSIZE = ... # type: Any +DEFAULT_RETRIES = ... # type: Any class BaseAdapter: def __init__(self): pass @@ -48,14 +48,14 @@ class BaseAdapter: def close(self): pass class HTTPAdapter(BaseAdapter): - __attrs__ = Undefined(Any) - max_retries = Undefined(Any) - config = Undefined(Any) - proxy_manager = Undefined(Any) - def __init__(self, pool_connections=Undefined, pool_maxsize=Undefined, max_retries=Undefined, - pool_block=Undefined): pass - poolmanager = Undefined(Any) - def init_poolmanager(self, connections, maxsize, block=Undefined, **pool_kwargs): pass + __attrs__ = ... # type: Any + max_retries = ... # type: Any + config = ... # type: Any + proxy_manager = ... # type: Any + def __init__(self, pool_connections=..., pool_maxsize=..., max_retries=..., + pool_block=...): pass + poolmanager = ... # type: Any + def init_poolmanager(self, connections, maxsize, block=..., **pool_kwargs): pass def proxy_manager_for(self, proxy, **proxy_kwargs): pass def cert_verify(self, conn, url, verify, cert): pass def build_response(self, req, resp): pass diff --git a/stubs/3.2/requests/auth.pyi b/stubs/3.2/requests/auth.pyi index c863dcecda37..bcbc83a8f8cb 100644 --- a/stubs/3.2/requests/auth.pyi +++ b/stubs/3.2/requests/auth.pyi @@ -1,6 +1,6 @@ # Stubs for requests.auth (Python 3) -from typing import Undefined, Any +from typing import Any from . import compat from . import cookies from . import utils @@ -11,15 +11,15 @@ parse_dict_header = utils.parse_dict_header to_native_string = utils.to_native_string codes = status_codes.codes -CONTENT_TYPE_FORM_URLENCODED = Undefined(Any) -CONTENT_TYPE_MULTI_PART = Undefined(Any) +CONTENT_TYPE_FORM_URLENCODED = ... # type: Any +CONTENT_TYPE_MULTI_PART = ... # type: Any class AuthBase: def __call__(self, r): pass class HTTPBasicAuth(AuthBase): - username = Undefined(Any) - password = Undefined(Any) + username = ... # type: Any + password = ... # type: Any def __init__(self, username, password): pass def __call__(self, r): pass @@ -27,13 +27,13 @@ class HTTPProxyAuth(HTTPBasicAuth): def __call__(self, r): pass class HTTPDigestAuth(AuthBase): - username = Undefined(Any) - password = Undefined(Any) - last_nonce = Undefined(Any) - nonce_count = Undefined(Any) - chal = Undefined(Any) - pos = Undefined(Any) - num_401_calls = Undefined(Any) + username = ... # type: Any + password = ... # type: Any + last_nonce = ... # type: Any + nonce_count = ... # type: Any + chal = ... # type: Any + pos = ... # type: Any + num_401_calls = ... # type: Any def __init__(self, username, password): pass def build_digest_header(self, method, url): pass def handle_redirect(self, r, **kwargs): pass diff --git a/stubs/3.2/requests/compat.pyi b/stubs/3.2/requests/compat.pyi index 614b128179ed..63b92f6fef32 100644 --- a/stubs/3.2/requests/compat.pyi +++ b/stubs/3.2/requests/compat.pyi @@ -1,6 +1,6 @@ # Stubs for requests.compat (Python 3.4) -from typing import Any, Undefined +from typing import Any import collections OrderedDict = collections.OrderedDict diff --git a/stubs/3.2/requests/cookies.pyi b/stubs/3.2/requests/cookies.pyi index f610fbff8aa6..47a8371313cc 100644 --- a/stubs/3.2/requests/cookies.pyi +++ b/stubs/3.2/requests/cookies.pyi @@ -1,6 +1,6 @@ # Stubs for requests.cookies (Python 3) -from typing import Undefined, Any, MutableMapping +from typing import Any, MutableMapping #import cookielib from http import cookiejar as cookielib import collections @@ -9,7 +9,7 @@ from . import compat #cookielib = compat.cookielib class MockRequest: - type = Undefined(Any) + type = ... # type: Any def __init__(self, request): pass def get_type(self): pass def get_host(self): pass diff --git a/stubs/3.2/requests/exceptions.pyi b/stubs/3.2/requests/exceptions.pyi index 07ebb5ea072c..6a7e210cf7bf 100644 --- a/stubs/3.2/requests/exceptions.pyi +++ b/stubs/3.2/requests/exceptions.pyi @@ -1,11 +1,11 @@ # Stubs for requests.exceptions (Python 3) -from typing import Undefined, Any +from typing import Any from .packages.urllib3.exceptions import HTTPError as BaseHTTPError class RequestException(IOError): - response = Undefined(Any) - request = Undefined(Any) + response = ... # type: Any + request = ... # type: Any def __init__(self, *args, **kwargs): pass class HTTPError(RequestException): pass diff --git a/stubs/3.2/requests/hooks.pyi b/stubs/3.2/requests/hooks.pyi index 649f697dad12..c7c8bb1a0164 100644 --- a/stubs/3.2/requests/hooks.pyi +++ b/stubs/3.2/requests/hooks.pyi @@ -1,8 +1,8 @@ # Stubs for requests.hooks (Python 3) -from typing import Undefined, Any +from typing import Any -HOOKS = Undefined(Any) +HOOKS = ... # type: Any def default_hooks(): pass def dispatch_hook(key, hooks, hook_data, **kwargs): pass diff --git a/stubs/3.2/requests/models.pyi b/stubs/3.2/requests/models.pyi index e313f5231825..8105f77744ca 100644 --- a/stubs/3.2/requests/models.pyi +++ b/stubs/3.2/requests/models.pyi @@ -1,6 +1,6 @@ # Stubs for requests.models (Python 3) -from typing import Undefined, Any, List, MutableMapping, Iterator, Dict +from typing import Any, List, MutableMapping, Iterator, Dict import datetime from . import hooks @@ -48,11 +48,11 @@ super_len = utils.super_len to_native_string = utils.to_native_string codes = status_codes.codes -REDIRECT_STATI = Undefined(Any) -DEFAULT_REDIRECT_LIMIT = Undefined(Any) -CONTENT_CHUNK_SIZE = Undefined(Any) -ITER_CHUNK_SIZE = Undefined(Any) -json_dumps = Undefined(Any) +REDIRECT_STATI = ... # type: Any +DEFAULT_REDIRECT_LIMIT = ... # type: Any +CONTENT_CHUNK_SIZE = ... # type: Any +ITER_CHUNK_SIZE = ... # type: Any +json_dumps = ... # type: Any class RequestEncodingMixin: @property @@ -63,26 +63,26 @@ class RequestHooksMixin: def deregister_hook(self, event, hook): pass class Request(RequestHooksMixin): - hooks = Undefined(Any) - method = Undefined(Any) - url = Undefined(Any) - headers = Undefined(Any) - files = Undefined(Any) - data = Undefined(Any) - json = Undefined(Any) - params = Undefined(Any) - auth = Undefined(Any) - cookies = Undefined(Any) + hooks = ... # type: Any + method = ... # type: Any + url = ... # type: Any + headers = ... # type: Any + files = ... # type: Any + data = ... # type: Any + json = ... # type: Any + params = ... # type: Any + auth = ... # type: Any + cookies = ... # type: Any def __init__(self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None): pass def prepare(self): pass class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): - method = Undefined(Any) - url = Undefined(Any) - headers = Undefined(Any) - body = Undefined(Any) - hooks = Undefined(Any) + method = ... # type: Any + url = ... # type: Any + headers = ... # type: Any + body = ... # type: Any + hooks = ... # type: Any def __init__(self): pass def prepare(self, method=None, url=None, headers=None, files=None, data=None, params=None, auth=None, cookies=None, hooks=None, json=None): pass @@ -97,17 +97,17 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): def prepare_hooks(self, hooks): pass class Response: - __attrs__ = Undefined(Any) - status_code = Undefined(int) - headers = Undefined(MutableMapping[str, str]) - raw = Undefined(Any) - url = Undefined(str) - encoding = Undefined(str) - history = Undefined(List[Response]) - reason = Undefined(str) - cookies = Undefined(RequestsCookieJar) - elapsed = Undefined(datetime.timedelta) - request = Undefined(PreparedRequest) + __attrs__ = ... # type: Any + status_code = ... # type: int + headers = ... # type: MutableMapping[str, str] + raw = ... # type: Any + url = ... # type: str + encoding = ... # type: str + history = ... # type: List[Response] + reason = ... # type: str + cookies = ... # type: RequestsCookieJar + elapsed = ... # type: datetime.timedelta + request = ... # type: PreparedRequest def __init__(self) -> None: pass def __bool__(self) -> bool: pass def __nonzero__(self) -> bool: pass @@ -122,7 +122,7 @@ class Response: def apparent_encoding(self) -> str: pass def iter_content(self, chunk_size: int = 1, decode_unicode: bool = False) -> Iterator[Any]: pass - def iter_lines(self, chunk_size=Undefined, decode_unicode=None, delimiter=None): pass + def iter_lines(self, chunk_size=..., decode_unicode=None, delimiter=None): pass @property def content(self) -> bytes: pass @property diff --git a/stubs/3.2/requests/packages/urllib3/__init__.pyi b/stubs/3.2/requests/packages/urllib3/__init__.pyi index 88468babc4b0..a5afc4e19ca3 100644 --- a/stubs/3.2/requests/packages/urllib3/__init__.pyi +++ b/stubs/3.2/requests/packages/urllib3/__init__.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from . import connectionpool from . import filepost from . import poolmanager @@ -13,7 +13,7 @@ from .util import timeout from .util import retry import logging -__license__ = Undefined(Any) +__license__ = ... # type: Any HTTPConnectionPool = connectionpool.HTTPConnectionPool HTTPSConnectionPool = connectionpool.HTTPSConnectionPool @@ -31,5 +31,5 @@ Retry = retry.Retry class NullHandler(logging.Handler): def emit(self, record): pass -def add_stderr_logger(level=Undefined): pass -def disable_warnings(category=Undefined): pass +def add_stderr_logger(level=...): pass +def disable_warnings(category=...): pass diff --git a/stubs/3.2/requests/packages/urllib3/_collections.pyi b/stubs/3.2/requests/packages/urllib3/_collections.pyi index 5accaf796f07..1c6bbdf76f62 100644 --- a/stubs/3.2/requests/packages/urllib3/_collections.pyi +++ b/stubs/3.2/requests/packages/urllib3/_collections.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from collections import MutableMapping class RLock: @@ -10,9 +10,9 @@ class RLock: def __exit__(self, exc_type, exc_value, traceback): pass class RecentlyUsedContainer(MutableMapping): - ContainerCls = Undefined(Any) - dispose_func = Undefined(Any) - lock = Undefined(Any) + ContainerCls = ... # type: Any + dispose_func = ... # type: Any + lock = ... # type: Any def __init__(self, maxsize=10, dispose_func=None): pass def __getitem__(self, key): pass def __setitem__(self, key, value): pass @@ -30,22 +30,22 @@ class HTTPHeaderDict(dict): def __contains__(self, key): pass def __eq__(self, other): pass def __ne__(self, other): pass - values = Undefined(Any) - get = Undefined(Any) - update = Undefined(Any) - iterkeys = Undefined(Any) - itervalues = Undefined(Any) - def pop(self, key, default=Undefined): pass + values = ... # type: Any + get = ... # type: Any + update = ... # type: Any + iterkeys = ... # type: Any + itervalues = ... # type: Any + def pop(self, key, default=...): pass def discard(self, key): pass def add(self, key, val): pass def extend(*args, **kwargs): pass def getlist(self, key): pass - getheaders = Undefined(Any) - getallmatchingheaders = Undefined(Any) - iget = Undefined(Any) + getheaders = ... # type: Any + getallmatchingheaders = ... # type: Any + iget = ... # type: Any def copy(self): pass def iteritems(self): pass def itermerged(self): pass def items(self): pass @classmethod - def from_httplib(cls, message, duplicates=Undefined): pass + def from_httplib(cls, message, duplicates=...): pass diff --git a/stubs/3.2/requests/packages/urllib3/connection.pyi b/stubs/3.2/requests/packages/urllib3/connection.pyi index e1a07e974eaf..a72f501c2088 100644 --- a/stubs/3.2/requests/packages/urllib3/connection.pyi +++ b/stubs/3.2/requests/packages/urllib3/connection.pyi @@ -1,6 +1,6 @@ # Stubs for requests.packages.urllib3.connection (Python 3.4) -from typing import Undefined, Any +from typing import Any from . import packages from http.client import HTTPConnection as _HTTPConnection # from httplib import HTTPConnection as _HTTPConnection # python 2 @@ -27,38 +27,38 @@ ssl_wrap_socket = ssl_.ssl_wrap_socket assert_fingerprint = ssl_.assert_fingerprint connection = util.connection -port_by_scheme = Undefined(Any) -RECENT_DATE = Undefined(Any) +port_by_scheme = ... # type: Any +RECENT_DATE = ... # type: Any class HTTPConnection(_HTTPConnection): - default_port = Undefined(Any) - default_socket_options = Undefined(Any) - is_verified = Undefined(Any) - source_address = Undefined(Any) - socket_options = Undefined(Any) + default_port = ... # type: Any + default_socket_options = ... # type: Any + is_verified = ... # type: Any + source_address = ... # type: Any + socket_options = ... # type: Any def __init__(self, *args, **kw): pass def connect(self): pass class HTTPSConnection(HTTPConnection): - default_port = Undefined(Any) - key_file = Undefined(Any) - cert_file = Undefined(Any) - def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=Undefined, **kw): pass - sock = Undefined(Any) + default_port = ... # type: Any + key_file = ... # type: Any + cert_file = ... # type: Any + def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=..., **kw): pass + sock = ... # type: Any def connect(self): pass class VerifiedHTTPSConnection(HTTPSConnection): - cert_reqs = Undefined(Any) - ca_certs = Undefined(Any) - ssl_version = Undefined(Any) - assert_fingerprint = Undefined(Any) - key_file = Undefined(Any) - cert_file = Undefined(Any) - assert_hostname = Undefined(Any) + cert_reqs = ... # type: Any + ca_certs = ... # type: Any + ssl_version = ... # type: Any + assert_fingerprint = ... # type: Any + key_file = ... # type: Any + cert_file = ... # type: Any + assert_hostname = ... # type: Any def set_cert(self, key_file=None, cert_file=None, cert_reqs=None, ca_certs=None, assert_hostname=None, assert_fingerprint=None): pass - sock = Undefined(Any) - auto_open = Undefined(Any) - is_verified = Undefined(Any) + sock = ... # type: Any + auto_open = ... # type: Any + is_verified = ... # type: Any def connect(self): pass -UnverifiedHTTPSConnection = Undefined(Any) +UnverifiedHTTPSConnection = ... # type: Any diff --git a/stubs/3.2/requests/packages/urllib3/connectionpool.pyi b/stubs/3.2/requests/packages/urllib3/connectionpool.pyi index 34c25c45faf1..3ac8e8c28fdc 100644 --- a/stubs/3.2/requests/packages/urllib3/connectionpool.pyi +++ b/stubs/3.2/requests/packages/urllib3/connectionpool.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from . import exceptions from .packages import ssl_match_hostname from . import packages @@ -41,47 +41,47 @@ Retry = retry.Retry Timeout = timeout.Timeout get_host = url.get_host -xrange = Undefined(Any) -log = Undefined(Any) +xrange = ... # type: Any +log = ... # type: Any class ConnectionPool: - scheme = Undefined(Any) - QueueCls = Undefined(Any) - host = Undefined(Any) - port = Undefined(Any) + scheme = ... # type: Any + QueueCls = ... # type: Any + host = ... # type: Any + port = ... # type: Any def __init__(self, host, port=None): pass def __enter__(self): pass def __exit__(self, exc_type, exc_val, exc_tb): pass def close(self): pass class HTTPConnectionPool(ConnectionPool, RequestMethods): - scheme = Undefined(Any) - ConnectionCls = Undefined(Any) - strict = Undefined(Any) - timeout = Undefined(Any) - retries = Undefined(Any) - pool = Undefined(Any) - block = Undefined(Any) - proxy = Undefined(Any) - proxy_headers = Undefined(Any) - num_connections = Undefined(Any) - num_requests = Undefined(Any) - conn_kw = Undefined(Any) - def __init__(self, host, port=None, strict=False, timeout=Undefined, maxsize=1, block=False, headers=None, retries=None, _proxy=None, _proxy_headers=None, **conn_kw): pass + scheme = ... # type: Any + ConnectionCls = ... # type: Any + strict = ... # type: Any + timeout = ... # type: Any + retries = ... # type: Any + pool = ... # type: Any + block = ... # type: Any + proxy = ... # type: Any + proxy_headers = ... # type: Any + num_connections = ... # type: Any + num_requests = ... # type: Any + conn_kw = ... # type: Any + def __init__(self, host, port=None, strict=False, timeout=..., maxsize=1, block=False, headers=None, retries=None, _proxy=None, _proxy_headers=None, **conn_kw): pass def close(self): pass def is_same_host(self, url): pass - def urlopen(self, method, url, body=None, headers=None, retries=None, redirect=True, assert_same_host=True, timeout=Undefined, pool_timeout=None, release_conn=None, **response_kw): pass + def urlopen(self, method, url, body=None, headers=None, retries=None, redirect=True, assert_same_host=True, timeout=..., pool_timeout=None, release_conn=None, **response_kw): pass class HTTPSConnectionPool(HTTPConnectionPool): - scheme = Undefined(Any) - ConnectionCls = Undefined(Any) - key_file = Undefined(Any) - cert_file = Undefined(Any) - cert_reqs = Undefined(Any) - ca_certs = Undefined(Any) - ssl_version = Undefined(Any) - assert_hostname = Undefined(Any) - assert_fingerprint = Undefined(Any) - def __init__(self, host, port=None, strict=False, timeout=Undefined, maxsize=1, block=False, headers=None, retries=None, _proxy=None, _proxy_headers=None, key_file=None, cert_file=None, cert_reqs=None, ca_certs=None, ssl_version=None, assert_hostname=None, assert_fingerprint=None, **conn_kw): pass + scheme = ... # type: Any + ConnectionCls = ... # type: Any + key_file = ... # type: Any + cert_file = ... # type: Any + cert_reqs = ... # type: Any + ca_certs = ... # type: Any + ssl_version = ... # type: Any + assert_hostname = ... # type: Any + assert_fingerprint = ... # type: Any + def __init__(self, host, port=None, strict=False, timeout=..., maxsize=1, block=False, headers=None, retries=None, _proxy=None, _proxy_headers=None, key_file=None, cert_file=None, cert_reqs=None, ca_certs=None, ssl_version=None, assert_hostname=None, assert_fingerprint=None, **conn_kw): pass def connection_from_url(url, **kw): pass diff --git a/stubs/3.2/requests/packages/urllib3/exceptions.pyi b/stubs/3.2/requests/packages/urllib3/exceptions.pyi index b2380992a4b1..3641d364f80f 100644 --- a/stubs/3.2/requests/packages/urllib3/exceptions.pyi +++ b/stubs/3.2/requests/packages/urllib3/exceptions.pyi @@ -2,18 +2,18 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class HTTPError(Exception): pass class HTTPWarning(Warning): pass class PoolError(HTTPError): - pool = Undefined(Any) + pool = ... # type: Any def __init__(self, pool, message): pass def __reduce__(self): pass class RequestError(PoolError): - url = Undefined(Any) + url = ... # type: Any def __init__(self, pool, url, message): pass def __reduce__(self): pass @@ -22,14 +22,14 @@ class ProxyError(HTTPError): pass class DecodeError(HTTPError): pass class ProtocolError(HTTPError): pass -ConnectionError = Undefined(Any) +ConnectionError = ... # type: Any class MaxRetryError(RequestError): - reason = Undefined(Any) + reason = ... # type: Any def __init__(self, pool, url, reason=None): pass class HostChangedError(RequestError): - retries = Undefined(Any) + retries = ... # type: Any def __init__(self, pool, url, retries=3): pass class TimeoutStateError(HTTPError): pass @@ -41,12 +41,12 @@ class ClosedPoolError(PoolError): pass class LocationValueError(ValueError, HTTPError): pass class LocationParseError(LocationValueError): - location = Undefined(Any) + location = ... # type: Any def __init__(self, location): pass class ResponseError(HTTPError): - GENERIC_ERROR = Undefined(Any) - SPECIFIC_ERROR = Undefined(Any) + GENERIC_ERROR = ... # type: Any + SPECIFIC_ERROR = ... # type: Any class SecurityWarning(HTTPWarning): pass class InsecureRequestWarning(SecurityWarning): pass diff --git a/stubs/3.2/requests/packages/urllib3/fields.pyi b/stubs/3.2/requests/packages/urllib3/fields.pyi index 96d4cdebbc75..a20100ad3e5f 100644 --- a/stubs/3.2/requests/packages/urllib3/fields.pyi +++ b/stubs/3.2/requests/packages/urllib3/fields.pyi @@ -1,14 +1,14 @@ # Stubs for requests.packages.urllib3.fields (Python 3.4) -from typing import Undefined, Any +from typing import Any from . import packages def guess_content_type(filename, default=''): pass def format_header_param(name, value): pass class RequestField: - data = Undefined(Any) - headers = Undefined(Any) + data = ... # type: Any + headers = ... # type: Any def __init__(self, name, data, filename=None, headers=None): pass @classmethod def from_tuples(cls, fieldname, value): pass diff --git a/stubs/3.2/requests/packages/urllib3/filepost.pyi b/stubs/3.2/requests/packages/urllib3/filepost.pyi index e3cf3f82400a..80a9b4c70c75 100644 --- a/stubs/3.2/requests/packages/urllib3/filepost.pyi +++ b/stubs/3.2/requests/packages/urllib3/filepost.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from . import packages #from .packages import six from . import fields @@ -11,7 +11,7 @@ from . import fields #b = six.b RequestField = fields.RequestField -writer = Undefined(Any) +writer = ... # type: Any def choose_boundary(): pass def iter_field_objects(fields): pass diff --git a/stubs/3.2/requests/packages/urllib3/poolmanager.pyi b/stubs/3.2/requests/packages/urllib3/poolmanager.pyi index 52bcc8632bcb..0569fb852e3c 100644 --- a/stubs/3.2/requests/packages/urllib3/poolmanager.pyi +++ b/stubs/3.2/requests/packages/urllib3/poolmanager.pyi @@ -2,13 +2,13 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from .request import RequestMethods class PoolManager(RequestMethods): - proxy = Undefined(Any) - connection_pool_kw = Undefined(Any) - pools = Undefined(Any) + proxy = ... # type: Any + connection_pool_kw = ... # type: Any + pools = ... # type: Any def __init__(self, num_pools=10, headers=None, **connection_pool_kw): pass def __enter__(self): pass def __exit__(self, exc_type, exc_val, exc_tb): pass @@ -20,8 +20,8 @@ class PoolManager(RequestMethods): def urlopen(self, method, url, body=None, headers=None, encode_multipart=True, multipart_boundary=None, **kw): pass class ProxyManager(PoolManager): - proxy = Undefined(Any) - proxy_headers = Undefined(Any) + proxy = ... # type: Any + proxy_headers = ... # type: Any def __init__(self, proxy_url, num_pools=10, headers=None, proxy_headers=None, **connection_pool_kw): pass def connection_from_host(self, host, port=None, scheme=''): pass # TODO: This was the original signature -- copied another one from base class to fix complaint. diff --git a/stubs/3.2/requests/packages/urllib3/request.pyi b/stubs/3.2/requests/packages/urllib3/request.pyi index c1c04f237095..56256df7cafb 100644 --- a/stubs/3.2/requests/packages/urllib3/request.pyi +++ b/stubs/3.2/requests/packages/urllib3/request.pyi @@ -2,10 +2,10 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class RequestMethods: - headers = Undefined(Any) + headers = ... # type: Any def __init__(self, headers=None): pass def urlopen(self, method, url, body=None, headers=None, encode_multipart=True, multipart_boundary=None, **kw): pass def request(self, method, url, fields=None, headers=None, **urlopen_kw): pass diff --git a/stubs/3.2/requests/packages/urllib3/response.pyi b/stubs/3.2/requests/packages/urllib3/response.pyi index 5347134caa46..ec6b11f11c96 100644 --- a/stubs/3.2/requests/packages/urllib3/response.pyi +++ b/stubs/3.2/requests/packages/urllib3/response.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any import io from . import _collections from . import exceptions @@ -31,14 +31,14 @@ class GzipDecoder: def decompress(self, data): pass class HTTPResponse(io.IOBase): - CONTENT_DECODERS = Undefined(Any) - REDIRECT_STATUSES = Undefined(Any) - headers = Undefined(Any) - status = Undefined(Any) - version = Undefined(Any) - reason = Undefined(Any) - strict = Undefined(Any) - decode_content = Undefined(Any) + CONTENT_DECODERS = ... # type: Any + REDIRECT_STATUSES = ... # type: Any + headers = ... # type: Any + status = ... # type: Any + version = ... # type: Any + reason = ... # type: Any + strict = ... # type: Any + decode_content = ... # type: Any def __init__(self, body='', headers=None, status=0, version=0, reason=None, strict=0, preload_content=True, decode_content=True, original_response=None, pool=None, connection=None): pass def get_redirect_location(self): pass def release_conn(self): pass @@ -46,7 +46,7 @@ class HTTPResponse(io.IOBase): def data(self): pass def tell(self): pass def read(self, amt=None, decode_content=None, cache_content=False): pass - def stream(self, amt=Undefined, decode_content=None): pass + def stream(self, amt=..., decode_content=None): pass @classmethod def from_httplib(ResponseCls, r, **response_kw): pass def getheaders(self): pass diff --git a/stubs/3.2/requests/packages/urllib3/util/connection.pyi b/stubs/3.2/requests/packages/urllib3/util/connection.pyi index 31e829dbe8bf..0f15cf89ce73 100644 --- a/stubs/3.2/requests/packages/urllib3/util/connection.pyi +++ b/stubs/3.2/requests/packages/urllib3/util/connection.pyi @@ -2,10 +2,10 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any -poll = Undefined(Any) -select = Undefined(Any) +poll = ... # type: Any +select = ... # type: Any def is_connection_dropped(conn): pass -def create_connection(address, timeout=Undefined, source_address=None, socket_options=None): pass +def create_connection(address, timeout=..., source_address=None, socket_options=None): pass diff --git a/stubs/3.2/requests/packages/urllib3/util/request.pyi b/stubs/3.2/requests/packages/urllib3/util/request.pyi index e27b83ec7800..876668413dcf 100644 --- a/stubs/3.2/requests/packages/urllib3/util/request.pyi +++ b/stubs/3.2/requests/packages/urllib3/util/request.pyi @@ -2,11 +2,11 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any #from ..packages import six #b = six.b -ACCEPT_ENCODING = Undefined(Any) +ACCEPT_ENCODING = ... # type: Any def make_headers(keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None): pass diff --git a/stubs/3.2/requests/packages/urllib3/util/retry.pyi b/stubs/3.2/requests/packages/urllib3/util/retry.pyi index cc392addf25f..108339be5504 100644 --- a/stubs/3.2/requests/packages/urllib3/util/retry.pyi +++ b/stubs/3.2/requests/packages/urllib3/util/retry.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from .. import exceptions from .. import packages @@ -12,20 +12,20 @@ ProtocolError = exceptions.ProtocolError ReadTimeoutError = exceptions.ReadTimeoutError ResponseError = exceptions.ResponseError -log = Undefined(Any) +log = ... # type: Any class Retry: - DEFAULT_METHOD_WHITELIST = Undefined(Any) - BACKOFF_MAX = Undefined(Any) - total = Undefined(Any) - connect = Undefined(Any) - read = Undefined(Any) - redirect = Undefined(Any) - status_forcelist = Undefined(Any) - method_whitelist = Undefined(Any) - backoff_factor = Undefined(Any) - raise_on_redirect = Undefined(Any) - def __init__(self, total=10, connect=None, read=None, redirect=None, method_whitelist=Undefined, status_forcelist=None, backoff_factor=0, raise_on_redirect=True, _observed_errors=0): pass + DEFAULT_METHOD_WHITELIST = ... # type: Any + BACKOFF_MAX = ... # type: Any + total = ... # type: Any + connect = ... # type: Any + read = ... # type: Any + redirect = ... # type: Any + status_forcelist = ... # type: Any + method_whitelist = ... # type: Any + backoff_factor = ... # type: Any + raise_on_redirect = ... # type: Any + def __init__(self, total=10, connect=None, read=None, redirect=None, method_whitelist=..., status_forcelist=None, backoff_factor=0, raise_on_redirect=True, _observed_errors=0): pass def new(self, **kw): pass @classmethod def from_int(cls, retries, redirect=True, default=None): pass diff --git a/stubs/3.2/requests/packages/urllib3/util/ssl_.pyi b/stubs/3.2/requests/packages/urllib3/util/ssl_.pyi index b071d7001772..4308eec29ba3 100644 --- a/stubs/3.2/requests/packages/urllib3/util/ssl_.pyi +++ b/stubs/3.2/requests/packages/urllib3/util/ssl_.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from .. import exceptions import ssl @@ -10,15 +10,15 @@ SSLError = exceptions.SSLError InsecurePlatformWarning = exceptions.InsecurePlatformWarning SSLContext = ssl.SSLContext -HAS_SNI = Undefined(Any) -create_default_context = Undefined(Any) -OP_NO_SSLv2 = Undefined(Any) -OP_NO_SSLv3 = Undefined(Any) -OP_NO_COMPRESSION = Undefined(Any) +HAS_SNI = ... # type: Any +create_default_context = ... # type: Any +OP_NO_SSLv2 = ... # type: Any +OP_NO_SSLv3 = ... # type: Any +OP_NO_COMPRESSION = ... # type: Any def assert_fingerprint(cert, fingerprint): pass def resolve_cert_reqs(candidate): pass def resolve_ssl_version(candidate): pass -def create_urllib3_context(ssl_version=None, cert_reqs=Undefined, options=None, ciphers=None): pass +def create_urllib3_context(ssl_version=None, cert_reqs=..., options=None, ciphers=None): pass def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None, ciphers=None, ssl_context=None): pass diff --git a/stubs/3.2/requests/packages/urllib3/util/timeout.pyi b/stubs/3.2/requests/packages/urllib3/util/timeout.pyi index bf8e1b25d196..78fdab67c3f9 100644 --- a/stubs/3.2/requests/packages/urllib3/util/timeout.pyi +++ b/stubs/3.2/requests/packages/urllib3/util/timeout.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from .. import exceptions TimeoutStateError = exceptions.TimeoutStateError @@ -10,9 +10,9 @@ TimeoutStateError = exceptions.TimeoutStateError def current_time(): pass class Timeout: - DEFAULT_TIMEOUT = Undefined(Any) - total = Undefined(Any) - def __init__(self, total=None, connect=Undefined, read=Undefined): pass + DEFAULT_TIMEOUT = ... # type: Any + total = ... # type: Any + def __init__(self, total=None, connect=..., read=...): pass @classmethod def from_float(cls, timeout): pass def clone(self): pass diff --git a/stubs/3.2/requests/packages/urllib3/util/url.pyi b/stubs/3.2/requests/packages/urllib3/util/url.pyi index 0414cb0219f6..a42c412250f1 100644 --- a/stubs/3.2/requests/packages/urllib3/util/url.pyi +++ b/stubs/3.2/requests/packages/urllib3/util/url.pyi @@ -2,15 +2,15 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from .. import exceptions LocationParseError = exceptions.LocationParseError -url_attrs = Undefined(Any) +url_attrs = ... # type: Any class Url: - slots = Undefined(Any) + slots = ... # type: Any def __new__(cls, scheme=None, auth=None, host=None, port=None, path=None, query=None, fragment=None): pass @property def hostname(self): pass diff --git a/stubs/3.2/requests/sessions.pyi b/stubs/3.2/requests/sessions.pyi index e19fb1ca8e24..134c5143c39c 100644 --- a/stubs/3.2/requests/sessions.pyi +++ b/stubs/3.2/requests/sessions.pyi @@ -1,6 +1,6 @@ # Stubs for requests.sessions (Python 3) -from typing import Undefined, Any, Union, MutableMapping +from typing import Any, Union, MutableMapping from . import auth from . import compat from . import cookies @@ -42,10 +42,10 @@ get_auth_from_url = utils.get_auth_from_url codes = status_codes.codes REDIRECT_STATI = models.REDIRECT_STATI -REDIRECT_CACHE_SIZE = Undefined(Any) +REDIRECT_CACHE_SIZE = ... # type: Any -def merge_setting(request_setting, session_setting, dict_class=Undefined): pass -def merge_hooks(request_hooks, session_hooks, dict_class=Undefined): pass +def merge_setting(request_setting, session_setting, dict_class=...): pass +def merge_hooks(request_hooks, session_hooks, dict_class=...): pass class SessionRedirectMixin: def resolve_redirects(self, resp, req, stream=False, timeout=None, verify=True, cert=None, @@ -54,20 +54,20 @@ class SessionRedirectMixin: def rebuild_proxies(self, prepared_request, proxies): pass class Session(SessionRedirectMixin): - __attrs__ = Undefined(Any) - headers = Undefined(MutableMapping[str, str]) - auth = Undefined(Any) - proxies = Undefined(Any) - hooks = Undefined(Any) - params = Undefined(Any) - stream = Undefined(Any) - verify = Undefined(Any) - cert = Undefined(Any) - max_redirects = Undefined(Any) - trust_env = Undefined(Any) - cookies = Undefined(Any) - adapters = Undefined(Any) - redirect_cache = Undefined(Any) + __attrs__ = ... # type: Any + headers = ... # type: MutableMapping[str, str] + auth = ... # type: Any + proxies = ... # type: Any + hooks = ... # type: Any + params = ... # type: Any + stream = ... # type: Any + verify = ... # type: Any + cert = ... # type: Any + max_redirects = ... # type: Any + trust_env = ... # type: Any + cookies = ... # type: Any + adapters = ... # type: Any + redirect_cache = ... # type: Any def __init__(self) -> None: pass def __enter__(self) -> 'Session': pass def __exit__(self, *args) -> None: pass diff --git a/stubs/3.2/requests/status_codes.pyi b/stubs/3.2/requests/status_codes.pyi index 35020430ca4e..e3035eb9163a 100644 --- a/stubs/3.2/requests/status_codes.pyi +++ b/stubs/3.2/requests/status_codes.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from .structures import LookupDict -codes = Undefined(Any) +codes = ... # type: Any diff --git a/stubs/3.2/requests/structures.pyi b/stubs/3.2/requests/structures.pyi index fb7c0526ac0c..feae31cfb42a 100644 --- a/stubs/3.2/requests/structures.pyi +++ b/stubs/3.2/requests/structures.pyi @@ -1,6 +1,6 @@ # Stubs for requests.structures (Python 3) -from typing import Undefined, Any +from typing import Any import collections class CaseInsensitiveDict(collections.MutableMapping): @@ -15,7 +15,7 @@ class CaseInsensitiveDict(collections.MutableMapping): def copy(self): pass class LookupDict(dict): - name = Undefined(Any) + name = ... # type: Any def __init__(self, name=None): pass def __getitem__(self, key): pass def get(self, key, default=None): pass diff --git a/stubs/3.2/requests/utils.pyi b/stubs/3.2/requests/utils.pyi index 72056447ed0b..8bce85edd2cb 100644 --- a/stubs/3.2/requests/utils.pyi +++ b/stubs/3.2/requests/utils.pyi @@ -1,6 +1,6 @@ # Stubs for requests.utils (Python 3) -from typing import Undefined, Any +from typing import Any from . import compat from . import cookies from . import structures @@ -12,8 +12,8 @@ cookiejar_from_dict = cookies.cookiejar_from_dict CaseInsensitiveDict = structures.CaseInsensitiveDict InvalidURL = exceptions.InvalidURL -NETRC_FILES = Undefined(Any) -DEFAULT_CA_BUNDLE_PATH = Undefined(Any) +NETRC_FILES = ... # type: Any +DEFAULT_CA_BUNDLE_PATH = ... # type: Any def dict_to_sequence(d): pass def super_len(o): pass @@ -32,7 +32,7 @@ def stream_decode_response_unicode(iterator, r): pass def iter_slices(string, slice_length): pass def get_unicode_from_response(r): pass -UNRESERVED_SET = Undefined(Any) +UNRESERVED_SET = ... # type: Any def unquote_unreserved(uri): pass def requote_uri(uri): pass diff --git a/stubs/3.2/shlex.pyi b/stubs/3.2/shlex.pyi index 975823e47850..1640254426bb 100644 --- a/stubs/3.2/shlex.pyi +++ b/stubs/3.2/shlex.pyi @@ -2,7 +2,7 @@ # Based on http://docs.python.org/3.2/library/shlex.html -from typing import List, Undefined, Tuple, Any, TextIO +from typing import List, Tuple, Any, TextIO def split(s: str, comments: bool = False, posix: bool = True) -> List[str]: pass @@ -16,7 +16,7 @@ class shlex: escapedquotes = '' whitespace_split = '' infile = '' - instream = Undefined(TextIO) + instream = ... # type: TextIO source = '' debug = 0 lineno = 0 diff --git a/stubs/3.2/smtplib.pyi b/stubs/3.2/smtplib.pyi index 49406ac7889f..308d5e6a1e9a 100644 --- a/stubs/3.2/smtplib.pyi +++ b/stubs/3.2/smtplib.pyi @@ -2,27 +2,27 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class SMTPException(OSError): pass class SMTPServerDisconnected(SMTPException): pass class SMTPResponseException(SMTPException): - smtp_code = Undefined(Any) - smtp_error = Undefined(Any) - args = Undefined(Any) + smtp_code = ... # type: Any + smtp_error = ... # type: Any + args = ... # type: Any def __init__(self, code, msg): pass class SMTPSenderRefused(SMTPResponseException): - smtp_code = Undefined(Any) - smtp_error = Undefined(Any) - sender = Undefined(Any) - args = Undefined(Any) + smtp_code = ... # type: Any + smtp_error = ... # type: Any + sender = ... # type: Any + args = ... # type: Any def __init__(self, code, msg, sender): pass class SMTPRecipientsRefused(SMTPException): - recipients = Undefined(Any) - args = Undefined(Any) + recipients = ... # type: Any + args = ... # type: Any def __init__(self, recipients): pass class SMTPDataError(SMTPResponseException): pass @@ -34,23 +34,23 @@ def quoteaddr(addrstring): pass def quotedata(data): pass class SMTP: - debuglevel = Undefined(Any) - file = Undefined(Any) - helo_resp = Undefined(Any) - ehlo_msg = Undefined(Any) - ehlo_resp = Undefined(Any) - does_esmtp = Undefined(Any) - default_port = Undefined(Any) - timeout = Undefined(Any) - esmtp_features = Undefined(Any) - source_address = Undefined(Any) - local_hostname = Undefined(Any) - def __init__(self, host='', port=0, local_hostname=None, timeout=Undefined, + debuglevel = ... # type: Any + file = ... # type: Any + helo_resp = ... # type: Any + ehlo_msg = ... # type: Any + ehlo_resp = ... # type: Any + does_esmtp = ... # type: Any + default_port = ... # type: Any + timeout = ... # type: Any + esmtp_features = ... # type: Any + source_address = ... # type: Any + local_hostname = ... # type: Any + def __init__(self, host='', port=0, local_hostname=None, timeout=..., source_address=None): pass def __enter__(self): pass def __exit__(self, *args): pass def set_debuglevel(self, debuglevel): pass - sock = Undefined(Any) + sock = ... # type: Any def connect(self, host='', port=0, source_address=None): pass def send(self, s): pass def putcmd(self, cmd, args=''): pass @@ -62,33 +62,33 @@ class SMTP: def help(self, args=''): pass def rset(self): pass def noop(self): pass - def mail(self, sender, options=Undefined): pass - def rcpt(self, recip, options=Undefined): pass + def mail(self, sender, options=...): pass + def rcpt(self, recip, options=...): pass def data(self, msg): pass def verify(self, address): pass - vrfy = Undefined(Any) + vrfy = ... # type: Any def expn(self, address): pass def ehlo_or_helo_if_needed(self): pass def login(self, user, password): pass def starttls(self, keyfile=None, certfile=None, context=None): pass - def sendmail(self, from_addr, to_addrs, msg, mail_options=Undefined, - rcpt_options=Undefined): pass - def send_message(self, msg, from_addr=None, to_addrs=None, mail_options=Undefined, - rcpt_options=Undefined): pass + def sendmail(self, from_addr, to_addrs, msg, mail_options=..., + rcpt_options=...): pass + def send_message(self, msg, from_addr=None, to_addrs=None, mail_options=..., + rcpt_options=...): pass def close(self): pass def quit(self): pass class SMTP_SSL(SMTP): - default_port = Undefined(Any) - keyfile = Undefined(Any) - certfile = Undefined(Any) - context = Undefined(Any) + default_port = ... # type: Any + keyfile = ... # type: Any + certfile = ... # type: Any + context = ... # type: Any def __init__(self, host='', port=0, local_hostname=None, keyfile=None, certfile=None, - timeout=Undefined, source_address=None, context=None): pass + timeout=..., source_address=None, context=None): pass class LMTP(SMTP): - ehlo_msg = Undefined(Any) - def __init__(self, host='', port=Undefined, local_hostname=None, source_address=None): pass - sock = Undefined(Any) - file = Undefined(Any) + ehlo_msg = ... # type: Any + def __init__(self, host='', port=..., local_hostname=None, source_address=None): pass + sock = ... # type: Any + file = ... # type: Any def connect(self, host='', port=0, source_address=None): pass diff --git a/stubs/3.2/socket.pyi b/stubs/3.2/socket.pyi index a1beb4c861d4..a2caf9474c9d 100644 --- a/stubs/3.2/socket.pyi +++ b/stubs/3.2/socket.pyi @@ -5,7 +5,7 @@ # see: http://hg.python.org/cpython/file/3d0686d90f55/Lib/socket.py # see: http://nullege.com/codes/search/socket -from typing import Undefined, Any, Tuple, overload, List +from typing import Any, Tuple, overload, List # ----- variables and constants ----- @@ -22,8 +22,8 @@ SOCK_NONBLOCK = 0 SOMAXCONN = 0 has_ipv6 = False _GLOBAL_DEFAULT_TIMEOUT = 0.0 -SocketType = Undefined(Any) -SocketIO = Undefined(Any) +SocketType = ... # type: Any +SocketIO = ... # type: Any # the following constants are included with Python 3.2.3 (Ubuntu) diff --git a/stubs/3.2/ssl.pyi b/stubs/3.2/ssl.pyi index 73d38170f082..097fb70104f6 100644 --- a/stubs/3.2/ssl.pyi +++ b/stubs/3.2/ssl.pyi @@ -1,6 +1,6 @@ # Stubs for ssl (Python 3.4) -from typing import Undefined, Any +from typing import Any from enum import Enum as _Enum from socket import socket from collections import namedtuple @@ -12,77 +12,77 @@ class SSLWantReadError(SSLError): pass class SSLWantWriteError(SSLError): pass class SSLZeroReturnError(SSLError): pass -OPENSSL_VERSION = Undefined(str) -OPENSSL_VERSION_INFO = Undefined(Any) -OPENSSL_VERSION_NUMBER = Undefined(int) - -VERIFY_CRL_CHECK_CHAIN = Undefined(int) -VERIFY_CRL_CHECK_LEAF = Undefined(int) -VERIFY_DEFAULT = Undefined(int) -VERIFY_X509_STRICT = Undefined(int) - -ALERT_DESCRIPTION_ACCESS_DENIED = Undefined(int) -ALERT_DESCRIPTION_BAD_CERTIFICATE = Undefined(int) -ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE = Undefined(int) -ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE = Undefined(int) -ALERT_DESCRIPTION_BAD_RECORD_MAC = Undefined(int) -ALERT_DESCRIPTION_CERTIFICATE_EXPIRED = Undefined(int) -ALERT_DESCRIPTION_CERTIFICATE_REVOKED = Undefined(int) -ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN = Undefined(int) -ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE = Undefined(int) -ALERT_DESCRIPTION_CLOSE_NOTIFY = Undefined(int) -ALERT_DESCRIPTION_DECODE_ERROR = Undefined(int) -ALERT_DESCRIPTION_DECOMPRESSION_FAILURE = Undefined(int) -ALERT_DESCRIPTION_DECRYPT_ERROR = Undefined(int) -ALERT_DESCRIPTION_HANDSHAKE_FAILURE = Undefined(int) -ALERT_DESCRIPTION_ILLEGAL_PARAMETER = Undefined(int) -ALERT_DESCRIPTION_INSUFFICIENT_SECURITY = Undefined(int) -ALERT_DESCRIPTION_INTERNAL_ERROR = Undefined(int) -ALERT_DESCRIPTION_NO_RENEGOTIATION = Undefined(int) -ALERT_DESCRIPTION_PROTOCOL_VERSION = Undefined(int) -ALERT_DESCRIPTION_RECORD_OVERFLOW = Undefined(int) -ALERT_DESCRIPTION_UNEXPECTED_MESSAGE = Undefined(int) -ALERT_DESCRIPTION_UNKNOWN_CA = Undefined(int) -ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY = Undefined(int) -ALERT_DESCRIPTION_UNRECOGNIZED_NAME = Undefined(int) -ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE = Undefined(int) -ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION = Undefined(int) -ALERT_DESCRIPTION_USER_CANCELLED = Undefined(int) - -OP_ALL = Undefined(int) -OP_CIPHER_SERVER_PREFERENCE = Undefined(int) -OP_NO_COMPRESSION = Undefined(int) -OP_NO_SSLv2 = Undefined(int) -OP_NO_SSLv3 = Undefined(int) -OP_NO_TLSv1 = Undefined(int) -OP_NO_TLSv1_1 = Undefined(int) -OP_NO_TLSv1_2 = Undefined(int) -OP_SINGLE_DH_USE = Undefined(int) -OP_SINGLE_ECDH_USE = Undefined(int) - -SSL_ERROR_EOF = Undefined(int) -SSL_ERROR_INVALID_ERROR_CODE = Undefined(int) -SSL_ERROR_SSL = Undefined(int) -SSL_ERROR_SYSCALL = Undefined(int) -SSL_ERROR_WANT_CONNECT = Undefined(int) -SSL_ERROR_WANT_READ = Undefined(int) -SSL_ERROR_WANT_WRITE = Undefined(int) -SSL_ERROR_WANT_X509_LOOKUP = Undefined(int) -SSL_ERROR_ZERO_RETURN = Undefined(int) - -CERT_NONE = Undefined(int) -CERT_OPTIONAL = Undefined(int) -CERT_REQUIRED = Undefined(int) - -PROTOCOL_SSLv23 = Undefined(int) -PROTOCOL_SSLv3 = Undefined(int) -PROTOCOL_TLSv1 = Undefined(int) -PROTOCOL_TLSv1_1 = Undefined(int) -PROTOCOL_TLSv1_2 = Undefined(int) - -HAS_ECDH = Undefined(bool) -HAS_NPN = Undefined(bool) -HAS_SNI = Undefined(bool) +OPENSSL_VERSION = ... # type: str +OPENSSL_VERSION_INFO = ... # type: Any +OPENSSL_VERSION_NUMBER = ... # type: int + +VERIFY_CRL_CHECK_CHAIN = ... # type: int +VERIFY_CRL_CHECK_LEAF = ... # type: int +VERIFY_DEFAULT = ... # type: int +VERIFY_X509_STRICT = ... # type: int + +ALERT_DESCRIPTION_ACCESS_DENIED = ... # type: int +ALERT_DESCRIPTION_BAD_CERTIFICATE = ... # type: int +ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE = ... # type: int +ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE = ... # type: int +ALERT_DESCRIPTION_BAD_RECORD_MAC = ... # type: int +ALERT_DESCRIPTION_CERTIFICATE_EXPIRED = ... # type: int +ALERT_DESCRIPTION_CERTIFICATE_REVOKED = ... # type: int +ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN = ... # type: int +ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE = ... # type: int +ALERT_DESCRIPTION_CLOSE_NOTIFY = ... # type: int +ALERT_DESCRIPTION_DECODE_ERROR = ... # type: int +ALERT_DESCRIPTION_DECOMPRESSION_FAILURE = ... # type: int +ALERT_DESCRIPTION_DECRYPT_ERROR = ... # type: int +ALERT_DESCRIPTION_HANDSHAKE_FAILURE = ... # type: int +ALERT_DESCRIPTION_ILLEGAL_PARAMETER = ... # type: int +ALERT_DESCRIPTION_INSUFFICIENT_SECURITY = ... # type: int +ALERT_DESCRIPTION_INTERNAL_ERROR = ... # type: int +ALERT_DESCRIPTION_NO_RENEGOTIATION = ... # type: int +ALERT_DESCRIPTION_PROTOCOL_VERSION = ... # type: int +ALERT_DESCRIPTION_RECORD_OVERFLOW = ... # type: int +ALERT_DESCRIPTION_UNEXPECTED_MESSAGE = ... # type: int +ALERT_DESCRIPTION_UNKNOWN_CA = ... # type: int +ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY = ... # type: int +ALERT_DESCRIPTION_UNRECOGNIZED_NAME = ... # type: int +ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE = ... # type: int +ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION = ... # type: int +ALERT_DESCRIPTION_USER_CANCELLED = ... # type: int + +OP_ALL = ... # type: int +OP_CIPHER_SERVER_PREFERENCE = ... # type: int +OP_NO_COMPRESSION = ... # type: int +OP_NO_SSLv2 = ... # type: int +OP_NO_SSLv3 = ... # type: int +OP_NO_TLSv1 = ... # type: int +OP_NO_TLSv1_1 = ... # type: int +OP_NO_TLSv1_2 = ... # type: int +OP_SINGLE_DH_USE = ... # type: int +OP_SINGLE_ECDH_USE = ... # type: int + +SSL_ERROR_EOF = ... # type: int +SSL_ERROR_INVALID_ERROR_CODE = ... # type: int +SSL_ERROR_SSL = ... # type: int +SSL_ERROR_SYSCALL = ... # type: int +SSL_ERROR_WANT_CONNECT = ... # type: int +SSL_ERROR_WANT_READ = ... # type: int +SSL_ERROR_WANT_WRITE = ... # type: int +SSL_ERROR_WANT_X509_LOOKUP = ... # type: int +SSL_ERROR_ZERO_RETURN = ... # type: int + +CERT_NONE = ... # type: int +CERT_OPTIONAL = ... # type: int +CERT_REQUIRED = ... # type: int + +PROTOCOL_SSLv23 = ... # type: int +PROTOCOL_SSLv3 = ... # type: int +PROTOCOL_TLSv1 = ... # type: int +PROTOCOL_TLSv1_1 = ... # type: int +PROTOCOL_TLSv1_2 = ... # type: int + +HAS_ECDH = ... # type: bool +HAS_NPN = ... # type: bool +HAS_SNI = ... # type: bool def RAND_add(string, entropy): pass def RAND_bytes(n): pass @@ -92,7 +92,7 @@ def RAND_status(): pass socket_error = OSError -CHANNEL_BINDING_TYPES = Undefined(Any) +CHANNEL_BINDING_TYPES = ... # type: Any class CertificateError(ValueError): pass @@ -112,14 +112,14 @@ class _ASN1Object: def fromname(cls, name): pass class Purpose(_ASN1Object, _Enum): - SERVER_AUTH = Undefined(Any) - CLIENT_AUTH = Undefined(Any) + SERVER_AUTH = ... # type: Any + CLIENT_AUTH = ... # type: Any class _SSLContext: - check_hostname = Undefined(Any) - options = Undefined(Any) - verify_flags = Undefined(Any) - verify_mode = Undefined(Any) + check_hostname = ... # type: Any + options = ... # type: Any + verify_flags = ... # type: Any + verify_mode = ... # type: Any def __init__(self, *args, **kwargs): pass def _set_npn_protocols(self, *args, **kwargs): pass def _wrap_socket(self, *args, **kwargs): pass @@ -136,30 +136,30 @@ class _SSLContext: class SSLContext(_SSLContext): def __new__(cls, protocol, *args, **kwargs): pass - protocol = Undefined(Any) + protocol = ... # type: Any def __init__(self, protocol): pass def wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None): pass def set_npn_protocols(self, npn_protocols): pass - def load_default_certs(self, purpose=Undefined): pass + def load_default_certs(self, purpose=...): pass -def create_default_context(purpose=Undefined, *, cafile=None, capath=None, cadata=None): pass +def create_default_context(purpose=..., *, cafile=None, capath=None, cadata=None): pass class SSLSocket(socket): - keyfile = Undefined(Any) - certfile = Undefined(Any) - cert_reqs = Undefined(Any) - ssl_version = Undefined(Any) - ca_certs = Undefined(Any) - ciphers = Undefined(Any) - server_side = Undefined(Any) - server_hostname = Undefined(Any) - do_handshake_on_connect = Undefined(Any) - suppress_ragged_eofs = Undefined(Any) - context = Undefined(Any) # TODO: This should be a property. + keyfile = ... # type: Any + certfile = ... # type: Any + cert_reqs = ... # type: Any + ssl_version = ... # type: Any + ca_certs = ... # type: Any + ciphers = ... # type: Any + server_side = ... # type: Any + server_hostname = ... # type: Any + do_handshake_on_connect = ... # type: Any + suppress_ragged_eofs = ... # type: Any + context = ... # type: Any # TODO: This should be a property. def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False, - cert_reqs=Undefined, ssl_version=Undefined, ca_certs=None, - do_handshake_on_connect=True, family=Undefined, type=Undefined, proto=0, + cert_reqs=..., ssl_version=..., ca_certs=None, + do_handshake_on_connect=True, family=..., type=..., proto=0, fileno=None, suppress_ragged_eofs=True, npn_protocols=None, ciphers=None, server_hostname=None, _context=None): pass def dup(self): pass @@ -188,15 +188,15 @@ class SSLSocket(socket): def accept(self): pass def get_channel_binding(self, cb_type=''): pass -def wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=Undefined, - ssl_version=Undefined, ca_certs=None, do_handshake_on_connect=True, +def wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=..., + ssl_version=..., ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True, ciphers=None): pass def cert_time_to_seconds(cert_time): pass -PEM_HEADER = Undefined(Any) -PEM_FOOTER = Undefined(Any) +PEM_HEADER = ... # type: Any +PEM_FOOTER = ... # type: Any def DER_cert_to_PEM_cert(der_cert_bytes): pass def PEM_cert_to_DER_cert(pem_cert_string): pass -def get_server_certificate(addr, ssl_version=Undefined, ca_certs=None): pass +def get_server_certificate(addr, ssl_version=..., ca_certs=None): pass def get_protocol_name(protocol_code): pass diff --git a/stubs/3.2/struct.pyi b/stubs/3.2/struct.pyi index b8864c0e2663..adc3b0bc7aa1 100644 --- a/stubs/3.2/struct.pyi +++ b/stubs/3.2/struct.pyi @@ -2,7 +2,7 @@ # Based on http://docs.python.org/3.2/library/struct.html -from typing import overload, Any, Undefined, AnyStr +from typing import overload, Any, AnyStr class error(Exception): pass diff --git a/stubs/3.2/subprocess.pyi b/stubs/3.2/subprocess.pyi index aa3588ad595d..d55cdc15984b 100644 --- a/stubs/3.2/subprocess.pyi +++ b/stubs/3.2/subprocess.pyi @@ -2,7 +2,7 @@ # Based on http://docs.python.org/3.2/library/subprocess.html -from typing import Sequence, Any, Mapping, Undefined, Callable, Tuple, IO +from typing import Sequence, Any, Mapping, Callable, Tuple, IO # TODO force keyword arguments # TODO more keyword arguments @@ -19,8 +19,8 @@ def check_output(args: Sequence[str], *, stdin: Any = None, stderr: Any = None, env: Mapping[str, str] = None) -> Any: pass # TODO types -PIPE = Undefined(Any) -STDOUT = Undefined(Any) +PIPE = ... # type: Any +STDOUT = ... # type: Any class CalledProcessError(Exception): returncode = 0 @@ -28,9 +28,9 @@ class CalledProcessError(Exception): output = b'' # May be None class Popen: - stdin = Undefined(IO[Any]) - stdout = Undefined(IO[Any]) - stderr = Undefined(IO[Any]) + stdin = ... # type: IO[Any] + stdout = ... # type: IO[Any] + stderr = ... # type: IO[Any] pid = 0 returncode = 0 diff --git a/stubs/3.2/sys.pyi b/stubs/3.2/sys.pyi index 0a85534912be..a69eb2b0f073 100644 --- a/stubs/3.2/sys.pyi +++ b/stubs/3.2/sys.pyi @@ -4,56 +4,56 @@ # based on http://docs.python.org/3.2/library/sys.html from typing import ( - Undefined, List, Sequence, Any, Dict, Tuple, TextIO, overload, Optional + List, Sequence, Any, Dict, Tuple, TextIO, overload, Optional ) from types import TracebackType # ----- sys variables ----- abiflags = '' -argv = Undefined(List[str]) +argv = ... # type: List[str] byteorder = '' -builtin_module_names = Undefined(Sequence[str]) # actually a tuple of strings +builtin_module_names = ... # type: Sequence[str] # actually a tuple of strings copyright = '' #dllhandle = 0 # Windows only dont_write_bytecode = False -__displayhook__ = Undefined(Any) # contains the original value of displayhook -__excepthook__ = Undefined(Any) # contains the original value of excepthook +__displayhook__ = ... # type: Any # contains the original value of displayhook +__excepthook__ = ... # type: Any # contains the original value of excepthook exec_prefix = '' executable = '' float_repr_style = '' hexversion = 0 # this is a 32-bit int -last_type = Undefined(Any) -last_value = Undefined(Any) -last_traceback = Undefined(Any) +last_type = ... # type: Any +last_value = ... # type: Any +last_traceback = ... # type: Any maxsize = 0 maxunicode = 0 -meta_path = Undefined(List[Any]) -modules = Undefined(Dict[str, Any]) -path = Undefined(List[str]) -path_hooks = Undefined(List[Any]) # TODO precise type; function, path to finder -path_importer_cache = Undefined(Dict[str, Any]) # TODO precise type +meta_path = ... # type: List[Any] +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 = '' -stdin = Undefined(TextIO) -stdout = Undefined(TextIO) -stderr = Undefined(TextIO) -__stdin__ = Undefined(TextIO) -__stdout__ = Undefined(TextIO) -__stderr__ = Undefined(TextIO) +stdin = ... # type: TextIO +stdout = ... # type: TextIO +stderr = ... # type: TextIO +__stdin__ = ... # type: TextIO +__stdout__ = ... # type: TextIO +__stderr__ = ... # type: TextIO # deprecated and removed in Python 3.3: -subversion = Undefined(Tuple[str, str, str]) +subversion = ... # type: Tuple[str, str, str] tracebacklimit = 0 version = '' api_version = 0 -warnoptions = Undefined(Any) +warnoptions = ... # type: Any # Each entry is a tuple of the form (action, message, category, module, # lineno) #winver = '' # Windows only -_xoptions = Undefined(Dict[Any, Any]) +_xoptions = ... # type: Dict[Any, Any] -flags = Undefined(_flags) +flags = ... # type: _flags class _flags: debug = 0 division_warning = 0 @@ -69,7 +69,7 @@ class _flags: quiet = 0 hash_randomization = 0 -float_info = Undefined(_float_info) +float_info = ... # type: _float_info class _float_info: epsilon = 0.0 # DBL_EPSILON dig = 0 # DBL_DIG @@ -83,7 +83,7 @@ class _float_info: radix = 0 # FLT_RADIX rounds = 0 # FLT_ROUNDS -hash_info = Undefined(_hash_info) +hash_info = ... # type: _hash_info class _hash_info: width = 0 # width in bits used for hash values modulus = 0 # prime modulus P used for numeric hash scheme @@ -91,14 +91,14 @@ class _hash_info: nan = 0 # hash value returned for a nan imag = 0 # multiplier used for the imaginary part of a complex number -int_info = Undefined(_int_info) +int_info = ... # type: _int_info class _int_info: bits_per_digit = 0 # number of bits held in each digit. Python integers # are stored internally in # base 2**int_info.bits_per_digit sizeof_digit = 0 # size in bytes of C type used to represent a digit -version_info = Undefined(_version_info) +version_info = ... # type: _version_info class _version_info: major = 0 minor = 0 diff --git a/stubs/3.2/time.pyi b/stubs/3.2/time.pyi index 0f81666211d7..59acba55de26 100644 --- a/stubs/3.2/time.pyi +++ b/stubs/3.2/time.pyi @@ -4,14 +4,14 @@ # based on: http://docs.python.org/3.2/library/time.html#module-time # see: http://nullege.com/codes/search?cq=time -from typing import Undefined, Tuple, Union +from typing import Tuple, Union # ----- variables and constants ----- accept2dyear = False altzone = 0 daylight = 0 timezone = 0 -tzname = Undefined(Tuple[str, str]) +tzname = ... # type: Tuple[str, str] # ----- classes/methods ----- diff --git a/stubs/3.2/types.pyi b/stubs/3.2/types.pyi index 597a9e83d807..218a3daa9344 100644 --- a/stubs/3.2/types.pyi +++ b/stubs/3.2/types.pyi @@ -2,18 +2,18 @@ # TODO this is work in progress -from typing import Any, Undefined +from typing import Any class ModuleType: - __name__ = Undefined(str) - __file__ = Undefined(str) + __name__ = ... # type: str + __file__ = ... # type: str def __init__(self, name: str, doc: Any) -> None: pass class MethodType: pass class BuiltinMethodType: pass class TracebackType: - tb_frame = Undefined(Any) - tb_lasti = Undefined(int) - tb_lineno = Undefined(int) - tb_next = Undefined(Any) + tb_frame = ... # type: Any + tb_lasti = ... # type: int + tb_lineno = ... # type: int + tb_next = ... # type: Any diff --git a/stubs/3.2/typing.pyi b/stubs/3.2/typing.pyi index fd50141e65ea..e9356182e25d 100644 --- a/stubs/3.2/typing.pyi +++ b/stubs/3.2/typing.pyi @@ -7,7 +7,6 @@ from abc import abstractmethod, ABCMeta cast = object() overload = object() -Undefined = object() Any = object() TypeVar = object() Generic = object() @@ -169,7 +168,7 @@ class Mapping(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]): @abstractmethod def __getitem__(self, k: _KT) -> _VT: pass # Mixin methods - def get(self, k: _KT, default: _VT = Undefined) -> _VT: pass + def get(self, k: _KT, default: _VT = ...) -> _VT: pass def items(self) -> AbstractSet[Tuple[_KT, _VT]]: pass def keys(self) -> AbstractSet[_KT]: pass def values(self) -> ValuesView[_VT]: pass @@ -182,9 +181,9 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): def __delitem__(self, v: _KT) -> None: pass def clear(self) -> None: pass - def pop(self, k: _KT, default: _VT = Undefined) -> _VT: pass + def pop(self, k: _KT, default: _VT = ...) -> _VT: pass def popitem(self) -> Tuple[_KT, _VT]: pass - def setdefault(self, k: _KT, default: _VT = Undefined) -> _VT: pass + def setdefault(self, k: _KT, default: _VT = ...) -> _VT: pass def update(self, m: Union[Mapping[_KT, _VT], Iterable[Tuple[_KT, _VT]]]) -> None: pass @@ -273,12 +272,12 @@ class Match(Generic[AnyStr]): pos = 0 endpos = 0 lastindex = 0 - lastgroup = Undefined(AnyStr) - string = Undefined(AnyStr) + lastgroup = ... # type: AnyStr + string = ... # type: AnyStr # The regular expression object whose match() or search() method produced # this match instance. - re = Undefined('Pattern[AnyStr]') + re = ... # type: 'Pattern[AnyStr]' def expand(self, template: AnyStr) -> AnyStr: pass @@ -303,7 +302,7 @@ class Pattern(Generic[AnyStr]): flags = 0 groupindex = 0 groups = 0 - pattern = Undefined(AnyStr) + pattern = ... # type: AnyStr def search(self, string: AnyStr, pos: int = 0, endpos: int = -1) -> Match[AnyStr]: pass diff --git a/stubs/3.2/unicodedata.pyi b/stubs/3.2/unicodedata.pyi index f6de097fcdec..5d604ea84e0e 100644 --- a/stubs/3.2/unicodedata.pyi +++ b/stubs/3.2/unicodedata.pyi @@ -2,36 +2,36 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, Undefined +from typing import Any -ucd_3_2_0 = Undefined(Any) -ucnhash_CAPI = Undefined(Any) -unidata_version = Undefined(str) +ucd_3_2_0 = ... # type: Any +ucnhash_CAPI = ... # type: Any +unidata_version = ... # type: str def bidirectional(unichr): pass def category(unichr): pass def combining(unichr): pass -def decimal(chr, default=Undefined): pass +def decimal(chr, default=...): pass def decomposition(unichr): pass -def digit(chr, default=Undefined): pass +def digit(chr, default=...): pass def east_asian_width(unichr): pass def lookup(name): pass def mirrored(unichr): pass -def name(chr, default=Undefined): pass +def name(chr, default=...): pass def normalize(form, unistr): pass -def numeric(chr, default=Undefined): pass +def numeric(chr, default=...): pass class UCD: - unidata_version = Undefined(Any) + unidata_version = ... # type: Any def bidirectional(self, unichr): pass def category(self, unichr): pass def combining(self, unichr): pass - def decimal(self, chr, default=Undefined): pass + def decimal(self, chr, default=...): pass def decomposition(self, unichr): pass - def digit(self, chr, default=Undefined): pass + def digit(self, chr, default=...): pass def east_asian_width(self, unichr): pass def lookup(self, name): pass def mirrored(self, unichr): pass - def name(self, chr, default=Undefined): pass + def name(self, chr, default=...): pass def normalize(self, form, unistr): pass - def numeric(self, chr, default=Undefined): pass + def numeric(self, chr, default=...): pass diff --git a/stubs/3.2/unittest.pyi b/stubs/3.2/unittest.pyi index c065cd7a581c..efd6b2ffa89d 100644 --- a/stubs/3.2/unittest.pyi +++ b/stubs/3.2/unittest.pyi @@ -8,7 +8,7 @@ # Only a subset of functionality is included. from typing import ( - Any, Callable, Iterable, Undefined, Tuple, List, TextIO, Sequence, + Any, Callable, Iterable, Tuple, List, TextIO, Sequence, overload, TypeVar, Pattern ) from abc import abstractmethod, ABCMeta @@ -27,8 +27,8 @@ class Testable(metaclass=ABCMeta): # TODO ABC for test runners? class TestResult: - errors = Undefined(List[Tuple[Testable, str]]) - failures = Undefined(List[Tuple[Testable, str]]) + errors = ... # type: List[Tuple[Testable, str]] + failures = ... # type: List[Tuple[Testable, str]] testsRun = 0 shouldStop = False @@ -43,18 +43,18 @@ class TestResult: def addSuccess(self, test: Testable) -> None: pass class _AssertRaisesBaseContext: - expected = Undefined(Any) - failureException = Undefined(type) + expected = ... # type: Any + failureException = ... # type: type obj_name = '' - expected_regex = Undefined(Pattern[str]) + expected_regex = ... # type: Pattern[str] class _AssertRaisesContext(_AssertRaisesBaseContext): - exception = Undefined(Any) # TODO precise type + exception = ... # type: Any # TODO precise type def __enter__(self) -> _AssertRaisesContext: pass def __exit__(self, exc_type, exc_value, tb) -> bool: pass class _AssertWarnsContext(_AssertRaisesBaseContext): - warning = Undefined(Any) # TODO precise type + warning = ... # type: Any # TODO precise type filename = '' lineno = 0 def __enter__(self) -> _AssertWarnsContext: pass diff --git a/stubs/3.2/urllib/parse.pyi b/stubs/3.2/urllib/parse.pyi index 41279b9b1227..db36f8db0987 100644 --- a/stubs/3.2/urllib/parse.pyi +++ b/stubs/3.2/urllib/parse.pyi @@ -1,5 +1,5 @@ # Stubs for urllib.parse -from typing import List, Dict, Tuple, AnyStr, Undefined, Generic, overload, Sequence, Mapping +from typing import List, Dict, Tuple, AnyStr, Generic, overload, Sequence, Mapping __all__ = ( 'urlparse', @@ -32,10 +32,10 @@ class _ResultMixinBytes(_ResultMixinBase[str]): class _NetlocResultMixinBase(Generic[AnyStr]): - username = Undefined(AnyStr) - password = Undefined(AnyStr) - hostname = Undefined(AnyStr) - port = Undefined(int) + username = ... # type: AnyStr + password = ... # type: AnyStr + hostname = ... # type: AnyStr + port = ... # type: int class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): pass @@ -43,23 +43,23 @@ class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): pass class _NetlocResultMixinBytes(_NetlocResultMixinBase[str], _ResultMixinBytes): pass class _DefragResultBase(tuple, Generic[AnyStr]): - url = Undefined(AnyStr) - fragment = Undefined(AnyStr) + url = ... # type: AnyStr + fragment = ... # type: AnyStr class _SplitResultBase(tuple, Generic[AnyStr]): - scheme = Undefined(AnyStr) - netloc = Undefined(AnyStr) - path = Undefined(AnyStr) - query = Undefined(AnyStr) - fragment = Undefined(AnyStr) + scheme = ... # type: AnyStr + netloc = ... # type: AnyStr + path = ... # type: AnyStr + query = ... # type: AnyStr + fragment = ... # type: AnyStr class _ParseResultBase(tuple, Generic[AnyStr]): - scheme = Undefined(AnyStr) - netloc = Undefined(AnyStr) - path = Undefined(AnyStr) - params = Undefined(AnyStr) - query = Undefined(AnyStr) - fragment = Undefined(AnyStr) + scheme = ... # type: AnyStr + netloc = ... # type: AnyStr + path = ... # type: AnyStr + params = ... # type: AnyStr + query = ... # type: AnyStr + fragment = ... # type: AnyStr # Structured result objects for string data class DefragResult(_DefragResultBase[str], _ResultMixinStr): pass diff --git a/stubs/3.2/webbrowser.pyi b/stubs/3.2/webbrowser.pyi index aff590ea9e65..2f8d152c45b1 100644 --- a/stubs/3.2/webbrowser.pyi +++ b/stubs/3.2/webbrowser.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any class Error(Exception): pass @@ -13,18 +13,18 @@ def open_new(url): pass def open_new_tab(url): pass class BaseBrowser: - args = Undefined(Any) - name = Undefined(Any) - basename = Undefined(Any) + args = ... # type: Any + name = ... # type: Any + basename = ... # type: Any def __init__(self, name=''): pass def open(self, url, new=0, autoraise=True): pass def open_new(self, url): pass def open_new_tab(self, url): pass class GenericBrowser(BaseBrowser): - name = Undefined(Any) - args = Undefined(Any) - basename = Undefined(Any) + name = ... # type: Any + args = ... # type: Any + basename = ... # type: Any def __init__(self, name): pass def open(self, url, new=0, autoraise=True): pass @@ -32,52 +32,52 @@ class BackgroundBrowser(GenericBrowser): def open(self, url, new=0, autoraise=True): pass class UnixBrowser(BaseBrowser): - raise_opts = Undefined(Any) - background = Undefined(Any) - redirect_stdout = Undefined(Any) - remote_args = Undefined(Any) - remote_action = Undefined(Any) - remote_action_newwin = Undefined(Any) - remote_action_newtab = Undefined(Any) + raise_opts = ... # type: Any + background = ... # type: Any + redirect_stdout = ... # type: Any + remote_args = ... # type: Any + remote_action = ... # type: Any + remote_action_newwin = ... # type: Any + remote_action_newtab = ... # type: Any def open(self, url, new=0, autoraise=True): pass class Mozilla(UnixBrowser): - raise_opts = Undefined(Any) - remote_args = Undefined(Any) - remote_action = Undefined(Any) - remote_action_newwin = Undefined(Any) - remote_action_newtab = Undefined(Any) - background = Undefined(Any) + raise_opts = ... # type: Any + remote_args = ... # type: Any + remote_action = ... # type: Any + remote_action_newwin = ... # type: Any + remote_action_newtab = ... # type: Any + background = ... # type: Any class Galeon(UnixBrowser): - raise_opts = Undefined(Any) - remote_args = Undefined(Any) - remote_action = Undefined(Any) - remote_action_newwin = Undefined(Any) - background = Undefined(Any) + raise_opts = ... # type: Any + remote_args = ... # type: Any + remote_action = ... # type: Any + remote_action_newwin = ... # type: Any + background = ... # type: Any class Chrome(UnixBrowser): - remote_args = Undefined(Any) - remote_action = Undefined(Any) - remote_action_newwin = Undefined(Any) - remote_action_newtab = Undefined(Any) - background = Undefined(Any) + remote_args = ... # type: Any + remote_action = ... # type: Any + remote_action_newwin = ... # type: Any + remote_action_newtab = ... # type: Any + background = ... # type: Any class Opera(UnixBrowser): - raise_opts = Undefined(Any) - remote_args = Undefined(Any) - remote_action = Undefined(Any) - remote_action_newwin = Undefined(Any) - remote_action_newtab = Undefined(Any) - background = Undefined(Any) + raise_opts = ... # type: Any + remote_args = ... # type: Any + remote_action = ... # type: Any + remote_action_newwin = ... # type: Any + remote_action_newtab = ... # type: Any + background = ... # type: Any class Elinks(UnixBrowser): - remote_args = Undefined(Any) - remote_action = Undefined(Any) - remote_action_newwin = Undefined(Any) - remote_action_newtab = Undefined(Any) - background = Undefined(Any) - redirect_stdout = Undefined(Any) + remote_args = ... # type: Any + remote_action = ... # type: Any + remote_action_newwin = ... # type: Any + remote_action_newtab = ... # type: Any + background = ... # type: Any + redirect_stdout = ... # type: Any class Konqueror(BaseBrowser): def open(self, url, new=0, autoraise=True): pass @@ -89,7 +89,7 @@ class WindowsDefault(BaseBrowser): def open(self, url, new=0, autoraise=True): pass class MacOSX(BaseBrowser): - name = Undefined(Any) + name = ... # type: Any def __init__(self, name): pass def open(self, url, new=0, autoraise=True): pass diff --git a/stubs/3.2/xml/etree/ElementInclude.pyi b/stubs/3.2/xml/etree/ElementInclude.pyi index 33440e11c608..5bae20479402 100644 --- a/stubs/3.2/xml/etree/ElementInclude.pyi +++ b/stubs/3.2/xml/etree/ElementInclude.pyi @@ -2,11 +2,11 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any -XINCLUDE = Undefined(Any) -XINCLUDE_INCLUDE = Undefined(Any) -XINCLUDE_FALLBACK = Undefined(Any) +XINCLUDE = ... # type: Any +XINCLUDE_INCLUDE = ... # type: Any +XINCLUDE_FALLBACK = ... # type: Any class FatalIncludeError(SyntaxError): pass diff --git a/stubs/3.2/xml/etree/ElementPath.pyi b/stubs/3.2/xml/etree/ElementPath.pyi index 439d8f7a69fc..ecb864c42947 100644 --- a/stubs/3.2/xml/etree/ElementPath.pyi +++ b/stubs/3.2/xml/etree/ElementPath.pyi @@ -2,9 +2,9 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any -xpath_tokenizer_re = Undefined(Any) +xpath_tokenizer_re = ... # type: Any def xpath_tokenizer(pattern, namespaces=None): pass def get_parent_map(context): pass @@ -15,11 +15,11 @@ def prepare_descendant(next, token): pass def prepare_parent(next, token): pass def prepare_predicate(next, token): pass -ops = Undefined(Any) +ops = ... # type: Any class _SelectorContext: - parent_map = Undefined(Any) - root = Undefined(Any) + parent_map = ... # type: Any + root = ... # type: Any def __init__(self, root): pass def iterfind(elem, path, namespaces=None): pass diff --git a/stubs/3.2/xml/etree/ElementTree.pyi b/stubs/3.2/xml/etree/ElementTree.pyi index c1ff08085c4c..36d2f3350d88 100644 --- a/stubs/3.2/xml/etree/ElementTree.pyi +++ b/stubs/3.2/xml/etree/ElementTree.pyi @@ -2,30 +2,30 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any import io -VERSION = Undefined(Any) +VERSION = ... # type: Any class ParseError(SyntaxError): pass def iselement(element): pass class Element: - def __init__(self, tag, attrib=Undefined, **extra): pass + def __init__(self, tag, attrib=..., **extra): pass def append(self, *args, **kwargs): pass def clear(self, *args, **kwargs): pass def extend(self, *args, **kwargs): pass def find(self, *args, **kwargs): pass def findall(self, *args, **kwargs): pass - def findtext(self, match, default=Undefined, namespaces=Undefined): pass + def findtext(self, match, default=..., namespaces=...): pass def get(self, *args, **kwargs): pass def getchildren(self): pass - def getiterator(self, tag=Undefined): pass + def getiterator(self, tag=...): pass def insert(self, *args, **kwargs): pass def items(self, *args, **kwargs): pass def iter(self, *args, **kwargs): pass - def iterfind(self, match, namespaces=Undefined): pass + def iterfind(self, match, namespaces=...): pass def itertext(self): pass def keys(self): pass def makeelement(self, tag, attrib): pass @@ -43,14 +43,14 @@ class Element: def __setstate__(self, state): pass def __sizeof__(self): pass -def SubElement(parent, tag, attrib=Undefined, **extra): pass +def SubElement(parent, tag, attrib=..., **extra): pass def Comment(text=None): pass def ProcessingInstruction(target, text=None): pass -PI = Undefined(Any) +PI = ... # type: Any class QName: - text = Undefined(Any) + text = ... # type: Any def __init__(self, text_or_uri, tag=None): pass def __hash__(self): pass def __le__(self, other): pass @@ -77,7 +77,7 @@ def register_namespace(prefix, uri): pass def tostring(element, encoding=None, method=None, *, short_empty_elements=True): pass class _ListDataStream(io.BufferedIOBase): - lst = Undefined(Any) + lst = ... # type: Any def __init__(self, lst): pass def writable(self): pass def seekable(self): pass @@ -96,7 +96,7 @@ class XMLPullParser: def read_events(self): pass class _IterParseIterator: - root = Undefined(Any) + root = ... # type: Any def __init__(self, source, events, parser, close_source=False): pass def __next__(self): pass def __iter__(self): pass @@ -104,7 +104,7 @@ class _IterParseIterator: def XML(text, parser=None): pass def XMLID(text, parser=None): pass -fromstring = Undefined(Any) +fromstring = ... # type: Any def fromstringlist(sequence, parser=None): pass @@ -116,10 +116,10 @@ class TreeBuilder: def end(self, tag): pass class XMLParser: - target = Undefined(Any) - entity = Undefined(Any) - version = Undefined(Any) - def __init__(self, html=Undefined, target=Undefined, encoding=Undefined): pass + target = ... # type: Any + entity = ... # type: Any + version = ... # type: Any + def __init__(self, html=..., target=..., encoding=...): pass def _parse_whole(self, *args, **kwargs): pass def _setevents(self, *args, **kwargs): pass def close(self, *args, **kwargs): pass diff --git a/stubs/3.2/zipfile.pyi b/stubs/3.2/zipfile.pyi index 04e2f06d9e6a..3cfc353fed60 100644 --- a/stubs/3.2/zipfile.pyi +++ b/stubs/3.2/zipfile.pyi @@ -1,6 +1,6 @@ # TODO these are incomplete -from typing import List, Undefined, Tuple, BinaryIO, Union +from typing import List, Tuple, BinaryIO, Union ZIP_STORED = 0 ZIP_DEFLATED = 0 @@ -9,7 +9,7 @@ def is_zipfile(filename: Union[str, BinaryIO]) -> bool: pass class ZipInfo: filename = '' - date_time = Undefined(Tuple[int, int, int, int, int, int]) + date_time = ... # type: Tuple[int, int, int, int, int, int] compressed_size = 0 file_size = 0 diff --git a/stubs/3.2/zlib.pyi b/stubs/3.2/zlib.pyi index e2aceb1af078..8a40d3d2214d 100644 --- a/stubs/3.2/zlib.pyi +++ b/stubs/3.2/zlib.pyi @@ -2,33 +2,31 @@ # # NOTE: This stub was automatically generated by stubgen. -from typing import Undefined - # TODO: Compress and Decompress classes are not published by the module. -DEFLATED = Undefined(int) -DEF_BUF_SIZE = Undefined(int) -DEF_MEM_LEVEL = Undefined(int) -MAX_WBITS = Undefined(int) -ZLIB_RUNTIME_VERSION = Undefined(str) -ZLIB_VERSION = Undefined(str) -Z_BEST_COMPRESSION = Undefined(int) -Z_BEST_SPEED = Undefined(int) -Z_DEFAULT_COMPRESSION = Undefined(int) -Z_DEFAULT_STRATEGY = Undefined(int) -Z_FILTERED = Undefined(int) -Z_FINISH = Undefined(int) -Z_FULL_FLUSH = Undefined(int) -Z_HUFFMAN_ONLY = Undefined(int) -Z_NO_FLUSH = Undefined(int) -Z_SYNC_FLUSH = Undefined(int) +DEFLATED = ... # type: int +DEF_BUF_SIZE = ... # type: int +DEF_MEM_LEVEL = ... # type: int +MAX_WBITS = ... # type: int +ZLIB_RUNTIME_VERSION = ... # type: str +ZLIB_VERSION = ... # type: str +Z_BEST_COMPRESSION = ... # type: int +Z_BEST_SPEED = ... # type: int +Z_DEFAULT_COMPRESSION = ... # type: int +Z_DEFAULT_STRATEGY = ... # type: int +Z_FILTERED = ... # type: int +Z_FINISH = ... # type: int +Z_FULL_FLUSH = ... # type: int +Z_HUFFMAN_ONLY = ... # type: int +Z_NO_FLUSH = ... # type: int +Z_SYNC_FLUSH = ... # type: int -def adler32(data, value=Undefined) -> int: pass +def adler32(data, value=...) -> int: pass def compress(data, level: int = 6): pass -def compressobj(level=Undefined, method=Undefined, wbits=Undefined, memlevel=Undefined, - strategy=Undefined, zdict=Undefined): pass -def crc32(data, value=Undefined) -> int: pass -def decompress(data, wbits=Undefined, bufsize=Undefined): pass -def decompressobj(wbits=Undefined, zdict=Undefined): pass +def compressobj(level=..., method=..., wbits=..., memlevel=..., + strategy=..., zdict=...): pass +def crc32(data, value=...) -> int: pass +def decompress(data, wbits=..., bufsize=...): pass +def decompressobj(wbits=..., zdict=...): pass class error(Exception): pass diff --git a/stubs/3.4/asyncio/__init__.pyi b/stubs/3.4/asyncio/__init__.pyi index 98d3092224a9..b7977c2a62cf 100644 --- a/stubs/3.4/asyncio/__init__.pyi +++ b/stubs/3.4/asyncio/__init__.pyi @@ -7,4 +7,4 @@ from asyncio.events import (AbstractEventLoopPolicy, AbstractEventLoop, __all__ = (futures.__all__, tasks.__all__, - events.__all__) \ No newline at end of file + events.__all__) diff --git a/stubs/3.4/asyncio/events.pyi b/stubs/3.4/asyncio/events.pyi index e561c9f11c50..ea10de32e7b4 100644 --- a/stubs/3.4/asyncio/events.pyi +++ b/stubs/3.4/asyncio/events.pyi @@ -1,4 +1,4 @@ -from typing import Any, TypeVar, List, Callable, Tuple, Union, Dict, Undefined +from typing import Any, TypeVar, List, Callable, Tuple, Union, Dict from abc import ABCMeta, abstractmethod from asyncio.futures import Future @@ -14,7 +14,7 @@ __all__ = ['AbstractEventLoopPolicy', 'AbstractEventLoop', 'Handle', 'get_event_ _T = TypeVar('_T') -PIPE = Undefined(Any) # from subprocess.PIPE +PIPE = ... # type: Any # from subprocess.PIPE AF_UNSPEC = 0 # from socket AI_PASSIVE = 0 diff --git a/stubs/3.4/pathlib.pyi b/stubs/3.4/pathlib.pyi index 0104fda7c7a7..1e297da9b9ac 100644 --- a/stubs/3.4/pathlib.pyi +++ b/stubs/3.4/pathlib.pyi @@ -2,25 +2,25 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Undefined, Any +from typing import Any from collections import Sequence class _Flavour: - join = Undefined(Any) + join = ... # type: Any def __init__(self): pass def parse_parts(self, parts): pass def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2): pass class _WindowsFlavour(_Flavour): - sep = Undefined(Any) - altsep = Undefined(Any) - has_drv = Undefined(Any) - pathmod = Undefined(Any) - is_supported = Undefined(Any) - drive_letters = Undefined(Any) - ext_namespace_prefix = Undefined(Any) - reserved_names = Undefined(Any) - def splitroot(self, part, sep=Undefined): pass + sep = ... # type: Any + altsep = ... # type: Any + has_drv = ... # type: Any + pathmod = ... # type: Any + is_supported = ... # type: Any + drive_letters = ... # type: Any + ext_namespace_prefix = ... # type: Any + reserved_names = ... # type: Any + def splitroot(self, part, sep=...): pass def casefold(self, s): pass def casefold_parts(self, parts): pass def resolve(self, path): pass @@ -28,12 +28,12 @@ class _WindowsFlavour(_Flavour): def make_uri(self, path): pass class _PosixFlavour(_Flavour): - sep = Undefined(Any) - altsep = Undefined(Any) - has_drv = Undefined(Any) - pathmod = Undefined(Any) - is_supported = Undefined(Any) - def splitroot(self, part, sep=Undefined): pass + sep = ... # type: Any + altsep = ... # type: Any + has_drv = ... # type: Any + pathmod = ... # type: Any + is_supported = ... # type: Any + def splitroot(self, part, sep=...): pass def casefold(self, s): pass def casefold_parts(self, parts): pass def resolve(self, path): pass @@ -43,35 +43,35 @@ class _PosixFlavour(_Flavour): class _Accessor: pass class _NormalAccessor(_Accessor): - stat = Undefined(Any) - lstat = Undefined(Any) - open = Undefined(Any) - listdir = Undefined(Any) - chmod = Undefined(Any) - lchmod = Undefined(Any) - mkdir = Undefined(Any) - unlink = Undefined(Any) - rmdir = Undefined(Any) - rename = Undefined(Any) - replace = Undefined(Any) + stat = ... # type: Any + lstat = ... # type: Any + open = ... # type: Any + listdir = ... # type: Any + chmod = ... # type: Any + lchmod = ... # type: Any + mkdir = ... # type: Any + unlink = ... # type: Any + rmdir = ... # type: Any + rename = ... # type: Any + replace = ... # type: Any def symlink(a, b, target_is_directory): pass - utime = Undefined(Any) + utime = ... # type: Any def readlink(self, path): pass class _Selector: - child_parts = Undefined(Any) - successor = Undefined(Any) + child_parts = ... # type: Any + successor = ... # type: Any def __init__(self, child_parts): pass def select_from(self, parent_path): pass class _TerminatingSelector: pass class _PreciseSelector(_Selector): - name = Undefined(Any) + name = ... # type: Any def __init__(self, name, child_parts): pass class _WildcardSelector(_Selector): - pat = Undefined(Any) + pat = ... # type: Any def __init__(self, pat, child_parts): pass class _RecursiveWildcardSelector(_Selector): @@ -95,8 +95,8 @@ class PurePath: def __le__(self, other): pass def __gt__(self, other): pass def __ge__(self, other): pass - drive = Undefined(Any) - root = Undefined(Any) + drive = ... # type: Any + root = ... # type: Any @property def anchor(self): pass @property