diff --git a/CHANGELOG.md b/CHANGELOG.md index fd0cd2c..c8fc1a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +v0.3.5 (2023-10-02) +------------------- +* Delete `Serializable` class +* Add `__hash__` method to `BBox` + v0.3.4 (2023-09-28) ------------------- * Add `Serializable` class diff --git a/VERSION b/VERSION index 448a0fa..09e9157 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.4 \ No newline at end of file +0.3.5 \ No newline at end of file diff --git a/dedocutils/data_structures/bbox.py b/dedocutils/data_structures/bbox.py index 310de53..78dcf8b 100644 --- a/dedocutils/data_structures/bbox.py +++ b/dedocutils/data_structures/bbox.py @@ -5,11 +5,9 @@ import numpy as np -from dedocutils.data_structures.serializable import Serializable - @dataclass -class BBox(Serializable): +class BBox: """ Bounding box around some page object, the coordinate system starts from top left corner. """ @@ -138,3 +136,6 @@ def to_relative_dict(self, page_width: int, page_height: int) -> dict: @staticmethod def from_dict(some_dict: Dict[str, int]) -> "BBox": return BBox(**some_dict) + + def __hash__(self) -> int: + return hash((self.x_top_left, self.y_top_left, self.width, self.height)) diff --git a/dedocutils/data_structures/serializable.py b/dedocutils/data_structures/serializable.py deleted file mode 100644 index 9de5d23..0000000 --- a/dedocutils/data_structures/serializable.py +++ /dev/null @@ -1,16 +0,0 @@ -from abc import ABC, abstractmethod - - -class Serializable(ABC): - """ - Base class for the serializable objects which we need convert to dict. - """ - @abstractmethod - def to_dict(self) -> dict: - """ - Convert class data into dictionary representation. - Dictionary key should be string and dictionary value should be json serializable. - - :return: dict with all class data. - """ - pass