Skip to content

Commit 62d6006

Browse files
♻️ update company registration display (#244)
1 parent c3c331f commit 62d6006

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

mindee/parsing/standard/company_registration.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Optional
22

33
from mindee.parsing.common.string_dict import StringDict
4+
from mindee.parsing.common.summary_helper import format_for_display
45
from mindee.parsing.standard.base import BaseField, FieldPositionMixin
56

67

@@ -21,6 +22,24 @@ def __init__(
2122
self.type = raw_prediction["type"]
2223
self._set_position(raw_prediction)
2324

25+
def to_table_line(self):
26+
"""Return a table line for RST display."""
27+
printable = self.printable_values()
28+
return f"| {printable['type']:<15} | {printable['value']:<20} "
29+
30+
def __str__(self):
31+
"""String representation of CompanyRegistrationField."""
32+
printable = self.printable_values()
33+
return f"Type: {printable['type']}, Value: {printable['value']}"
34+
35+
def printable_values(self):
36+
"""Printable representation of the field's value & type."""
37+
printable = {
38+
"type": format_for_display(self.type, None),
39+
"value": format_for_display(self.value, None),
40+
}
41+
return printable
42+
2443
def print(self) -> str:
2544
"""Additional print function that doesn't overwrite __str__()."""
2645
if self.value:

0 commit comments

Comments
 (0)