removed things that not work in Python 3.8
This commit is contained in:
parent
b21c43ca65
commit
a0cadcce85
1 changed files with 3 additions and 7 deletions
|
|
@ -8,7 +8,7 @@ import builtins
|
|||
import functools
|
||||
import abc
|
||||
import _thread
|
||||
from types import FunctionType, GenericAlias
|
||||
from types import FunctionType
|
||||
|
||||
|
||||
__all__ = ['dataclass',
|
||||
|
|
@ -229,7 +229,7 @@ class InitVar:
|
|||
self.type = type
|
||||
|
||||
def __repr__(self):
|
||||
if isinstance(self.type, type) and not isinstance(self.type, GenericAlias):
|
||||
if isinstance(self.type, type):
|
||||
type_name = self.type.__name__
|
||||
else:
|
||||
# typing objects, e.g. List[int]
|
||||
|
|
@ -309,8 +309,6 @@ class Field:
|
|||
# it.
|
||||
func(self.default, owner, name)
|
||||
|
||||
__class_getitem__ = classmethod(GenericAlias)
|
||||
|
||||
|
||||
class _DataclassParams:
|
||||
__slots__ = ('init',
|
||||
|
|
@ -1101,8 +1099,6 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen,
|
|||
if slots:
|
||||
cls = _add_slots(cls, frozen)
|
||||
|
||||
abc.update_abstractmethods(cls)
|
||||
|
||||
return cls
|
||||
|
||||
|
||||
|
|
@ -1211,7 +1207,7 @@ def _is_dataclass_instance(obj):
|
|||
def is_dataclass(obj):
|
||||
"""Returns True if obj is a dataclass or an instance of a
|
||||
dataclass."""
|
||||
cls = obj if isinstance(obj, type) and not isinstance(obj, GenericAlias) else type(obj)
|
||||
cls = obj if isinstance(obj, type) else type(obj)
|
||||
return hasattr(cls, _FIELDS)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue