Skip to content

Commit

Permalink
Fix model_type_extension property
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhorcas committed Aug 1, 2024
1 parent 2aa495f commit f2369e4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flamapy/core/operations/metrics_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def execute(self, model: VariabilityModel) -> 'Metrics':
self.model = model
# Identifying all implementations of MetricsOperation

print(f'subclasses metrics: {Metrics.__subclasses__()}')
for subclass in Metrics.__subclasses__():
# We first have to identify the metamodels that are being used and
# transform this model to the correspointing metamodel
Expand All @@ -62,14 +63,15 @@ def execute(self, model: VariabilityModel) -> 'Metrics':

def _search_transformations(self, orig: str, dest: str) -> Type[ModelToModel]:
try:
print(f'subclases: {ModelToModel.__subclasses__()}')
for m_to_m in ModelToModel.__subclasses__():
_orig = m_to_m.get_source_extension()
_dest = m_to_m.get_destination_extension()
if (_orig == orig and _dest == dest):
return m_to_m
except FlamaException:
LOGGER.exception("No transformation found that is required in the Metrics operation")
raise FlamaException("No transformation found")
raise FlamaException(f"No transformation found for {orig} -> {dest}")

def get_result(self) -> list[dict[str, Any]]:
return self.result
Expand Down

0 comments on commit f2369e4

Please sign in to comment.