Skip to content

Commit

Permalink
Remove unused funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 committed Aug 26, 2022
1 parent 723165b commit b2723ee
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 41 deletions.
7 changes: 1 addition & 6 deletions Example_dj_local_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
"This is where PosePipeline and non-installable other git ",
"repos are located (e.g., FairMOT, PoseAug, etc.)"
],
"pose_project_dir": "/home/jcotton/projects/pose/",
"pose_root_data_dir":
[
"/home/jcotton/projects/pose/",
"/home/jcotton/projects/alt/"
]
"pose_project_dir": "/home/jcotton/projects/pose/"
}
}
11 changes: 0 additions & 11 deletions pose_pipeline/paths.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import datajoint as dj
from pathlib import Path
from collections import abc


def get_pose_root_data_dir():
pose_data_dirs = dj.config.get("custom", {}).get("pose_root_data_dir")
if not pose_data_dirs:
return None
elif not isinstance(pose_data_dirs, abc.Sequence):
return list(pose_data_dirs)
else:
return pose_data_dirs


def get_pose_project_dir():
Expand Down
24 changes: 0 additions & 24 deletions pose_pipeline/utils/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,6 @@ def find_full_path(root_directories, relative_path):
raise FileNotFoundError("No valid full-path found (from {})" " for {}".format(root_directories, relative_path))


def find_root_directory(root_directories, full_path):
"""
Given multiple potential root directories and a full-path,
search and return one directory that is the parent of the given path
:param root_directories: potential root directories
:param full_path: the full path to search the root directory
:return: root_directory (pathlib.Path object)
"""
full_path = _to_Path(full_path)

if not full_path.exists():
raise FileNotFoundError(f"{full_path} does not exist!")

# Turn to list if only a single root directory is provided
if isinstance(root_directories, (str, pathlib.Path)):
root_directories = [_to_Path(root_directories)]

try:
return next(_to_Path(root_dir) for root_dir in root_directories if _to_Path(root_dir) in set(full_path.parents))

except StopIteration:
raise FileNotFoundError("No valid root directory found (from {})" " for {}".format(root_directories, full_path))


def _to_Path(path):
"""
Convert the input "path" into a pathlib.Path object
Expand Down

0 comments on commit b2723ee

Please sign in to comment.