flamapy-fw 2.0.0.dev2__tar.gz → 2.0.0.dev4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/PKG-INFO +1 -1
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/discover.py +3 -3
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/__init__.py +4 -2
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/core_features.py +1 -1
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/dead_features.py +0 -1
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/false_optional_features.py +1 -1
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/metrics_operation.py +16 -8
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/plugins.py +2 -2
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/metamodels/configuration_metamodel/models/configuration.py +7 -4
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/metamodels/configuration_metamodel/transformations/configuration_basic_reader.py +0 -1
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy_fw.egg-info/PKG-INFO +1 -1
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy_fw.egg-info/SOURCES.txt +0 -2
- flamapy-fw-2.0.0.dev4/flamapy_fw.egg-info/entry_points.txt +3 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/setup.py +2 -2
- flamapy-fw-2.0.0.dev2/flamapy/commands/__init__.py +0 -88
- flamapy-fw-2.0.0.dev2/flamapy/endpoint/diverso_lab.py +0 -89
- flamapy-fw-2.0.0.dev2/flamapy_fw.egg-info/entry_points.txt +0 -3
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/README.md +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/__init__.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/config.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/exceptions.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/models/__init__.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/models/ast.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/models/variability_model.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/abstract_operation.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/atomic_sets.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/average_branching_factor.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/commonality.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/configurations.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/configurations_number.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/count_leafs.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/error_detection.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/error_diagnosis.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/estimated_configurations_number.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/filter.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/sampling.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/satisfiable.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/satisfiable_configuration.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/variability.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/__init__.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/abstract_transformation.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/model_to_model.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/model_to_text.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/text_to_model.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/utils.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/metamodels/configuration_metamodel/__init__.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/metamodels/configuration_metamodel/models/__init__.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/metamodels/configuration_metamodel/transformations/__init__.py +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy_fw.egg-info/dependency_links.txt +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy_fw.egg-info/requires.txt +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy_fw.egg-info/top_level.txt +0 -0
- {flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flamapy-fw
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev4
|
|
4
4
|
Summary: Flamapy is a Python-based AAFM framework that takes into consideration previous AAFM tool designs and enables multi-solver and multi-metamodel support for the integration of AAFM tooling on the Python ecosystem.
|
|
5
5
|
Home-page: https://github.com/flamapy/core
|
|
6
6
|
Author: Flamapy
|
|
@@ -100,7 +100,7 @@ class DiscoverMetamodels:
|
|
|
100
100
|
operations = []
|
|
101
101
|
for operation in self.get_operations():
|
|
102
102
|
operations.append(operation.__name__)
|
|
103
|
-
base = operation.__base__.__name__
|
|
103
|
+
base = operation.__base__.__name__ if operation.__base__ else ''
|
|
104
104
|
if base != 'ABC':
|
|
105
105
|
operations.append(base)
|
|
106
106
|
|
|
@@ -146,7 +146,7 @@ class DiscoverMetamodels:
|
|
|
146
146
|
operations = []
|
|
147
147
|
for operation in self.get_operations_by_plugin(plugin_name):
|
|
148
148
|
operations.append(operation.__name__)
|
|
149
|
-
base = operation.__base__.__name__
|
|
149
|
+
base = operation.__base__.__name__ if operation.__base__ else ''
|
|
150
150
|
if base != 'ABC':
|
|
151
151
|
operations.append(base)
|
|
152
152
|
|
|
@@ -189,7 +189,7 @@ class DiscoverMetamodels:
|
|
|
189
189
|
|
|
190
190
|
if operation_name not in self.get_name_operations():
|
|
191
191
|
raise OperationNotFound()
|
|
192
|
-
|
|
192
|
+
vm_temp = vm_orig
|
|
193
193
|
if plugin_name is not None:
|
|
194
194
|
plugin = self.plugins.get_plugin_by_name(plugin_name)
|
|
195
195
|
#vm_temp = plugin.use_transformation_t2m(file)
|
|
@@ -12,7 +12,8 @@ from .false_optional_features import \
|
|
|
12
12
|
from .filter import Filter # pylint: disable=cyclic-import
|
|
13
13
|
from .configurations import Configurations # pylint: disable=cyclic-import
|
|
14
14
|
from .configurations_number import ConfigurationsNumber # pylint: disable=cyclic-import
|
|
15
|
-
from .estimated_configurations_number import
|
|
15
|
+
from .estimated_configurations_number import \
|
|
16
|
+
EstimatedConfigurationsNumber # pylint: disable=cyclic-import
|
|
16
17
|
from .satisfiable import Satisfiable # pylint: disable=cyclic-import
|
|
17
18
|
from .satisfiable_configuration import \
|
|
18
19
|
SatisfiableConfiguration # pylint: disable=cyclic-import
|
|
@@ -25,4 +26,5 @@ __all__ = ["Commonality", "DeadFeatures", "CoreFeatures", "FalseOptionalFeatures
|
|
|
25
26
|
"ErrorDetection", "ErrorDiagnosis", "Operation", "Variability", "CountLeafs",
|
|
26
27
|
"AverageBranchingFactor", "Filter", "Sampling",
|
|
27
28
|
"EstimatedConfigurationsNumber", "AtomicSets", 'Metrics',
|
|
28
|
-
"Satisfiable", "SatisfiableConfiguration",
|
|
29
|
+
"Satisfiable", "SatisfiableConfiguration",
|
|
30
|
+
"Configurations", "ConfigurationsNumber"]
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/false_optional_features.py
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from abc import abstractmethod
|
|
2
|
-
from typing import Any
|
|
3
2
|
|
|
4
3
|
from flamapy.core.operations import Operation
|
|
5
4
|
from flamapy.core.models.variability_model import VariabilityElement
|
|
6
5
|
|
|
6
|
+
|
|
7
7
|
class FalseOptionalFeatures(Operation):
|
|
8
8
|
"""A feature is defined as `false optional` if the selection of its parent makes the feature
|
|
9
9
|
itself selected as well, although it is defined as optional and not mandatory.
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/metrics_operation.py
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from abc import abstractmethod
|
|
1
|
+
from abc import abstractmethod, ABCMeta
|
|
2
2
|
import logging
|
|
3
3
|
import json
|
|
4
4
|
|
|
5
|
-
from typing import Any, Optional, Collection
|
|
5
|
+
from typing import Any, Optional, Collection, Type
|
|
6
6
|
|
|
7
7
|
from flamapy.core.exceptions import FlamaException
|
|
8
8
|
from flamapy.core.transformations.model_to_model import ModelToModel
|
|
@@ -12,7 +12,7 @@ from flamapy.core.models import VariabilityModel
|
|
|
12
12
|
LOGGER = logging.getLogger('Metrics')
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class Metrics(Operation):
|
|
15
|
+
class Metrics(Operation, metaclass=ABCMeta):
|
|
16
16
|
"""This is intended to host a set of metrics calculations for a variability model.
|
|
17
17
|
|
|
18
18
|
This abstract class will recruit all its implementations and agregate the results
|
|
@@ -20,6 +20,11 @@ class Metrics(Operation):
|
|
|
20
20
|
filter: Optional[list[str]] = None
|
|
21
21
|
result: list[dict[str, Any]] = []
|
|
22
22
|
|
|
23
|
+
@property
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def model_type_extension(self) -> str:
|
|
26
|
+
"""Return the model type extension for the specific metric."""
|
|
27
|
+
|
|
23
28
|
def __init__(self) -> None:
|
|
24
29
|
self.model: Optional[VariabilityModel] = None
|
|
25
30
|
|
|
@@ -37,21 +42,24 @@ class Metrics(Operation):
|
|
|
37
42
|
for subclass in Metrics.__subclasses__():
|
|
38
43
|
# We first have to identify the metamodels that are being used and
|
|
39
44
|
# transform this model to the correspointing metamodel
|
|
40
|
-
metrics_operation = subclass()
|
|
41
|
-
|
|
45
|
+
metrics_operation = subclass() # type: ignore
|
|
42
46
|
if self.model.__class__.get_extension() == metrics_operation.model_type_extension:
|
|
43
47
|
# If its the metamodel that math the model, calculate the metrics
|
|
44
48
|
# Then we calculate the metrics for each metamodel
|
|
45
|
-
|
|
49
|
+
sub_metric = subclass() # type: ignore
|
|
50
|
+
sub_metric.filter = self.filter
|
|
51
|
+
self.result.extend(sub_metric.calculate_metamodel_metrics(model))
|
|
46
52
|
else:
|
|
47
53
|
# If not, search a transformation, transform and call the calutation
|
|
48
54
|
m_to_m = self._search_transformations(self.model.__class__.get_extension(),
|
|
49
55
|
metrics_operation.model_type_extension)
|
|
50
56
|
dest_model = m_to_m(self.model).transform()
|
|
51
|
-
|
|
57
|
+
sub_metric = subclass() # type: ignore
|
|
58
|
+
sub_metric.filter = self.filter
|
|
59
|
+
self.result.extend(sub_metric.calculate_metamodel_metrics(dest_model))
|
|
52
60
|
return self
|
|
53
61
|
|
|
54
|
-
def _search_transformations(self, orig: str, dest: str) -> ModelToModel:
|
|
62
|
+
def _search_transformations(self, orig: str, dest: str) -> Type[ModelToModel]:
|
|
55
63
|
try:
|
|
56
64
|
for m_to_m in ModelToModel.__subclasses__():
|
|
57
65
|
_orig = m_to_m.get_source_extension()
|
|
@@ -26,8 +26,8 @@ class Operations(UserList[Type[Operation]]):
|
|
|
26
26
|
data: list[Type[Operation]]
|
|
27
27
|
|
|
28
28
|
def search_by_name(self, name: str) -> Type[Operation]:
|
|
29
|
-
candidates = filter(
|
|
30
|
-
lambda op: name in [op.__name__, op.__base__.__name__],
|
|
29
|
+
candidates: filter[Type[Operation]] = filter(
|
|
30
|
+
lambda op: name in [op.__name__, op.__base__.__name__ if op.__base__ else ''],
|
|
31
31
|
self.data
|
|
32
32
|
)
|
|
33
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
from flamapy.core.models import VariabilityModel
|
|
1
|
+
from typing import Any, Iterator
|
|
2
|
+
from flamapy.core.models import VariabilityModel
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Configuration(VariabilityModel):
|
|
@@ -24,6 +24,9 @@ class Configuration(VariabilityModel):
|
|
|
24
24
|
|
|
25
25
|
def __str__(self) -> str:
|
|
26
26
|
return ', '.join([str(e) for e in self.get_selected_elements()])
|
|
27
|
-
|
|
28
|
-
def
|
|
27
|
+
|
|
28
|
+
def __repr__(self) -> str:
|
|
29
|
+
return f"Configuration({self.elements})"
|
|
30
|
+
|
|
31
|
+
def __iter__(self) -> Iterator[Any]:
|
|
29
32
|
return iter(self.elements)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import csv
|
|
2
2
|
|
|
3
3
|
from flamapy.core.transformations.text_to_model import TextToModel
|
|
4
|
-
from flamapy.core.models.variability_model import VariabilityElement
|
|
5
4
|
|
|
6
5
|
from flamapy.metamodels.configuration_metamodel.models.configuration import Configuration
|
|
7
6
|
from flamapy.core.utils import file_exists
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flamapy-fw
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev4
|
|
4
4
|
Summary: Flamapy is a Python-based AAFM framework that takes into consideration previous AAFM tool designs and enables multi-solver and multi-metamodel support for the integration of AAFM tooling on the Python ecosystem.
|
|
5
5
|
Home-page: https://github.com/flamapy/core
|
|
6
6
|
Author: Flamapy
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
setup.py
|
|
3
|
-
flamapy/commands/__init__.py
|
|
4
3
|
flamapy/core/__init__.py
|
|
5
4
|
flamapy/core/config.py
|
|
6
5
|
flamapy/core/discover.py
|
|
@@ -35,7 +34,6 @@ flamapy/core/transformations/abstract_transformation.py
|
|
|
35
34
|
flamapy/core/transformations/model_to_model.py
|
|
36
35
|
flamapy/core/transformations/model_to_text.py
|
|
37
36
|
flamapy/core/transformations/text_to_model.py
|
|
38
|
-
flamapy/endpoint/diverso_lab.py
|
|
39
37
|
flamapy/metamodels/configuration_metamodel/__init__.py
|
|
40
38
|
flamapy/metamodels/configuration_metamodel/models/__init__.py
|
|
41
39
|
flamapy/metamodels/configuration_metamodel/models/configuration.py
|
|
@@ -13,7 +13,7 @@ dev_requirements = read_requirements("requirements-dev.txt")
|
|
|
13
13
|
|
|
14
14
|
setuptools.setup(
|
|
15
15
|
name="flamapy-fw",
|
|
16
|
-
version="2.0.0.
|
|
16
|
+
version="2.0.0.dev4",
|
|
17
17
|
author="Flamapy",
|
|
18
18
|
author_email="flamapy@us.es",
|
|
19
19
|
description="Flamapy is a Python-based AAFM framework that takes into consideration previous AAFM tool designs and enables multi-solver and multi-metamodel support for the integration of AAFM tooling on the Python ecosystem.",
|
|
@@ -32,7 +32,7 @@ setuptools.setup(
|
|
|
32
32
|
},
|
|
33
33
|
entry_points={
|
|
34
34
|
'console_scripts': [
|
|
35
|
-
'flamapy
|
|
35
|
+
'flamapy = flamapy.commands:flamapy_cli',
|
|
36
36
|
],
|
|
37
37
|
},
|
|
38
38
|
)
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
|
|
3
|
-
import argparse
|
|
4
|
-
import os
|
|
5
|
-
import sys
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
from shutil import copytree
|
|
8
|
-
|
|
9
|
-
from hug import development_runner
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def parser() -> argparse.ArgumentParser:
|
|
13
|
-
main_parser = argparse.ArgumentParser()
|
|
14
|
-
subparser = main_parser.add_subparsers(title="commands", dest="command")
|
|
15
|
-
|
|
16
|
-
new_plugin = subparser.add_parser("new_plugin", help="new_plugin")
|
|
17
|
-
new_plugin.add_argument('name', type=str, help='A name for your plugin. Ex: flama')
|
|
18
|
-
new_plugin.add_argument('extension', type=str, help='A extension for your plugin. Ex: fm')
|
|
19
|
-
new_plugin.add_argument('--path', default='.', type=str, help='Plugin project path.')
|
|
20
|
-
|
|
21
|
-
subparser.add_parser("cli", help="cli", description='flamapy_admin.py api: command line api')
|
|
22
|
-
return main_parser
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def cmd_new_plugin(options: argparse.Namespace) -> None:
|
|
26
|
-
name = options.name
|
|
27
|
-
ext = options.extension
|
|
28
|
-
dst = options.path
|
|
29
|
-
src = 'skel_metamodel/'
|
|
30
|
-
|
|
31
|
-
# Check DST exist
|
|
32
|
-
if not os.path.isdir(dst):
|
|
33
|
-
print(f"Folder {dst} not exist")
|
|
34
|
-
sys.exit()
|
|
35
|
-
|
|
36
|
-
# Check DST is empty
|
|
37
|
-
if len(os.listdir(dst)) != 0:
|
|
38
|
-
print(f"Folder {dst} is not empty")
|
|
39
|
-
sys.exit()
|
|
40
|
-
|
|
41
|
-
# Check DST has permissions to WRITE
|
|
42
|
-
if not os.access(dst, os.W_OK):
|
|
43
|
-
print(f"Folder {dst} has not write permissions")
|
|
44
|
-
sys.exit()
|
|
45
|
-
|
|
46
|
-
# Generating structure
|
|
47
|
-
print("Generating structure ...")
|
|
48
|
-
|
|
49
|
-
copy_files = copytree(src, dst, dirs_exist_ok=True)
|
|
50
|
-
|
|
51
|
-
for copy_file in Path(copy_files).glob('**/*'):
|
|
52
|
-
if copy_file.is_dir():
|
|
53
|
-
continue
|
|
54
|
-
with open(copy_file, "r", encoding="utf-8") as file:
|
|
55
|
-
lines = file.readlines()
|
|
56
|
-
with open(copy_file, "w", encoding="utf-8") as filewrite:
|
|
57
|
-
for line in lines:
|
|
58
|
-
out_line = line.replace('__NAME__', name.capitalize()).replace('__EXT__', ext)
|
|
59
|
-
filewrite.write(out_line)
|
|
60
|
-
|
|
61
|
-
os.rename(os.path.join(dst, 'flamapy/metamodels/__NAME__'),
|
|
62
|
-
os.path.join(dst, f'flamapy/metamodels/{name}'))
|
|
63
|
-
print("Done!")
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def cmd_cli() -> None:
|
|
67
|
-
subcommand = sys.argv[2:]
|
|
68
|
-
if not subcommand:
|
|
69
|
-
subcommand = ["help"]
|
|
70
|
-
sys.argv = [".", "-m", "flamapy.endpoint.diverso_lab", "cli", "-c"] + subcommand
|
|
71
|
-
development_runner.hug.interface.cli()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def flamapy_admin() -> None:
|
|
75
|
-
main_parser = parser()
|
|
76
|
-
|
|
77
|
-
options, _ = main_parser.parse_known_args()
|
|
78
|
-
command = options.command
|
|
79
|
-
|
|
80
|
-
if command is None:
|
|
81
|
-
main_parser.print_help()
|
|
82
|
-
sys.exit()
|
|
83
|
-
|
|
84
|
-
if command == "new_plugin":
|
|
85
|
-
cmd_new_plugin(options)
|
|
86
|
-
|
|
87
|
-
if command == "cli":
|
|
88
|
-
cmd_cli()
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
from typing import Any, NewType, Optional
|
|
2
|
-
import argparse
|
|
3
|
-
from flamapy.core.discover import DiscoverMetamodels
|
|
4
|
-
from flamapy.core.exceptions import (
|
|
5
|
-
ConfigurationNotFound,
|
|
6
|
-
OperationNotFound,
|
|
7
|
-
PluginNotFound,
|
|
8
|
-
TransformationNotFound,
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
dm = DiscoverMetamodels()
|
|
12
|
-
|
|
13
|
-
PluginsType = NewType('PluginsType', dict[str, list[str]])
|
|
14
|
-
OperationDict = NewType('OperationDict', dict[str, list[str]])
|
|
15
|
-
OperationResult = NewType('OperationResult', dict[str, Any])
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def get_plugins() -> PluginsType:
|
|
19
|
-
"""Get available plugins"""
|
|
20
|
-
plugins = dm.get_plugins()
|
|
21
|
-
return PluginsType({'plugins': plugins})
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def get_operations_name_by_plugin(plugin: str) -> OperationDict:
|
|
25
|
-
"""Get available operations given a plugin name"""
|
|
26
|
-
operations = dm.get_name_operations_by_plugin(plugin)
|
|
27
|
-
return OperationDict({'operations': operations})
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def use_operation_from_file(
|
|
31
|
-
operation: str,
|
|
32
|
-
filename: str,
|
|
33
|
-
plugin: Optional[str] = None,
|
|
34
|
-
configuration_file: Optional[str] = None,
|
|
35
|
-
) -> OperationResult:
|
|
36
|
-
"""
|
|
37
|
-
Execute an operation given an operation and one input file. Optionally, you
|
|
38
|
-
can give a plugin as the last parameter.
|
|
39
|
-
"""
|
|
40
|
-
try:
|
|
41
|
-
result = dm.use_operation_from_file(operation, filename, plugin, configuration_file)
|
|
42
|
-
return OperationResult({'result': result})
|
|
43
|
-
except OperationNotFound:
|
|
44
|
-
return OperationResult({'Error': 'Operation not found'})
|
|
45
|
-
except PluginNotFound:
|
|
46
|
-
return OperationResult({'Error': 'Plugin not found'})
|
|
47
|
-
except TransformationNotFound:
|
|
48
|
-
return OperationResult({'Error': 'Transformation not found'})
|
|
49
|
-
except FileNotFoundError:
|
|
50
|
-
return OperationResult({'Error': 'File not found'})
|
|
51
|
-
except ConfigurationNotFound:
|
|
52
|
-
return OperationResult({'Error': 'Configuration file not found'})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def main():
|
|
56
|
-
parser = argparse.ArgumentParser(description="A simple CLI example")
|
|
57
|
-
subparsers = parser.add_subparsers(dest='command', help='sub-command help')
|
|
58
|
-
|
|
59
|
-
# Subparser for the 'get-plugins' command
|
|
60
|
-
parser_plugins = subparsers.add_parser('get-plugins', help='Get available plugins')
|
|
61
|
-
|
|
62
|
-
# Subparser for the 'get-operations' command
|
|
63
|
-
parser_operations = subparsers.add_parser('get-operations', help='Get available operations by plugin')
|
|
64
|
-
parser_operations.add_argument('plugin', type=str, help='Name of the plugin')
|
|
65
|
-
|
|
66
|
-
# Subparser for the 'use-operation' command
|
|
67
|
-
parser_use_operation = subparsers.add_parser('use-operation', help='Use an operation from file')
|
|
68
|
-
parser_use_operation.add_argument('operation', type=str, help='Operation to perform')
|
|
69
|
-
parser_use_operation.add_argument('filename', type=str, help='File to use for the operation')
|
|
70
|
-
parser_use_operation.add_argument('--plugin', type=str, help='Optional plugin name')
|
|
71
|
-
parser_use_operation.add_argument('--configuration_file', type=str, help='Optional configuration file')
|
|
72
|
-
|
|
73
|
-
args = parser.parse_args()
|
|
74
|
-
|
|
75
|
-
if args.command == 'get-plugins':
|
|
76
|
-
result = get_plugins()
|
|
77
|
-
print(result)
|
|
78
|
-
elif args.command == 'get-operations':
|
|
79
|
-
result = get_operations_name_by_plugin(args.plugin)
|
|
80
|
-
print(result)
|
|
81
|
-
elif args.command == 'use-operation':
|
|
82
|
-
result = use_operation_from_file(args.operation, args.filename, args.plugin, args.configuration_file)
|
|
83
|
-
print(result)
|
|
84
|
-
else:
|
|
85
|
-
parser.print_help()
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if __name__ == '__main__':
|
|
89
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/abstract_operation.py
RENAMED
|
File without changes
|
|
File without changes
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/average_branching_factor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/configurations_number.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/operations/satisfiable_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/model_to_model.py
RENAMED
|
File without changes
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/model_to_text.py
RENAMED
|
File without changes
|
{flamapy-fw-2.0.0.dev2 → flamapy-fw-2.0.0.dev4}/flamapy/core/transformations/text_to_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|