Skip to content

Commit

Permalink
fix some item attr confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Aug 14, 2023
1 parent 6950bc6 commit 6e12763
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions looper/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ def __init__(

for attr_name in CLI_PROJ_ATTRS:
if attr_name in kwargs:
setattr(self[EXTRA_KEY], attr_name, kwargs[attr_name])
getattr(self,EXTRA_KEY)[attr_name] = kwargs[attr_name]
self._samples_by_interface = self._samples_by_piface(self.piface_key)
self._interfaces_by_sample = self._piface_by_samples()
self.linked_sample_interfaces = self._get_linked_pifaces()
if FILE_CHECKS_KEY in self[EXTRA_KEY]:
setattr(self, "file_checks", not self[EXTRA_KEY][FILE_CHECKS_KEY])
if DRY_RUN_KEY in self[EXTRA_KEY]:
setattr(self, DRY_RUN_KEY, self[EXTRA_KEY][DRY_RUN_KEY])
if FILE_CHECKS_KEY in getattr(self,EXTRA_KEY):
setattr(self, "file_checks", not getattr(self,EXTRA_KEY)[FILE_CHECKS_KEY])
if DRY_RUN_KEY in getattr(self,EXTRA_KEY):
setattr(self, DRY_RUN_KEY, getattr(self,EXTRA_KEY)[DRY_RUN_KEY])
self.dcc = (
None
if divcfg_path is None
Expand Down Expand Up @@ -184,7 +184,7 @@ def _extra_cli_or_cfg(self, attr_name, strict=False):
found
"""
try:
result = getattr(self[EXTRA_KEY], attr_name)
result = getattr(getattr(self,EXTRA_KEY), attr_name)
except (AttributeError, KeyError):
pass
else:
Expand Down Expand Up @@ -233,7 +233,7 @@ def _out_subdir_path(self, key: str, default: str) -> str:
:return str: path to the folder
"""
parent = getattr(self, OUTDIR_KEY)
child = getattr(self[EXTRA_KEY], key, default) or default
child = getattr(getattr(self,EXTRA_KEY), key, default) or default
return os.path.join(parent, child)

def make_project_dirs(self):
Expand Down Expand Up @@ -744,7 +744,9 @@ def fetch_samples(
if not selector_include and not selector_exclude:
# Default case where user does not use selector_include or selector exclude.
# Assume that user wants to exclude samples if toggle = 0.
if any([hasattr(s, "toggle") for s in prj.samples]):
# if any([hasattr(s, "toggle") for s in prj.samples]):
# if any("toggle" in s for s in prj.samples):
if "toggle" in prj.samples[0]: # assume the samples have the same schema
selector_exclude = [0]

def keep(s):
Expand Down

0 comments on commit 6e12763

Please sign in to comment.