Skip to content

Commit

Permalink
Pass kwargs to init in case child needs special arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
amc-corey-cox committed Nov 8, 2024
1 parent d8fb3b4 commit cef173a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/koza/io/writer/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(
edge_properties: List[str] = None,
sssom_config: SSSOMConfig = None,
skip_checks: bool = False,
kwargs: dict = None,
):
"""Do not override this method; implement `init` instead."""
self.output_dir = output_dir
Expand All @@ -30,7 +31,7 @@ def __init__(
self.skip_checks = skip_checks
self.converter = KGXConverter()

self.init()
self.init(**kwargs)

def write(self, entities: Iterable):
nodes, edges = self.converter.convert(entities)
Expand Down Expand Up @@ -61,7 +62,7 @@ def check_extra_fields(row_keys: Tuple, columns: Tuple) -> None:
raise ValueError(f"Extra fields found in row: {sorted(set(row_keys) - set(columns))}")

@abstractmethod
def init(self):
def init(self, **kwargs):
pass

@abstractmethod
Expand Down

0 comments on commit cef173a

Please sign in to comment.