diff -Nru python-typing-extensions-3.7.4.2/debian/changelog python-typing-extensions-3.7.4.3/debian/changelog --- python-typing-extensions-3.7.4.2/debian/changelog 2020-04-06 17:14:29.000000000 +0000 +++ python-typing-extensions-3.7.4.3/debian/changelog 2020-10-08 13:07:27.000000000 +0000 @@ -1,3 +1,17 @@ +python-typing-extensions (3.7.4.3-1) unstable; urgency=medium + + [ Michael R. Crusoe ] + * Move source package to DPMT. + * New upstream version + * debhelper-compat 13 (routine-update) + * Remove malformed lintian override + + [ Ondřej Nový ] + * d/control: Update Vcs-* fields with new Debian Python Team Salsa + layout. + + -- Michael R. Crusoe Thu, 08 Oct 2020 15:07:27 +0200 + python-typing-extensions (3.7.4.2-1) unstable; urgency=medium * New upstream version diff -Nru python-typing-extensions-3.7.4.2/debian/control python-typing-extensions-3.7.4.3/debian/control --- python-typing-extensions-3.7.4.2/debian/control 2020-04-06 12:01:51.000000000 +0000 +++ python-typing-extensions-3.7.4.3/debian/control 2020-10-08 13:07:27.000000000 +0000 @@ -1,15 +1,15 @@ Source: python-typing-extensions -Maintainer: Michael R. Crusoe +Maintainer: Michael R. Crusoe Section: python Testsuite: autopkgtest-pkg-python Priority: optional -Build-Depends: debhelper-compat (= 12), +Build-Depends: debhelper-compat (= 13), dh-python, python3-all, python3-setuptools Standards-Version: 4.5.0 -Vcs-Browser: https://salsa.debian.org/med-team/python-typing-extensions -Vcs-Git: https://salsa.debian.org/med-team/python-typing-extensions.git +Vcs-Browser: https://salsa.debian.org/python-team/packages/python-typing-extensions +Vcs-Git: https://salsa.debian.org/python-team/packages/python-typing-extensions.git Homepage: https://pypi.python.org/pypi/typing-extensions/ Rules-Requires-Root: no diff -Nru python-typing-extensions-3.7.4.2/debian/source/lintian-overrides python-typing-extensions-3.7.4.3/debian/source/lintian-overrides --- python-typing-extensions-3.7.4.2/debian/source/lintian-overrides 2019-07-23 10:09:48.000000000 +0000 +++ python-typing-extensions-3.7.4.3/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -python-typing source: python-foo-but-no-python3-foo python-typing diff -Nru python-typing-extensions-3.7.4.2/PKG-INFO python-typing-extensions-3.7.4.3/PKG-INFO --- python-typing-extensions-3.7.4.2/PKG-INFO 2020-04-02 17:20:22.907262800 +0000 +++ python-typing-extensions-3.7.4.3/PKG-INFO 2020-08-23 16:33:40.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: typing_extensions -Version: 3.7.4.2 +Version: 3.7.4.3 Summary: Backported and Experimental Type Hints for Python 3.5+ Home-page: https://github.com/python/typing/blob/master/typing_extensions/README.rst Author: Guido van Rossum, Jukka Lehtosalo, Lukasz Langa, Michael Lee diff -Nru python-typing-extensions-3.7.4.2/setup.py python-typing-extensions-3.7.4.3/setup.py --- python-typing-extensions-3.7.4.2/setup.py 2020-04-02 17:19:42.000000000 +0000 +++ python-typing-extensions-3.7.4.3/setup.py 2020-08-23 16:32:30.000000000 +0000 @@ -9,7 +9,7 @@ 'to install the typing package.\n') exit(1) -version = '3.7.4.2' +version = '3.7.4.3' description = 'Backported and Experimental Type Hints for Python 3.5+' long_description = '''\ Typing Extensions -- Backported and Experimental Type Hints for Python diff -Nru python-typing-extensions-3.7.4.2/src_py2/test_typing_extensions.py python-typing-extensions-3.7.4.3/src_py2/test_typing_extensions.py --- python-typing-extensions-3.7.4.2/src_py2/test_typing_extensions.py 2020-02-11 18:17:38.000000000 +0000 +++ python-typing-extensions-3.7.4.3/src_py2/test_typing_extensions.py 2020-07-07 22:29:25.000000000 +0000 @@ -7,7 +7,7 @@ from typing_extensions import Annotated, NoReturn, ClassVar, IntVar from typing_extensions import ContextManager, Counter, Deque, DefaultDict -from typing_extensions import NewType, overload +from typing_extensions import NewType, TypeAlias, overload from typing import Dict, List import typing import typing_extensions @@ -377,6 +377,47 @@ self.assertEqual(X[int], List[Annotated[int, 5]]) +class TypeAliasTests(BaseTestCase): + def test_canonical_usage(self): + Alias = Employee # type: TypeAlias + + def test_cannot_instantiate(self): + with self.assertRaises(TypeError): + TypeAlias() + + def test_no_isinstance(self): + with self.assertRaises(TypeError): + isinstance(42, TypeAlias) + + def test_no_issubclass(self): + with self.assertRaises(TypeError): + issubclass(Employee, TypeAlias) + + with self.assertRaises(TypeError): + issubclass(TypeAlias, Employee) + + def test_cannot_subclass(self): + with self.assertRaises(TypeError): + class C(TypeAlias): + pass + + with self.assertRaises(TypeError): + class C(type(TypeAlias)): + pass + + def test_repr(self): + if hasattr(typing, 'TypeAlias'): + self.assertEqual(repr(TypeAlias), 'typing.TypeAlias') + self.assertEqual(repr(type(TypeAlias)), 'typing.TypeAlias') + else: + self.assertEqual(repr(TypeAlias), 'typing_extensions.TypeAlias') + self.assertEqual(repr(type(TypeAlias)), 'typing_extensions.TypeAlias') + + def test_cannot_subscript(self): + with self.assertRaises(TypeError): + TypeAlias[int] + + class AllTests(BaseTestCase): def test_typing_extensions_includes_standard(self): diff -Nru python-typing-extensions-3.7.4.2/src_py2/typing_extensions.py python-typing-extensions-3.7.4.3/src_py2/typing_extensions.py --- python-typing-extensions-3.7.4.2/src_py2/typing_extensions.py 2020-02-11 18:17:38.000000000 +0000 +++ python-typing-extensions-3.7.4.3/src_py2/typing_extensions.py 2020-07-07 22:29:25.000000000 +0000 @@ -5,6 +5,7 @@ ClassVar, Type, Generic, Callable, GenericMeta, TypingMeta, Counter, DefaultDict, Deque, TypeVar, Tuple, Final, final, NewType, overload, Text, TYPE_CHECKING, Literal, TypedDict, Protocol, + SupportsIndex, runtime_checkable, # We use internal typing helpers here, but this significantly reduces # code duplication. (Also this is only until Protocol is in typing.) @@ -26,6 +27,9 @@ 'Deque', 'DefaultDict', + # Structural checks, a.k.a. protocols. + 'SupportsIndex', + # One-off things. 'final', 'IntVar', @@ -237,5 +241,43 @@ __slots__ = () +class _TypeAliasMeta(typing.TypingMeta): + """Metaclass for TypeAlias""" + + def __new__(cls, name, bases, namespace): + cls.assert_no_subclassing(bases) + self = super(_TypeAliasMeta, cls).__new__(cls, name, bases, namespace) + return self + + def __repr__(self): + return 'typing_extensions.TypeAlias' + + +class _TypeAliasBase(typing._FinalTypingBase): + """Special marker indicating that an assignment should + be recognized as a proper type alias definition by type + checkers. + + For example:: + + Predicate = Callable[..., bool] # type: TypeAlias + + It's invalid when used anywhere except as in the example above. + """ + __metaclass__ = _TypeAliasMeta + __slots__ = () + + def __instancecheck__(self, obj): + raise TypeError("TypeAlias cannot be used with isinstance().") + + def __subclasscheck__(self, cls): + raise TypeError("TypeAlias cannot be used with issubclass().") + + def __repr__(self): + return 'typing_extensions.TypeAlias' + + +TypeAlias = _TypeAliasBase(_root=True) + # This alias exists for backwards compatibility. runtime = runtime_checkable diff -Nru python-typing-extensions-3.7.4.2/src_py3/test_typing_extensions.py python-typing-extensions-3.7.4.3/src_py3/test_typing_extensions.py --- python-typing-extensions-3.7.4.2/src_py3/test_typing_extensions.py 2020-02-12 00:51:39.000000000 +0000 +++ python-typing-extensions-3.7.4.3/src_py3/test_typing_extensions.py 2020-07-07 22:29:25.000000000 +0000 @@ -13,6 +13,7 @@ from typing import Generic from typing import no_type_check from typing_extensions import NoReturn, ClassVar, Final, IntVar, Literal, Type, NewType, TypedDict +from typing_extensions import TypeAlias try: from typing_extensions import Protocol, runtime, runtime_checkable except ImportError: @@ -1588,13 +1589,17 @@ class AnnotatedTests(BaseTestCase): def test_repr(self): + if hasattr(typing, 'Annotated'): + mod_name = 'typing' + else: + mod_name = "typing_extensions" self.assertEqual( repr(Annotated[int, 4, 5]), - "typing_extensions.Annotated[int, 4, 5]" + mod_name + ".Annotated[int, 4, 5]" ) self.assertEqual( repr(Annotated[List[int], 4, 5]), - "typing_extensions.Annotated[typing.List[int], 4, 5]" + mod_name + ".Annotated[typing.List[int], 4, 5]" ) def test_flatten(self): @@ -1822,6 +1827,52 @@ ) +class TypeAliasTests(BaseTestCase): + @skipUnless(PY36, 'Python 3.6 required') + def test_canonical_usage_with_variable_annotation(self): + ns = {} + exec('Alias: TypeAlias = Employee', globals(), ns) + + def test_canonical_usage_with_type_comment(self): + Alias = Employee # type: TypeAlias + + def test_cannot_instantiate(self): + with self.assertRaises(TypeError): + TypeAlias() + + def test_no_isinstance(self): + with self.assertRaises(TypeError): + isinstance(42, TypeAlias) + + def test_no_issubclass(self): + with self.assertRaises(TypeError): + issubclass(Employee, TypeAlias) + + if SUBCLASS_CHECK_FORBIDDEN: + with self.assertRaises(TypeError): + issubclass(TypeAlias, Employee) + + def test_cannot_subclass(self): + with self.assertRaises(TypeError): + class C(TypeAlias): + pass + + if SUBCLASS_CHECK_FORBIDDEN: + with self.assertRaises(TypeError): + class C(type(TypeAlias)): + pass + + def test_repr(self): + if hasattr(typing, 'TypeAlias'): + self.assertEqual(repr(TypeAlias), 'typing.TypeAlias') + else: + self.assertEqual(repr(TypeAlias), 'typing_extensions.TypeAlias') + + def test_cannot_subscript(self): + with self.assertRaises(TypeError): + TypeAlias[int] + + class AllTests(BaseTestCase): def test_typing_extensions_includes_standard(self): diff -Nru python-typing-extensions-3.7.4.2/src_py3/typing_extensions.egg-info/PKG-INFO python-typing-extensions-3.7.4.3/src_py3/typing_extensions.egg-info/PKG-INFO --- python-typing-extensions-3.7.4.2/src_py3/typing_extensions.egg-info/PKG-INFO 2020-04-02 17:20:22.000000000 +0000 +++ python-typing-extensions-3.7.4.3/src_py3/typing_extensions.egg-info/PKG-INFO 2020-08-23 16:33:40.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: typing-extensions -Version: 3.7.4.2 +Version: 3.7.4.3 Summary: Backported and Experimental Type Hints for Python 3.5+ Home-page: https://github.com/python/typing/blob/master/typing_extensions/README.rst Author: Guido van Rossum, Jukka Lehtosalo, Lukasz Langa, Michael Lee diff -Nru python-typing-extensions-3.7.4.2/src_py3/typing_extensions.py python-typing-extensions-3.7.4.3/src_py3/typing_extensions.py --- python-typing-extensions-3.7.4.2/src_py3/typing_extensions.py 2020-02-12 00:51:39.000000000 +0000 +++ python-typing-extensions-3.7.4.3/src_py3/typing_extensions.py 2020-07-07 22:29:25.000000000 +0000 @@ -136,6 +136,9 @@ 'DefaultDict', 'TypedDict', + # Structural checks, a.k.a. protocols. + 'SupportsIndex', + # One-off things. 'final', 'IntVar', @@ -1569,6 +1572,18 @@ runtime = runtime_checkable +if hasattr(typing, 'SupportsIndex'): + SupportsIndex = typing.SupportsIndex +elif HAVE_PROTOCOLS: + @runtime_checkable + class SupportsIndex(Protocol): + __slots__ = () + + @abc.abstractmethod + def __index__(self) -> int: + pass + + if sys.version_info[:2] >= (3, 9): # The standard library TypedDict in Python 3.8 does not store runtime information # about which (if any) keys are optional. See https://bugs.python.org/issue38834 @@ -2056,3 +2071,98 @@ res = (list(res[:-1]), res[-1]) return res return () + + +if hasattr(typing, 'TypeAlias'): + TypeAlias = typing.TypeAlias +elif sys.version_info[:2] >= (3, 9): + class _TypeAliasForm(typing._SpecialForm, _root=True): + def __repr__(self): + return 'typing_extensions.' + self._name + + @_TypeAliasForm + def TypeAlias(self, parameters): + """Special marker indicating that an assignment should + be recognized as a proper type alias definition by type + checkers. + + For example:: + + Predicate: TypeAlias = Callable[..., bool] + + It's invalid when used anywhere except as in the example above. + """ + raise TypeError("{} is not subscriptable".format(self)) + +elif sys.version_info[:2] >= (3, 7): + class _TypeAliasForm(typing._SpecialForm, _root=True): + def __repr__(self): + return 'typing_extensions.' + self._name + + TypeAlias = _TypeAliasForm('TypeAlias', + doc="""Special marker indicating that an assignment should + be recognized as a proper type alias definition by type + checkers. + + For example:: + + Predicate: TypeAlias = Callable[..., bool] + + It's invalid when used anywhere except as in the example + above.""") + +elif hasattr(typing, '_FinalTypingBase'): + class _TypeAliasMeta(typing.TypingMeta): + """Metaclass for TypeAlias""" + + def __repr__(self): + return 'typing_extensions.TypeAlias' + + class _TypeAliasBase(typing._FinalTypingBase, metaclass=_TypeAliasMeta, _root=True): + """Special marker indicating that an assignment should + be recognized as a proper type alias definition by type + checkers. + + For example:: + + Predicate: TypeAlias = Callable[..., bool] + + It's invalid when used anywhere except as in the example above. + """ + __slots__ = () + + def __instancecheck__(self, obj): + raise TypeError("TypeAlias cannot be used with isinstance().") + + def __subclasscheck__(self, cls): + raise TypeError("TypeAlias cannot be used with issubclass().") + + def __repr__(self): + return 'typing_extensions.TypeAlias' + + TypeAlias = _TypeAliasBase(_root=True) +else: + class _TypeAliasMeta(typing.TypingMeta): + """Metaclass for TypeAlias""" + + def __instancecheck__(self, obj): + raise TypeError("TypeAlias cannot be used with isinstance().") + + def __subclasscheck__(self, cls): + raise TypeError("TypeAlias cannot be used with issubclass().") + + def __call__(self, *args, **kwargs): + raise TypeError("Cannot instantiate TypeAlias") + + class TypeAlias(metaclass=_TypeAliasMeta, _root=True): + """Special marker indicating that an assignment should + be recognized as a proper type alias definition by type + checkers. + + For example:: + + Predicate: TypeAlias = Callable[..., bool] + + It's invalid when used anywhere except as in the example above. + """ + __slots__ = ()