Skip to content

Commit

Permalink
modify code to look for src dir
Browse files Browse the repository at this point in the history
  • Loading branch information
namsaraeva committed Dec 10, 2024
1 parent 50a2627 commit b04f1d7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/scportrait/tools/ml/pretrained_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ def get_data_dir() -> Path:
Path to data directory
"""

def find_root_by_file(marker_file: str, current_path: Path) -> Path | None:
def find_root_by_folder(marker_folder: str, current_path: Path) -> Path | None:
for parent in current_path.parents:
print(parent)
if (parent / marker_file).exists():
if (parent / marker_folder).is_dir():
return parent
return None

src_code_dir = find_root_by_file("README.md", Path(__file__))
if src_code_dir is None:
raise FileNotFoundError("Could not find scPortrait root directory")
src_code_dir = find_root_by_folder("io", Path(__file__))

if src_code_dir is None:
raise FileNotFoundError("Could not find scPortrait source directory")
data_dir = src_code_dir / "scportrait_data"

return data_dir.absolute()


Expand Down

0 comments on commit b04f1d7

Please sign in to comment.