Skip to content

Commit

Permalink
Increasing test coverage; commented out dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
mbopfNIH committed May 18, 2023
1 parent 99a63a1 commit be4527a
Show file tree
Hide file tree
Showing 5 changed files with 402 additions and 254 deletions.
10 changes: 9 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
[run]
omit = test/*, setup.py, *.adoc
source = em_workflows
omit =
# Omit test code
test/*,
setup.py,
# Coverage wants to check adoc files for some reason
*.adoc,
# Some *.py files show up in temp directories
*/tmp/*
4 changes: 2 additions & 2 deletions coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 41 additions & 41 deletions em_workflows/file_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,40 +147,40 @@ def copy_to_assets_dir(self, fp_to_cp: Path) -> Path:
shutil.copyfile(fp_to_cp, dest)
return dest

def add_assets_entry(
self, asset_path: Path, asset_type: str, metadata: Dict[str, str] = None
) -> Dict:
"""
Suspect to be redundant - TODO
"""
# TODO move valid_types to Config.valid_callback_asset_types
valid_typs = [
"averagedVolume",
"keyImage",
"thumbnail",
"keyThumbnail",
"recMovie",
"tiltMovie",
"volume",
"neuroglancerPrecomputed",
]
if asset_type not in valid_typs:
raise ValueError(
f"Asset type: {asset_type} is not a valid type. {valid_typs}"
)
fp_no_mount_point = asset_path.relative_to(
Config.assets_dir(env=self.environment)
)
if metadata:
asset = {
"type": asset_type,
"path": fp_no_mount_point.as_posix(),
"metadata": metadata,
}
else:
asset = {"type": asset_type, "path": fp_no_mount_point.as_posix()}
self.prim_fp_elt["assets"].append(asset)
return asset
# def add_assets_entry(
# self, asset_path: Path, asset_type: str, metadata: Dict[str, str] = None
# ) -> Dict:
# """
# Suspect to be redundant - TODO
# """
# # TODO move valid_types to Config.valid_callback_asset_types
# valid_typs = [
# "averagedVolume",
# "keyImage",
# "thumbnail",
# "keyThumbnail",
# "recMovie",
# "tiltMovie",
# "volume",
# "neuroglancerPrecomputed",
# ]
# if asset_type not in valid_typs:
# raise ValueError(
# f"Asset type: {asset_type} is not a valid type. {valid_typs}"
# )
# fp_no_mount_point = asset_path.relative_to(
# Config.assets_dir(env=self.environment)
# )
# if metadata:
# asset = {
# "type": asset_type,
# "path": fp_no_mount_point.as_posix(),
# "metadata": metadata,
# }
# else:
# asset = {"type": asset_type, "path": fp_no_mount_point.as_posix()}
# self.prim_fp_elt["assets"].append(asset)
# return asset

def gen_output_fp(self, output_ext: str = None, out_fname: str = None) -> Path:
"""
Expand All @@ -197,13 +197,13 @@ def gen_output_fp(self, output_ext: str = None, out_fname: str = None) -> Path:
output_fp = f"{self.working_dir.as_posix()}/{f_name}"
return Path(output_fp)

@staticmethod
def filter_by_suffix(fp: Path, suffixes: List[str]) -> bool:
"""This method currently isn't used"""
for ext in suffixes:
if fp.suffix.lower() == ext:
return True
return False
# @staticmethod
# def filter_by_suffix(fp: Path, suffixes: List[str]) -> bool:
# """This method currently isn't used"""
# for ext in suffixes:
# if fp.suffix.lower() == ext:
# return True
# return False

def gen_asset(self, asset_type: str, asset_fp) -> Dict:
"""
Expand Down
Loading

0 comments on commit be4527a

Please sign in to comment.