adaptix
adaptix copied to clipboard
Class not supported у класса с переопределённым __contains__
Если скормить в factory.load() датакласс, у которого переопределён метод contains, возникает исключение
File "project/venv/lib/python3.9/site-packages/dataclass_factory/parsers.py", line 282, in get_collection_factory
raise NotImplementedError("Class %s not supported" % cls)
NotImplementedError: Class <class 'Class'> not supported
Версия библиотеки: 2.11
Пример, вызывающий исключение:
from dataclasses import dataclass
from dataclass_factory import Factory
@dataclass
class Point:
x: int
y: int
def __contains__(self, item): ...
def __len__(self): ...
def __iter__(self): ...
if __name__ == '__main__':
dataclass_factory = Factory()
point = dataclass_factory.load({'x': 1, 'y': 1}, Point)
It looks that we need continue searching for parsers if we found unsupported collection