Skip to content

Commit

Permalink
add return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus1806 committed Nov 16, 2024
1 parent a2d9eeb commit 4b5a66c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sisyphus/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import shutil
import sys
import tempfile
import time

from typing import Dict, List, Optional, Set, Union

Expand All @@ -36,7 +35,7 @@
JOB_WITHOUT_KEEP_VALUE = -1


def extract_keep_values_from_graph():
def extract_keep_values_from_graph() -> Dict[str, int]:
"""Go through loaded graph and create dict with all jobs and keep values
:return:
Expand Down Expand Up @@ -89,7 +88,7 @@ def find_too_low_keep_value(
job_dirs: Union[str, Dict[Union[str, Path], int]],
min_keep_value: int,
filter_removed_jobs: Optional[List[Union[str, Path]]] = None,
):
) -> Set[Union[Path, str]]:
"""Check all given job if they can be removed and have a keep value lower min_keep_value.
:param job_dirs: dict with all keep values, can be created with extract_keep_values_from_graph
Expand All @@ -112,7 +111,7 @@ def find_too_low_keep_value(
return to_remove


def list_all_graph_directories():
def list_all_graph_directories() -> Dict[str, int]:
"""Create dict containing all filesystem directories used by jobs inside the loaded graph
:return: dict
Expand Down Expand Up @@ -144,7 +143,7 @@ def save_used_paths(outfile: Union[str, Path] = None, job_dirs: Dict[Union[str,
out.close()


def load_used_paths(infile: Union[str, Path]):
def load_used_paths(infile: Union[str, Path]) -> Dict[str, int]:
"""Load list save with save_used_paths
:param infile: Filename to load from
Expand All @@ -169,7 +168,7 @@ def save_remove_list(to_remove: List[Union[str, Path]], outfile: Union[str, Path
f.write(i + "\n")


def load_remove_list(infile: Union[str, Path]):
def load_remove_list(infile: Union[str, Path]) -> List[str]:
"""Load list save with save_remove_list
:param infile: Filename to load from
Expand All @@ -187,7 +186,7 @@ def search_for_unused(
current: str = gs.WORK_DIR,
verbose: bool = True,
filter_unused: Optional[List[str]] = None,
):
) -> Set[str]:
"""Check work directory and list all subdirectories which do not belong to the given list of directories.
:param job_dirs: dict with all used directories, can be created with list_all_graph_directories.
Expand Down

0 comments on commit 4b5a66c

Please sign in to comment.