Skip to content

Commit

Permalink
Merge pull request #118 from nasaharvest/dataset-verify
Browse files Browse the repository at this point in the history
Dataset verification in CLI
  • Loading branch information
ivanzvonkov authored Nov 29, 2022
2 parents 0df6a86 + 300bd96 commit 3dea679
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion openmapflow/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TEMPLATE_README = TEMPLATES_DIR / "README.md"
TEMPLATE_DEPLOY_YML = TEMPLATES_DIR / "github-deploy.yaml"
TEMPLATE_TEST_YML = TEMPLATES_DIR / "github-test.yaml"
VERSION = "0.2.2rc2"
VERSION = "0.2.2"

# -------------- Dataframe column names --------------------------------------
SOURCE = "source"
Expand Down
15 changes: 10 additions & 5 deletions openmapflow/scripts/openmapflow
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ case $1 in
;;
"create-datasets")
check_openmapflow_yaml
python3 -c "from datasets import datasets; from openmapflow.labeled_dataset import create_datasets; create_datasets(datasets)" "${@:2}"
python -c "from datasets import datasets; from openmapflow.labeled_dataset import create_datasets; create_datasets(datasets)" "${@:2}"
;;
"datapath")
check_openmapflow_yaml
python3 -c "from openmapflow.config import DataPaths; print(DataPaths.get('$2'))"
python -c "from openmapflow.config import DataPaths; print(DataPaths.get('$2'))"
;;
"datasets")
check_openmapflow_yaml
Expand All @@ -35,21 +35,25 @@ case $1 in
librarydir
;;
"generate")
python3 "$(librarydir)/generate.py"
python "$(librarydir)/generate.py"
;;
"ls")
ls "$(librarydir)/$2"
;;
"verify")
check_openmapflow_yaml
python -c "from datasets import $2; from openmapflow.labeled_dataset import verify_df; verify_df($2().load_labels())"
;;
"version")
version
;;
"--version")
version
;;
*)
echo "---------------------------------------------------------------------------------"
echo "---------------------------------------------------------------------------------------------"
echo " OpenMapFlow CLI"
echo "---------------------------------------------------------------------------------"
echo "---------------------------------------------------------------------------------------------"
echo "openmapflow cp <source> <destination> - copy a file or directory from the library"
echo "openmapflow create-datasets - creates datasets for all datasets in datasets.py"
echo "openmapflow datapath <DATAPATH> - outputs a relative path to the data directory"
Expand All @@ -59,6 +63,7 @@ case $1 in
echo "openmapflow generate - generates an openmapflow project"
echo "openmapflow help - outputs this message"
echo "openmapflow ls - lists files in openmapflow library directory"
echo "openmapflow verify <DATASET> - verifies a user declared LabeledDataset class in datasets.py"
echo "openmapflow version - package version"
;;
esac
4 changes: 3 additions & 1 deletion tests/test_CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def test_version(self):

@skipIf(os.name == "nt", "Not yet available on Windows")
def test_help(self):
self.maxDiff = None
actual_output = check_output(["openmapflow", "help"]).decode().rstrip()
long_line = "-" * 81
long_line = "-" * 93
expected_output = f"""{long_line}
OpenMapFlow CLI\n{long_line}
openmapflow cp <source> <destination> - copy a file or directory from the library
Expand All @@ -72,5 +73,6 @@ def test_help(self):
openmapflow generate - generates an openmapflow project
openmapflow help - outputs this message
openmapflow ls - lists files in openmapflow library directory
openmapflow verify <DATASET> - verifies a user declared LabeledDataset class in datasets.py
openmapflow version - package version"""
self.assertEqual(actual_output, expected_output)

0 comments on commit 3dea679

Please sign in to comment.