Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLDR-473 make BBox class Serializable #14

Merged
merged 9 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

v0.3.4 (2023-09-28)
-------------------
* Make `BBox` class `Serializable`
NastyBoget marked this conversation as resolved.
Show resolved Hide resolved

v0.3.3 (2023-09-28)
-------------------
* Update `BBox` class
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.3
0.3.4
4 changes: 3 additions & 1 deletion dedocutils/data_structures/bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

import numpy as np

from dedocutils.data_structures.serializable import Serializable


@dataclass
class BBox:
class BBox(Serializable):
"""
Bounding box around some page object, the coordinate system starts from top left corner.
"""
Expand Down
16 changes: 16 additions & 0 deletions dedocutils/data_structures/serializable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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
Loading