Skip to content

Commit

Permalink
Add default_format_flags property
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Mar 20, 2022
1 parent 6ed8f69 commit 01a920b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dataproperty/_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(self, max_precision: Optional[int] = None) -> None:
self.__strip_str_header: Optional[str] = None
self.__is_formatting_float = True
self.__min_col_ascii_char_width = 0
self.__default_format_flags = Format.NONE
self.__format_flags_list: Sequence[int] = []
self.__float_type: Union[Type[float], Type[Decimal], None] = None
self.__datetime_format_str = DefaultValue.DATETIME_FORMAT
Expand Down Expand Up @@ -242,6 +243,18 @@ def min_column_width(self, value: int):
self.__min_col_ascii_char_width = value
self.__clear_cache()

@property
def default_format_flags(self) -> int:
return self.__default_format_flags

@default_format_flags.setter
def default_format_flags(self, value: int):
if self.__default_format_flags == value:
return

self.__default_format_flags = value
self.__clear_cache()

@property
def format_flags_list(self) -> Sequence[int]:
return self.__format_flags_list
Expand Down Expand Up @@ -552,7 +565,7 @@ def __get_format_flags(self, col_idx: int):
try:
return self.format_flags_list[col_idx]
except (TypeError, IndexError):
return Format.NONE
return self.__default_format_flags

def __to_dp(
self,
Expand Down

0 comments on commit 01a920b

Please sign in to comment.