Skip to content

Commit

Permalink
Fix small inconsistencies between docs and api
Browse files Browse the repository at this point in the history
  • Loading branch information
J535D165 committed Nov 18, 2022
1 parent fd856ef commit 55a4e44
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion asreviewcontrib/datatools/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def compose(


def _parse_arguments_compose():
parser = argparse.ArgumentParser(prog="ASReview merge data")
parser = argparse.ArgumentParser(prog="asreview data compose")
parser.add_argument("output_path", type=str, help="The output file path.")
parser.add_argument(
"--relevant", "-r", type=str, help="A dataset with relevant records."
Expand Down
12 changes: 6 additions & 6 deletions asreviewcontrib/datatools/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from asreviewcontrib.datatools.describe import _parse_arguments_describe
from asreviewcontrib.datatools.describe import describe
from asreviewcontrib.datatools.stack import _parse_arguments_stack
from asreviewcontrib.datatools.stack import stack
from asreviewcontrib.datatools.stack import vstack

DATATOOLS = ["describe", "dedup", "convert", "compose", "stack"]
DATATOOLS = ["describe", "dedup", "convert", "compose", "vstack"]


class DataEntryPoint(BaseEntryPoint):
Expand Down Expand Up @@ -98,10 +98,10 @@ def execute(self, argv):
resolve=args_compose.conflict_resolve,
)

if argv[0] == "stack":
args_stack_parser = _parse_arguments_stack()
args_stack = args_stack_parser.parse_args(argv[1:])
stack(args_stack.output_path, args_stack.datasets)
if argv[0] == "vstack":
args_vstack_parser = _parse_arguments_vstack()
args_vstack = args_vstack_parser.parse_args(argv[1:])
vstack(args_stack.output_path, args_stack.datasets)

# Print help message if subcommand not given or incorrect
else:
Expand Down
14 changes: 7 additions & 7 deletions asreviewcontrib/datatools/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ def _check_suffix(input_files, output_file):
)


def stack(output_file, input_files):
def vstack(output_file, input_files):
_check_suffix(input_files, output_file)

list_dfs = [load_data(item).df for item in input_files]
df_stacked = pd.concat(list_dfs).reset_index(drop=True)
as_stacked = ASReviewData(df=df_stacked)
df_vstacked = pd.concat(list_dfs).reset_index(drop=True)
as_vstacked = ASReviewData(df=df_vstacked)

as_stacked.to_file(output_file)
as_vstacked.to_file(output_file)


def _parse_arguments_stack():
parser = argparse.ArgumentParser(prog="ASReview dataset stacking")
def _parse_arguments_vstack():
parser = argparse.ArgumentParser(prog="asreview data vstack")
parser.add_argument("output_path", type=str, help="The output file path.")
parser.add_argument(
"datasets", type=str, nargs="+", help="Any number of datasets to stack."
"datasets", type=str, nargs="+", help="Any number of datasets to stack vertically."
)

return parser
4 changes: 2 additions & 2 deletions tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from asreview.data import ASReviewData

from asreviewcontrib.datatools.stack import stack
from asreviewcontrib.datatools.stack import vstack

test_dir = Path(__file__).parent
file_1 = Path(test_dir, "demo_data", "dataset_1.ris")
Expand All @@ -11,7 +11,7 @@

def test_stack(tmpdir):
output_path = Path(tmpdir, "test_output.ris")
stack(output_path, [file_1, file_2])
vstack(output_path, [file_1, file_2])
as_test = ASReviewData.from_file(output_path)

assert len(as_test.df) == 14
Expand Down

0 comments on commit 55a4e44

Please sign in to comment.