Skip to content

Commit

Permalink
Fix initialization by keyword arguments of writer class constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Aug 30, 2020
1 parent 8e3dc51 commit 6ee5ebc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
8 changes: 8 additions & 0 deletions pytablewriter/writer/_null.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
class NullTableWriter(IndentationInterface, TextWriterInterface, TableWriterInterface):
FORMAT_NAME = "null"

def __init__(self, **kwargs) -> None:
self.table_name = kwargs.get("table_name", "")
self.value_matrix = kwargs.get("value_matrix", [])
self.is_formatting_float = kwargs.get("is_formatting_float", True)
self.headers = kwargs.get("headers", [])
self.type_hints = kwargs.get("type_hints", [])
self.max_workers = kwargs.get("max_workers", 1)

def __repr__(self) -> str:
return self.dumps()

Expand Down
2 changes: 2 additions & 0 deletions pytablewriter/writer/binary/_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def stream(self, value) -> None:
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)

self.table_name = kwargs.get("table_name", "")

self._stream = None

def dumps(self) -> str:
Expand Down
1 change: 0 additions & 1 deletion pytablewriter/writer/text/_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class RstTableWriter(IndentationTextTableWriter):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)

self.table_name = ""
self.char_header_row_separator = "="
self.char_cross_point = "+"
self.char_left_cross_point = "+"
Expand Down
2 changes: 1 addition & 1 deletion pytablewriter/writer/text/_spacealigned.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def __init__(self, **kwargs) -> None:
self.char_cross_point = " "

self.is_padding = True
self.is_formatting_float = True
self.is_formatting_float = kwargs.get("is_formatting_float", True)

self._quoting_flags = copy.deepcopy(dataproperty.NOT_QUOTING_FLAGS)
2 changes: 0 additions & 2 deletions pytablewriter/writer/text/_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def support_split_write(self) -> bool:
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)

self.table_name = ""

self.column_delimiter = "│"
self.char_left_side_row = "│"
self.char_right_side_row = "│"
Expand Down
1 change: 0 additions & 1 deletion pytablewriter/writer/text/sourcecode/_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def format_name(self) -> str:
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)

self.table_name = ""
self.import_pandas_as = "pd"
self.is_write_header = False

Expand Down
1 change: 0 additions & 1 deletion pytablewriter/writer/text/sourcecode/_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def support_split_write(self) -> bool:
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)

self.table_name = ""
self._dp_extractor.type_value_map = {
typepy.Typecode.NONE: None,
typepy.Typecode.INFINITY: 'float("inf")',
Expand Down

0 comments on commit 6ee5ebc

Please sign in to comment.