Hello community,
here is the log from the commit of package python-typing_extensions for
openSUSE:Factory checked in at 2019-11-22 10:20:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-typing_extensions (Old)
and /work/SRC/openSUSE:Factory/.python-typing_extensions.new.26869 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-typing_extensions"
Fri Nov 22 10:20:28 2019 rev:5 rq:746074 version:3.7.4.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-typing_extensions/python-typing_extensions.changes
2019-07-31 14:27:44.822205415 +0200
+++
/work/SRC/openSUSE:Factory/.python-typing_extensions.new.26869/python-typing_extensions.changes
2019-11-22 10:20:29.685344369 +0100
@@ -1,0 +2,9 @@
+Wed Nov 6 17:15:46 UTC 2019 - Lars Vogdt <[email protected]>
+
+- Update to version 3.7.4.1:
+ + Fix isinstance() with generic protocol subclasses after subscripting
+ + Fix tests for non-default interpreters
+ + Use environment marker to specify typing dependency
+ + Fix unions of protocols on Python 2
+
+-------------------------------------------------------------------
Old:
----
typing_extensions-3.7.4.tar.gz
New:
----
typing_extensions-3.7.4.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-typing_extensions.spec ++++++
--- /var/tmp/diff_new_pack.ULa2qa/_old 2019-11-22 10:20:31.321343946 +0100
+++ /var/tmp/diff_new_pack.ULa2qa/_new 2019-11-22 10:20:31.325343945 +0100
@@ -19,7 +19,7 @@
%define modname typing_extensions
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-typing_extensions
-Version: 3.7.4
+Version: 3.7.4.1
Release: 0
Summary: Backported and Experimental Type Hints for Python 35+
License: Python-2.0
++++++ typing_extensions-3.7.4.tar.gz -> typing_extensions-3.7.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/typing_extensions-3.7.4/PKG-INFO
new/typing_extensions-3.7.4.1/PKG-INFO
--- old/typing_extensions-3.7.4/PKG-INFO 2019-06-20 02:03:43.000000000
+0200
+++ new/typing_extensions-3.7.4.1/PKG-INFO 2019-10-28 14:28:10.000000000
+0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: typing_extensions
-Version: 3.7.4
+Version: 3.7.4.1
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/README.rst
new/typing_extensions-3.7.4.1/README.rst
--- old/typing_extensions-3.7.4/README.rst 2019-06-19 23:38:29.000000000
+0200
+++ new/typing_extensions-3.7.4.1/README.rst 2019-10-28 14:14:08.000000000
+0100
@@ -38,7 +38,9 @@
- ``Counter``
- ``DefaultDict``
- ``Deque``
+- ``final``
- ``Final``
+- ``Literal``
- ``NewType``
- ``NoReturn``
- ``overload`` (note that older versions of ``typing`` only let you use
``overload`` in stubs)
@@ -46,6 +48,7 @@
- ``runtime`` (except on Python 3.5.0)
- ``Text``
- ``Type``
+- ``TypedDict``
- ``TYPE_CHECKING``
Python 3.4+ only:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/typing_extensions-3.7.4/setup.py
new/typing_extensions-3.7.4.1/setup.py
--- old/typing_extensions-3.7.4/setup.py 2019-06-20 01:07:37.000000000
+0200
+++ new/typing_extensions-3.7.4.1/setup.py 2019-10-28 14:15:18.000000000
+0100
@@ -9,7 +9,7 @@
'to install the typing package.\n')
exit(1)
-version = '3.7.4'
+version = '3.7.4.1'
description = 'Backported and Experimental Type Hints for Python 3.5+'
long_description = '''\
Typing Extensions -- Backported and Experimental Type Hints for Python
@@ -51,10 +51,6 @@
else:
raise AssertionError()
-install_requires = []
-if sys.version_info < (3, 5):
- install_requires.append('typing >= 3.7.4')
-
setup(name='typing_extensions',
version=version,
description=description,
@@ -68,4 +64,4 @@
package_dir={'': package_dir},
py_modules=['typing_extensions'],
classifiers=classifiers,
- install_requires=install_requires)
+ install_requires=["typing >= 3.7.4; python_version < '3.5'"])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/typing_extensions-3.7.4/src_py2/test_typing_extensions.py
new/typing_extensions-3.7.4.1/src_py2/test_typing_extensions.py
--- old/typing_extensions-3.7.4/src_py2/test_typing_extensions.py
2019-06-19 23:38:29.000000000 +0200
+++ new/typing_extensions-3.7.4.1/src_py2/test_typing_extensions.py
2019-08-10 20:55:22.000000000 +0200
@@ -1,16 +1,13 @@
import sys
import os
-import abc
import contextlib
import collections
-import pickle
import subprocess
-import types
-from unittest import TestCase, main, skipUnless
+from unittest import TestCase, main
-from typing_extensions import Annotated, NoReturn, ClassVar, Final, IntVar,
Literal, TypedDict
+from typing_extensions import Annotated, NoReturn, ClassVar, IntVar
from typing_extensions import ContextManager, Counter, Deque, DefaultDict
-from typing_extensions import NewType, overload, Protocol, runtime
+from typing_extensions import NewType, overload
from typing import Dict, List
import typing
import typing_extensions
@@ -121,7 +118,7 @@
class IntVarTests(BaseTestCase):
def test_valid(self):
- T_ints = IntVar("T_ints")
+ T_ints = IntVar("T_ints") # noqa
def test_invalid(self):
with self.assertRaises(TypeError):
@@ -129,7 +126,7 @@
with self.assertRaises(TypeError):
T_ints = IntVar("T_ints", bound=int)
with self.assertRaises(TypeError):
- T_ints = IntVar("T_ints", covariant=True)
+ T_ints = IntVar("T_ints", covariant=True) # noqa
class CollectionsAbcTests(BaseTestCase):
@@ -335,8 +332,8 @@
def test_cannot_subclass(self):
with self.assertRaises(TypeError):
- class C(Annotated):
- pass
+ class C(Annotated):
+ pass
def test_cannot_check_instance(self):
with self.assertRaises(TypeError):
@@ -367,9 +364,9 @@
with self.assertRaises(TypeError):
D[int]
- I = Annotated[int, dec]
+ It = Annotated[int, dec]
with self.assertRaises(TypeError):
- I[None]
+ It[None]
LI = L[int]
with self.assertRaises(TypeError):
@@ -379,6 +376,7 @@
X = List[Annotated[T, 5]]
self.assertEqual(X[int], List[Annotated[int, 5]])
+
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/src_py2/typing_extensions.py
new/typing_extensions-3.7.4.1/src_py2/typing_extensions.py
--- old/typing_extensions-3.7.4/src_py2/typing_extensions.py 2019-06-19
23:38:29.000000000 +0200
+++ new/typing_extensions-3.7.4.1/src_py2/typing_extensions.py 2019-08-10
20:55:22.000000000 +0200
@@ -1,7 +1,7 @@
import abc
-import sys
import typing
-from typing import (
+from typing import ( # noqa
+ # These are imported for re-export.
ClassVar, Type, Generic, Callable, GenericMeta, TypingMeta,
Counter, DefaultDict, Deque, TypeVar, Tuple, Final, final,
NewType, overload, Text, TYPE_CHECKING, Literal, TypedDict, Protocol,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/typing_extensions-3.7.4/src_py3/test_typing_extensions.py
new/typing_extensions-3.7.4.1/src_py3/test_typing_extensions.py
--- old/typing_extensions-3.7.4/src_py3/test_typing_extensions.py
2019-06-19 23:38:29.000000000 +0200
+++ new/typing_extensions-3.7.4.1/src_py3/test_typing_extensions.py
2019-08-10 20:55:22.000000000 +0200
@@ -9,7 +9,7 @@
from unittest import TestCase, main, skipUnless
from typing import TypeVar, Optional
from typing import T, KT, VT # Not in __all__.
-from typing import Tuple, List, Dict
+from typing import Tuple, List, Dict, Iterator
from typing import Generic
from typing import no_type_check
from typing_extensions import NoReturn, ClassVar, Final, IntVar, Literal,
Type, NewType, TypedDict
@@ -34,13 +34,13 @@
OLD_GENERICS = False
try:
- from typing import _type_vars, _next_in_mro, _type_check
+ from typing import _type_vars, _next_in_mro, _type_check # noqa
except ImportError:
OLD_GENERICS = True
# We assume Python versions *below* 3.5.0 will have the most
# up-to-date version of the typing module installed. Since
-# the typing module isn't a part of the standard library in older
+# the typing module isn't a part of the standard library in older
# versions of Python, those users are likely to have a reasonably
# modern version of `typing` installed from PyPi.
TYPING_LATEST = sys.version_info[:3] < (3, 5, 0)
@@ -73,6 +73,7 @@
# Protocols are hard to backport to the original version of typing 3.5.0
HAVE_PROTOCOLS = sys.version_info[:3] != (3, 5, 0)
+
class BaseTestCase(TestCase):
def assertIsSubclass(self, cls, class_or_tuple, msg=None):
if not issubclass(cls, class_or_tuple):
@@ -226,7 +227,7 @@
class IntVarTests(BaseTestCase):
def test_valid(self):
- T_ints = IntVar("T_ints")
+ T_ints = IntVar("T_ints") # noqa
def test_invalid(self):
with self.assertRaises(TypeError):
@@ -234,7 +235,7 @@
with self.assertRaises(TypeError):
T_ints = IntVar("T_ints", bound=int)
with self.assertRaises(TypeError):
- T_ints = IntVar("T_ints", covariant=True)
+ T_ints = IntVar("T_ints", covariant=True) # noqa
class LiteralTests(BaseTestCase):
@@ -475,7 +476,7 @@
@no_type_check
class NoTpCheck:
class Inn:
- def __init__(self, x: 'not a type'): ...
+ def __init__(self, x: 'not a type'): ... # noqa
self.assertTrue(NoTpCheck.__no_type_check__)
self.assertTrue(NoTpCheck.Inn.__init__.__no_type_check__)
self.assertEqual(gth(ann_module2.NTC.meth), {})
@@ -502,6 +503,7 @@
self.assertNotEqual(gth(Loop, globals())['attr'], Final[int])
self.assertNotEqual(gth(Loop, globals())['attr'], Final)
+
class CollectionsAbcTests(BaseTestCase):
def test_isinstance_collections(self):
@@ -1609,8 +1611,8 @@
def test_cannot_subclass(self):
with self.assertRaisesRegex(TypeError, "Cannot subclass .*Annotated"):
- class C(Annotated):
- pass
+ class C(Annotated):
+ pass
def test_cannot_check_instance(self):
with self.assertRaises(TypeError):
@@ -1620,7 +1622,6 @@
with self.assertRaises(TypeError):
issubclass(int, Annotated[int, "positive"])
-
@skipUnless(PEP_560, "pickle support was added with PEP 560")
def test_pickle(self):
samples = [typing.Any, typing.Union[int, str],
@@ -1673,9 +1674,9 @@
with self.assertRaises(TypeError):
D[int]
- I = Annotated[int, dec]
+ It = Annotated[int, dec]
with self.assertRaises(TypeError):
- I[None]
+ It[None]
LI = L[int]
with self.assertRaises(TypeError):
@@ -1747,7 +1748,6 @@
)
-
class AllTests(BaseTestCase):
def test_typing_extensions_includes_standard(self):
@@ -1782,7 +1782,6 @@
self.assertIn('Protocol', a)
self.assertIn('runtime', a)
-
def test_typing_extensions_defers_when_possible(self):
exclude = {'overload', 'Text', 'TYPE_CHECKING', 'Final',
'get_type_hints'}
for item in typing_extensions.__all__:
@@ -1804,4 +1803,4 @@
if __name__ == '__main__':
- main()
+ main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/typing_extensions-3.7.4/src_py3/typing_extensions.egg-info/PKG-INFO
new/typing_extensions-3.7.4.1/src_py3/typing_extensions.egg-info/PKG-INFO
--- old/typing_extensions-3.7.4/src_py3/typing_extensions.egg-info/PKG-INFO
2019-06-20 02:03:42.000000000 +0200
+++ new/typing_extensions-3.7.4.1/src_py3/typing_extensions.egg-info/PKG-INFO
2019-10-28 14:28:10.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: typing-extensions
-Version: 3.7.4
+Version: 3.7.4.1
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/src_py3/typing_extensions.egg-info/SOURCES.txt
new/typing_extensions-3.7.4.1/src_py3/typing_extensions.egg-info/SOURCES.txt
--- old/typing_extensions-3.7.4/src_py3/typing_extensions.egg-info/SOURCES.txt
2019-06-20 02:03:42.000000000 +0200
+++
new/typing_extensions-3.7.4.1/src_py3/typing_extensions.egg-info/SOURCES.txt
2019-10-28 14:28:10.000000000 +0100
@@ -10,4 +10,5 @@
src_py3/typing_extensions.egg-info/PKG-INFO
src_py3/typing_extensions.egg-info/SOURCES.txt
src_py3/typing_extensions.egg-info/dependency_links.txt
+src_py3/typing_extensions.egg-info/requires.txt
src_py3/typing_extensions.egg-info/top_level.txt
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/typing_extensions-3.7.4/src_py3/typing_extensions.egg-info/requires.txt
new/typing_extensions-3.7.4.1/src_py3/typing_extensions.egg-info/requires.txt
--- old/typing_extensions-3.7.4/src_py3/typing_extensions.egg-info/requires.txt
1970-01-01 01:00:00.000000000 +0100
+++
new/typing_extensions-3.7.4.1/src_py3/typing_extensions.egg-info/requires.txt
2019-10-28 14:28:10.000000000 +0100
@@ -0,0 +1,3 @@
+
+[:python_version < "3.5"]
+typing>=3.7.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/typing_extensions-3.7.4/src_py3/typing_extensions.py
new/typing_extensions-3.7.4.1/src_py3/typing_extensions.py
--- old/typing_extensions-3.7.4/src_py3/typing_extensions.py 2019-06-19
23:38:29.000000000 +0200
+++ new/typing_extensions-3.7.4.1/src_py3/typing_extensions.py 2019-08-10
20:55:22.000000000 +0200
@@ -6,15 +6,16 @@
import collections.abc as collections_abc
import operator
+# These are used by Protocol implementation
+# We use internal typing helpers here, but this significantly reduces
+# code duplication. (Also this is only until Protocol is in typing.)
+from typing import Generic, Callable, TypeVar, Tuple
+
# After PEP 560, internal typing API was substantially reworked.
# This is especially important for Protocol class which uses internal APIs
# quite extensivelly.
PEP_560 = sys.version_info[:3] >= (3, 7, 0)
-# These are used by Protocol implementation
-# We use internal typing helpers here, but this significantly reduces
-# code duplication. (Also this is only until Protocol is in typing.)
-from typing import Generic, Callable, TypeVar, Tuple
if PEP_560:
GenericMeta = TypingMeta = type
else:
@@ -25,19 +26,23 @@
except ImportError:
OLD_GENERICS = True
try:
- from typing import _subs_tree
+ from typing import _subs_tree # noqa
SUBS_TREE = True
except ImportError:
SUBS_TREE = False
try:
from typing import _tp_cache
except ImportError:
- _tp_cache = lambda x: x
+ def _tp_cache(x):
+ return x
try:
from typing import _TypingEllipsis, _TypingEmpty
except ImportError:
- class _TypingEllipsis: pass
- class _TypingEmpty: pass
+ class _TypingEllipsis:
+ pass
+
+ class _TypingEmpty:
+ pass
# The two functions below are copies of typing internal helpers.
@@ -363,21 +368,20 @@
'{} accepts only single
type'.format(self._name))
return _GenericAlias(self, (item,))
- Final = _FinalForm('Final', doc=
- """A special typing construct to indicate that a name
- cannot be re-assigned or overridden in a subclass.
- For example:
-
- MAX_SIZE: Final = 9000
- MAX_SIZE += 1 # Error reported by type checker
-
- class Connection:
- TIMEOUT: Final[int] = 10
- class FastConnector(Connection):
- TIMEOUT = 1 # Error reported by type checker
+ Final = _FinalForm('Final',
+ doc="""A special typing construct to indicate that a
name
+ cannot be re-assigned or overridden in a subclass.
+ For example:
+
+ MAX_SIZE: Final = 9000
+ MAX_SIZE += 1 # Error reported by type checker
+
+ class Connection:
+ TIMEOUT: Final[int] = 10
+ class FastConnector(Connection):
+ TIMEOUT = 1 # Error reported by type checker
- There is no runtime checking of these properties.
- """)
+ There is no runtime checking of these properties.""")
elif hasattr(typing, '_FinalTypingBase'):
class _Final(typing._FinalTypingBase, _root=True):
"""A special typing construct to indicate that a name
@@ -534,7 +538,7 @@
if hasattr(typing, 'Literal'):
- Literal = typing.Literal
+ Literal = typing.Literal
elif sys.version_info[:2] >= (3, 7):
class _LiteralForm(typing._SpecialForm, _root=True):
@@ -544,19 +548,19 @@
def __getitem__(self, parameters):
return _GenericAlias(self, parameters)
- Literal = _LiteralForm('Literal', doc=
- """A type that can be used to indicate to type checkers that the
- corresponding value has a value literally equivalent to the
- provided parameter. For example:
-
- var: Literal[4] = 4
-
- The type checker understands that 'var' is literally equal to the
- value 4 and no other value.
-
- Literal[...] cannot be subclassed. There is no runtime checking
- verifying that the parameter is actually a value instead of a type.
- """)
+ Literal = _LiteralForm('Literal',
+ doc="""A type that can be used to indicate to type
checkers
+ that the corresponding value has a value literally
equivalent
+ to the provided parameter. For example:
+
+ var: Literal[4] = 4
+
+ The type checker understands that 'var' is
literally equal to
+ the value 4 and no other value.
+
+ Literal[...] cannot be subclassed. There is no
runtime
+ checking verifying that the parameter is actually a
value
+ instead of a type.""")
elif hasattr(typing, '_FinalTypingBase'):
class _Literal(typing._FinalTypingBase, _root=True):
"""A type that can be used to indicate to type checkers that the
@@ -564,7 +568,7 @@
provided parameter. For example:
var: Literal[4] = 4
-
+
The type checker understands that 'var' is literally equal to the
value 4 and no other value.
@@ -658,7 +662,7 @@
provided parameter. For example:
var: Literal[4] = 4
-
+
The type checker understands that 'var' is literally equal to the
value 4 and no other value.
@@ -1071,7 +1075,7 @@
if OLD_GENERICS:
- def _next_in_mro(cls):
+ def _next_in_mro(cls): # noqa
"""This function exists for compatibility with old typing versions."""
next_in_mro = object
for i, c in enumerate(cls.__mro__[:-1]):
@@ -1220,8 +1224,10 @@
return NotImplemented
break
annotations = getattr(base, '__annotations__', {})
- if (isinstance(annotations, typing.Mapping) and attr
in annotations and
- isinstance(other, _ProtocolMeta) and
other._is_protocol):
+ if (isinstance(annotations, typing.Mapping) and
+ attr in annotations and
+ isinstance(other, _ProtocolMeta) and
+ other._is_protocol):
break
else:
return NotImplemented
@@ -1252,13 +1258,17 @@
return False
if (self.__dict__.get('_is_protocol', None) and
not self.__dict__.get('_is_runtime_protocol', None)):
- if sys._getframe(1).f_globals['__name__'] in ['abc',
'functools', 'typing']:
+ if sys._getframe(1).f_globals['__name__'] in ['abc',
+ 'functools',
+ 'typing']:
return False
raise TypeError("Instance and class checks can only be used
with"
" @runtime protocols")
if (self.__dict__.get('_is_runtime_protocol', None) and
not _is_callable_members_only(self)):
- if sys._getframe(1).f_globals['__name__'] in ['abc',
'functools', 'typing']:
+ if sys._getframe(1).f_globals['__name__'] in ['abc',
+ 'functools',
+ 'typing']:
return super(GenericMeta, self).__subclasscheck__(cls)
raise TypeError("Protocols with non-method members"
" don't support issubclass()")
@@ -1351,7 +1361,7 @@
elif PEP_560:
- from typing import _type_check, _GenericAlias, _collect_type_vars
+ from typing import _type_check, _GenericAlias, _collect_type_vars # noqa
class _ProtocolMeta(abc.ABCMeta):
# This metaclass is a bit unfortunate and exists only because of the
lack
@@ -1371,11 +1381,10 @@
return True
return super().__instancecheck__(instance)
-
class Protocol(metaclass=_ProtocolMeta):
# There is quite a lot of overlapping code with typing.Generic.
- # Unfortunately it is hard to avoid this while these live in two
different modules.
- # The duplicated code will be removed when Protocol is moved to typing.
+ # Unfortunately it is hard to avoid this while these live in two
different
+ # modules. The duplicated code will be removed when Protocol is moved
to typing.
"""Base class for protocol classes. Protocol classes are defined as::
class Proto(Protocol):
@@ -1474,7 +1483,8 @@
s_vars = ', '.join(str(t) for t in tvars if t not in
gvarset)
s_args = ', '.join(str(g) for g in gvars)
raise TypeError("Some type variables ({}) are"
- " not listed in {}[{}]".format(s_vars,
the_base, s_args))
+ " not listed in {}[{}]".format(s_vars,
+
the_base, s_args))
tvars = gvars
cls.__parameters__ = tuple(tvars)
@@ -1506,8 +1516,10 @@
return NotImplemented
break
annotations = getattr(base, '__annotations__', {})
- if (isinstance(annotations, typing.Mapping) and attr
in annotations and
- isinstance(other, _ProtocolMeta) and
other._is_protocol):
+ if (isinstance(annotations, typing.Mapping) and
+ attr in annotations and
+ isinstance(other, _ProtocolMeta) and
+ other._is_protocol):
break
else:
return NotImplemented
@@ -1562,18 +1574,18 @@
else:
def _check_fails(cls, other):
try:
- if sys._getframe(1).f_globals['__name__'] not in ['abc',
'functools', 'typing']:
+ if sys._getframe(1).f_globals['__name__'] not in ['abc',
+ 'functools',
+ 'typing']:
# Typed dicts are only for static structural subtyping.
raise TypeError('TypedDict does not support instance and class
checks')
except (AttributeError, ValueError):
pass
return False
-
def _dict_new(cls, *args, **kwargs):
return dict(*args, **kwargs)
-
def _typeddict_new(cls, _typename, _fields=None, **kwargs):
total = kwargs.pop('total', True)
if _fields is None:
@@ -1591,7 +1603,6 @@
return _TypedDictMeta(_typename, (), ns)
-
class _TypedDictMeta(type):
def __new__(cls, name, bases, ns, total=True):
# Create new typed dict class object.
@@ -1615,7 +1626,6 @@
__instancecheck__ = __subclasscheck__ = _check_fails
-
TypedDict = _TypedDictMeta('TypedDict', (dict,), {})
TypedDict.__module__ = __name__
TypedDict.__doc__ = \
@@ -1707,7 +1717,7 @@
- It's an error to call `Annotated` with less than two arguments.
- Nested Annotated are flattened::
- Annotated[Annotated[int, Ann1, Ann2], Ann3] == Annotated[int,
Ann1, Ann2, Ann3]
+ Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1,
Ann2, Ann3]
- Instantiating an annotated type is equivalent to instantiating the
underlying type::
@@ -1825,7 +1835,7 @@
metadata_reprs = ", ".join(repr(arg) for arg in metadata)
return '%s[%s, %s]' % (cls, tp_repr, metadata_reprs)
- def _subs_tree(self, tvars=None, args=None):
+ def _subs_tree(self, tvars=None, args=None): # noqa
if self is Annotated:
return Annotated
res = super()._subs_tree(tvars=tvars, args=args)
@@ -1902,7 +1912,6 @@
def __subclasscheck__(self, cls):
raise TypeError("Annotated cannot be used with issubclass().")
-
class Annotated(metaclass=AnnotatedMeta):
"""Add context specific metadata to a type.
@@ -1919,7 +1928,7 @@
- It's an error to call `Annotated` with less than two arguments.
- Nested Annotated are flattened::
- Annotated[Annotated[int, Ann1, Ann2], Ann3] == Annotated[int,
Ann1, Ann2, Ann3]
+ Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1,
Ann2, Ann3]
- Instantiating an annotated type is equivalent to instantiating the
underlying type::