Skip to content

Commit

Permalink
🧹 Removed warning about missing megacomplex definition
Browse files Browse the repository at this point in the history
Since it is already reported as 'Missing Model Item'
  • Loading branch information
s-weigand committed Aug 29, 2021
1 parent fd6765c commit 0719076
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions glotaran/model/dataset_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,7 @@ def get_global_axis(self) -> np.ndarray:

@model_item_validator(False)
def ensure_unique_megacomplexes(self, model: Model) -> list[str]:
"""Ensure that all megacomplexes in a dataset used correctly.
Correct usage means in this context:
- Each megcomplex key is defined in the ``megacomplex`` section
of the model specification.
- Unique megacomplexes are only used once per dataset
"""Ensure that unique megacomplexes Are only used once per dataset.
Parameters
----------
Expand All @@ -190,7 +184,6 @@ def ensure_unique_megacomplexes(self, model: Model) -> list[str]:
list[str]
Error messages to be shown when the model gets validated.
"""
problems = []
glotaran_unique_megacomplex_types = []

for megacomplex_name in self.megacomplex:
Expand All @@ -200,16 +193,11 @@ def ensure_unique_megacomplexes(self, model: Model) -> list[str]:
type_name = megacomplex_instance.type or megacomplex_instance.name
glotaran_unique_megacomplex_types.append(type_name)
except KeyError:
problems.append(
f"The megacomplex {megacomplex_name!r} used in dataset {self.label!r} "
"wasn't defined in the megacomplex section of the model specification."
)

for type_name, count in Counter(glotaran_unique_megacomplex_types).most_common():
if count > 1:
problems.append(
f"Multiple instances of unique megacomplex type {type_name!r} "
f"in dataset {self.label!r}"
)

return problems
pass

return [
f"Multiple instances of unique megacomplex type {type_name!r} "
f"in dataset {self.label!r}"
for type_name, count in Counter(glotaran_unique_megacomplex_types).most_common()
if count > 1
]

0 comments on commit 0719076

Please sign in to comment.