Skip to content

Commit

Permalink
Pass Keyword Argument to TabularDataBase
Browse files Browse the repository at this point in the history
  • Loading branch information
sooahleex committed Jun 2, 2024
1 parent 0be4a74 commit 6d14549
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/datumaro/plugins/data_formats/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
target: Optional[Union[str, List[str]]] = None,
dtype: Optional[Dict[str, Type[TableDtype]]] = None,
ctx: Optional[ImportContext] = None,
**kwargs,
) -> None:
"""
Read and compose a tabular dataset.
Expand All @@ -59,13 +60,14 @@ def __init__(
super().__init__(media_type=TableRow, ctx=ctx)

self._infos = {"path": path}
self._items, self._categories = self._parse(paths, target, dtype)
self._items, self._categories = self._parse(paths, target, dtype, **kwargs)

def _parse(
self,
paths: List[str],
target: Optional[Dict[str, List[str]]] = None,
dtype: Optional[Dict[str, Type[TableDtype]]] = None,
**kwargs,
) -> Tuple[List[DatasetItem], Dict[AnnotationType, Categories]]:
"""
parse tabular files. Each file is regarded as a subset.
Expand All @@ -91,7 +93,7 @@ def _parse(
raise TypeError('Target should have both "input" and "output"')

for path in paths:
table = Table.from_csv(path, dtype=dtype)
table = Table.from_csv(path, dtype=dtype, **kwargs)

targets: List[str] = []
targets_ann: List[str] = []
Expand Down

0 comments on commit 6d14549

Please sign in to comment.