Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bring updates from master to develop #111

Merged
merged 3 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions flamapy/core/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ def use_transformation_t2m(self, src: str, dst: str) -> VariabilityModel:
def use_transformation_m2m(self, src: VariabilityModel, dst: str) -> VariabilityModel:
plugin = self.plugins.get_plugin_by_extension(dst)
return plugin.use_transformation_m2m(src, dst)


def get_operation(self, src: VariabilityModel, operation_name: str) -> Operation:
plugin = self.plugins.get_plugin_by_variability_model(src)
return plugin.get_operation(operation_name)

def use_operation(self, src: VariabilityModel, operation_name: str) -> Operation:
plugin = self.plugins.get_plugin_by_variability_model(src)
operation = plugin.get_operation(operation_name)
Expand Down Expand Up @@ -275,4 +279,4 @@ def __search_recursive_way(
if way and output_extension == way[-1][1]:
return way

raise NotImplementedError('Way to execute operation not found')
raise NotImplementedError('Way to execute operation not found')
6 changes: 3 additions & 3 deletions flamapy/core/models/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ def simplify_formula(ast: AST) -> AST:
right = simplify_formula(AST(right)).root
result = AST.create_binary_operation(ASTOperation.OR, Node(ASTOperation.NOT, left), right)
elif logic_op == ASTOperation.EXCLUDES:
# Replace P EXCLUDES Q with P => !Q.
# Replace P EXCLUDES Q with !P v !Q.
left = simplify_formula(AST(left)).root
right = simplify_formula(AST(right)).root
result = AST.create_binary_operation(ASTOperation.IMPLIES,
left, Node(ASTOperation.NOT, right))
result = AST.create_binary_operation(ASTOperation.OR, Node(ASTOperation.NOT, left),
Node(ASTOperation.NOT, right))
elif logic_op == ASTOperation.EQUIVALENCE:
# Replace P <=> Q with P => Q ∧ Q => P.
left = simplify_formula(AST.create_binary_operation(ASTOperation.IMPLIES,
Expand Down
7 changes: 4 additions & 3 deletions flamapy/endpoint/diverso_lab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, NewType, Optional
from typing import Any, NewType

import hug
from flamapy.core.discover import DiscoverMetamodels
Expand Down Expand Up @@ -37,15 +37,16 @@ def get_operations_name_by_plugin(plugin: str, versions: int = 1) -> OperationDi
def use_operation_from_file(
operation: str,
filename: str,
plugin: Optional[str] = None,
plugin: str = None,
configuration_file: str = None,
versions: int = 1
) -> OperationResult:
"""
Execute an operation gave an operation and one input file. Optionally you
can give a plugin as last parameter.
"""
try:
result = dm.use_operation_from_file(operation, filename, plugin)
result = dm.use_operation_from_file(operation, filename, plugin, configuration_file)
except OperationNotFound:
return OperationResult({'Error': 'Operation not found'})
except PluginNotFound:
Expand Down