Hello community, here is the log from the commit of package python-typing_extensions for openSUSE:Factory checked in at 2020-10-29 09:48:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-typing_extensions (Old) and /work/SRC/openSUSE:Factory/.python-typing_extensions.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-typing_extensions" Thu Oct 29 09:48:09 2020 rev:8 rq:841925 version:3.7.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-typing_extensions/python-typing_extensions.changes 2020-04-07 10:26:23.326167196 +0200 +++ /work/SRC/openSUSE:Factory/.python-typing_extensions.new.3463/python-typing_extensions.changes 2020-10-29 09:48:15.580165023 +0100 @@ -1,0 +2,7 @@ +Thu Oct 15 12:51:36 UTC 2020 - Dirk Mueller <dmuel...@suse.com> + +- update to version 3.7.4.3: + * enables PEP 613 Typealias to typing_extensions + * Fix tests for Python 3.9 + +------------------------------------------------------------------- Old: ---- typing_extensions-3.7.4.2.tar.gz New: ---- typing_extensions-3.7.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-typing_extensions.spec ++++++ --- /var/tmp/diff_new_pack.sqh9IR/_old 2020-10-29 09:48:16.880166132 +0100 +++ /var/tmp/diff_new_pack.sqh9IR/_new 2020-10-29 09:48:16.880166132 +0100 @@ -20,7 +20,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-typing_extensions -Version: 3.7.4.2 +Version: 3.7.4.3 Release: 0 Summary: Backported and Experimental Type Hints for Python 35+ License: Python-2.0 ++++++ typing_extensions-3.7.4.2.tar.gz -> typing_extensions-3.7.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/typing_extensions-3.7.4.2/PKG-INFO new/typing_extensions-3.7.4.3/PKG-INFO --- old/typing_extensions-3.7.4.2/PKG-INFO 2020-04-02 19:20:22.907262800 +0200 +++ new/typing_extensions-3.7.4.3/PKG-INFO 2020-08-23 18:33:40.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/typing_extensions-3.7.4.2/setup.py new/typing_extensions-3.7.4.3/setup.py --- old/typing_extensions-3.7.4.2/setup.py 2020-04-02 19:19:42.000000000 +0200 +++ new/typing_extensions-3.7.4.3/setup.py 2020-08-23 18:32:30.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/typing_extensions-3.7.4.2/src_py2/test_typing_extensions.py new/typing_extensions-3.7.4.3/src_py2/test_typing_extensions.py --- old/typing_extensions-3.7.4.2/src_py2/test_typing_extensions.py 2020-02-11 19:17:38.000000000 +0100 +++ new/typing_extensions-3.7.4.3/src_py2/test_typing_extensions.py 2020-07-08 00:29:25.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/typing_extensions-3.7.4.2/src_py2/typing_extensions.py new/typing_extensions-3.7.4.3/src_py2/typing_extensions.py --- old/typing_extensions-3.7.4.2/src_py2/typing_extensions.py 2020-02-11 19:17:38.000000000 +0100 +++ new/typing_extensions-3.7.4.3/src_py2/typing_extensions.py 2020-07-08 00:29:25.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/typing_extensions-3.7.4.2/src_py3/test_typing_extensions.py new/typing_extensions-3.7.4.3/src_py3/test_typing_extensions.py --- old/typing_extensions-3.7.4.2/src_py3/test_typing_extensions.py 2020-02-12 01:51:39.000000000 +0100 +++ new/typing_extensions-3.7.4.3/src_py3/test_typing_extensions.py 2020-07-08 00:29:25.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/typing_extensions-3.7.4.2/src_py3/typing_extensions.egg-info/PKG-INFO new/typing_extensions-3.7.4.3/src_py3/typing_extensions.egg-info/PKG-INFO --- old/typing_extensions-3.7.4.2/src_py3/typing_extensions.egg-info/PKG-INFO 2020-04-02 19:20:22.000000000 +0200 +++ new/typing_extensions-3.7.4.3/src_py3/typing_extensions.egg-info/PKG-INFO 2020-08-23 18:33:40.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/typing_extensions-3.7.4.2/src_py3/typing_extensions.py new/typing_extensions-3.7.4.3/src_py3/typing_extensions.py --- old/typing_extensions-3.7.4.2/src_py3/typing_extensions.py 2020-02-12 01:51:39.000000000 +0100 +++ new/typing_extensions-3.7.4.3/src_py3/typing_extensions.py 2020-07-08 00:29:25.000000000 +0200 @@ -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__ = ()