diff --git a/mindee/parsing/standard/company_registration.py b/mindee/parsing/standard/company_registration.py index f8d77143..77ad05ce 100644 --- a/mindee/parsing/standard/company_registration.py +++ b/mindee/parsing/standard/company_registration.py @@ -1,6 +1,7 @@ from typing import Optional from mindee.parsing.common.string_dict import StringDict +from mindee.parsing.common.summary_helper import format_for_display from mindee.parsing.standard.base import BaseField, FieldPositionMixin @@ -21,6 +22,24 @@ def __init__( self.type = raw_prediction["type"] self._set_position(raw_prediction) + def to_table_line(self): + """Return a table line for RST display.""" + printable = self.printable_values() + return f"| {printable['type']:<15} | {printable['value']:<20} " + + def __str__(self): + """String representation of CompanyRegistrationField.""" + printable = self.printable_values() + return f"Type: {printable['type']}, Value: {printable['value']}" + + def printable_values(self): + """Printable representation of the field's value & type.""" + printable = { + "type": format_for_display(self.type, None), + "value": format_for_display(self.value, None), + } + return printable + def print(self) -> str: """Additional print function that doesn't overwrite __str__().""" if self.value: diff --git a/tests/data b/tests/data index 7c3b8d1a..e4c1bcce 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit 7c3b8d1a646de02477f9241b75dc1a1417998b0b +Subproject commit e4c1bcce9b4457358344fdf9fdc2627e2a0eb705