flamapy-fw 2.0.2.dev0__tar.gz → 2.1.0.dev0__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.
Files changed (59) hide show
  1. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/PKG-INFO +1 -1
  2. flamapy-fw-2.1.0.dev0/flamapy/core/config.py +3 -0
  3. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/discover.py +35 -59
  4. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/models/__init__.py +1 -1
  5. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/models/ast.py +142 -130
  6. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/models/variability_model.py +2 -4
  7. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/__init__.py +25 -14
  8. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/abstract_operation.py +1 -2
  9. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/atomic_sets.py +4 -4
  10. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/average_branching_factor.py +0 -1
  11. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/commonality.py +0 -1
  12. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/configurations.py +0 -1
  13. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/configurations_number.py +0 -1
  14. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/core_features.py +0 -1
  15. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/count_leafs.py +0 -1
  16. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/dead_features.py +0 -1
  17. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/error_detection.py +0 -1
  18. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/error_diagnosis.py +0 -1
  19. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/estimated_configurations_number.py +0 -1
  20. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/filter.py +0 -1
  21. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/metrics_operation.py +29 -26
  22. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/satisfiable.py +0 -1
  23. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/satisfiable_configuration.py +0 -1
  24. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/variability.py +0 -1
  25. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/plugins.py +26 -38
  26. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/transformations/__init__.py +1 -1
  27. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/transformations/abstract_transformation.py +0 -1
  28. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/transformations/model_to_model.py +0 -1
  29. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/transformations/model_to_text.py +0 -1
  30. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/transformations/text_to_model.py +0 -1
  31. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/utils.py +1 -1
  32. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/models/configuration.py +68 -0
  33. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/transformations/__init__.py +14 -0
  34. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/transformations/configuration_basic_reader.py +92 -0
  35. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/transformations/configuration_basic_writer.py +31 -0
  36. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/transformations/configuration_json_reader.py +56 -0
  37. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/transformations/configuration_json_writer.py +25 -0
  38. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/transformations/uvls_json_reader.py +60 -0
  39. flamapy-fw-2.1.0.dev0/flamapy/metamodels/configuration_metamodel/transformations/uvls_json_writer.py +25 -0
  40. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy_fw.egg-info/PKG-INFO +1 -1
  41. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy_fw.egg-info/SOURCES.txt +6 -0
  42. flamapy-fw-2.1.0.dev0/pyproject.toml +54 -0
  43. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/setup.py +12 -9
  44. flamapy-fw-2.0.2.dev0/flamapy/core/config.py +0 -3
  45. flamapy-fw-2.0.2.dev0/flamapy/metamodels/configuration_metamodel/models/configuration.py +0 -36
  46. flamapy-fw-2.0.2.dev0/flamapy/metamodels/configuration_metamodel/transformations/__init__.py +0 -4
  47. flamapy-fw-2.0.2.dev0/flamapy/metamodels/configuration_metamodel/transformations/configuration_basic_reader.py +0 -35
  48. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/README.md +0 -0
  49. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/__init__.py +0 -0
  50. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/exceptions.py +0 -0
  51. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/false_optional_features.py +0 -0
  52. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/core/operations/sampling.py +0 -0
  53. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/metamodels/configuration_metamodel/__init__.py +0 -0
  54. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy/metamodels/configuration_metamodel/models/__init__.py +0 -0
  55. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy_fw.egg-info/dependency_links.txt +0 -0
  56. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy_fw.egg-info/entry_points.txt +0 -0
  57. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy_fw.egg-info/requires.txt +0 -0
  58. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/flamapy_fw.egg-info/top_level.txt +0 -0
  59. {flamapy-fw-2.0.2.dev0 → flamapy-fw-2.1.0.dev0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flamapy-fw
3
- Version: 2.0.2.dev0
3
+ Version: 2.1.0.dev0
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
@@ -0,0 +1,3 @@
1
+ PLUGIN_PATHS = [
2
+ "flamapy.metamodels",
3
+ ]
@@ -11,18 +11,14 @@ from flamapy.core.exceptions import TransformationNotFound
11
11
  from flamapy.core.exceptions import ConfigurationNotFound
12
12
  from flamapy.core.models import VariabilityModel
13
13
  from flamapy.core.operations import Operation
14
- from flamapy.core.plugins import (
15
- Operations,
16
- Plugin,
17
- Plugins
18
- )
14
+ from flamapy.core.plugins import Operations, Plugin, Plugins
19
15
  from flamapy.core.transformations import Transformation
20
16
  from flamapy.core.transformations.text_to_model import TextToModel
21
17
  from flamapy.core.transformations.model_to_model import ModelToModel
22
18
  from flamapy.metamodels.configuration_metamodel.models.configuration import Configuration
23
19
 
24
20
 
25
- LOGGER = logging.getLogger('discover')
21
+ LOGGER = logging.getLogger("discover")
26
22
 
27
23
 
28
24
  @runtime_checkable
@@ -38,7 +34,7 @@ def filter_modules_from_plugin_paths() -> list[ModuleType]:
38
34
  module: ModuleType = import_module(path)
39
35
  results.append(module)
40
36
  except ModuleNotFoundError:
41
- LOGGER.exception('ModuleNotFoundError %s', path)
37
+ LOGGER.exception("ModuleNotFoundError %s", path)
42
38
  return results
43
39
 
44
40
 
@@ -49,9 +45,7 @@ class DiscoverMetamodels:
49
45
 
50
46
  def search_classes(self, module: ModuleType) -> list[Any]:
51
47
  classes = []
52
- for _, file_name, ispkg in iter_modules(
53
- module.__path__, module.__name__ + '.'
54
- ):
48
+ for _, file_name, ispkg in iter_modules(module.__path__, module.__name__ + "."):
55
49
  if ispkg:
56
50
  classes += self.search_classes(import_module(file_name))
57
51
  else:
@@ -62,9 +56,7 @@ class DiscoverMetamodels:
62
56
  def discover(self) -> Plugins:
63
57
  plugins = Plugins()
64
58
  for pkg in self.module_paths:
65
- for _, plugin_name, ispkg in iter_modules(
66
- pkg.__path__, pkg.__name__ + '.'
67
- ):
59
+ for _, plugin_name, ispkg in iter_modules(pkg.__path__, pkg.__name__ + "."):
68
60
  if not ispkg:
69
61
  continue
70
62
  module = import_module(plugin_name)
@@ -90,7 +82,7 @@ class DiscoverMetamodels:
90
82
  self.plugins = self.discover()
91
83
 
92
84
  def get_operations(self) -> list[Type[Operation]]:
93
- """ Get the operations for all modules """
85
+ """Get the operations for all modules"""
94
86
  operations: list[Type[Operation]] = []
95
87
  for plugin in self.plugins:
96
88
  operations += plugin.operations
@@ -100,37 +92,33 @@ class DiscoverMetamodels:
100
92
  operations = []
101
93
  for operation in self.get_operations():
102
94
  operations.append(operation.__name__)
103
- base = operation.__base__.__name__ if operation.__base__ else ''
104
- if base != 'ABC':
95
+ base = operation.__base__.__name__ if operation.__base__ else ""
96
+ if base != "ABC":
105
97
  operations.append(base)
106
98
 
107
99
  return operations
108
100
 
109
101
  def get_transformations(self) -> list[Type[Transformation]]:
110
- """ Get transformations for all modules """
102
+ """Get transformations for all modules"""
111
103
  transformations: list[Type[Transformation]] = []
112
104
  for plugin in self.plugins:
113
105
  transformations += plugin.transformations
114
106
  return transformations
115
107
 
116
108
  def get_transformations_t2m(self) -> list[Type[TextToModel]]:
117
- """ Get t2m transformations for all modules """
109
+ """Get t2m transformations for all modules"""
118
110
 
119
111
  transformations: list[Type[TextToModel]] = []
120
112
  for plugin in self.plugins:
121
- transformations += [
122
- t for t in plugin.transformations if issubclass(t, TextToModel)
123
- ]
113
+ transformations += [t for t in plugin.transformations if issubclass(t, TextToModel)]
124
114
  return transformations
125
115
 
126
116
  def get_transformations_m2m(self) -> list[Type[ModelToModel]]:
127
- """ Get m2m transformations for all modules """
117
+ """Get m2m transformations for all modules"""
128
118
 
129
119
  transformations: list[Type[ModelToModel]] = []
130
120
  for plugin in self.plugins:
131
- transformations += [
132
- t for t in plugin.transformations if issubclass(t, ModelToModel)
133
- ]
121
+ transformations += [t for t in plugin.transformations if issubclass(t, ModelToModel)]
134
122
  return transformations
135
123
 
136
124
  def get_operations_by_plugin(self, plugin_name: str) -> Operations:
@@ -138,7 +126,8 @@ class DiscoverMetamodels:
138
126
 
139
127
  def get_plugins_with_operation(self, operation_name: str) -> list[Plugin]:
140
128
  return [
141
- plugin for plugin in self.plugins
129
+ plugin
130
+ for plugin in self.plugins
142
131
  if operation_name in self.get_name_operations_by_plugin(plugin.name)
143
132
  ]
144
133
 
@@ -146,8 +135,8 @@ class DiscoverMetamodels:
146
135
  operations = []
147
136
  for operation in self.get_operations_by_plugin(plugin_name):
148
137
  operations.append(operation.__name__)
149
- base = operation.__base__.__name__ if operation.__base__ else ''
150
- if base != 'ABC':
138
+ base = operation.__base__.__name__ if operation.__base__ else ""
139
+ if base != "ABC":
151
140
  operations.append(base)
152
141
 
153
142
  return operations
@@ -186,25 +175,22 @@ class DiscoverMetamodels:
186
175
  vm_orig: VariabilityModel,
187
176
  plugin_name: Optional[str] = None,
188
177
  configuration_file: Optional[str] = None,
189
- is_full: Optional[bool] = False
178
+ is_full: Optional[bool] = False,
190
179
  ) -> Any:
191
-
192
180
  if operation_name not in self.get_name_operations():
193
181
  raise OperationNotFound()
194
182
  vm_temp = vm_orig
195
183
  if plugin_name is not None:
196
184
  plugin = self.plugins.get_plugin_by_name(plugin_name)
197
- #vm_temp = plugin.use_transformation_t2m(file)
185
+ # vm_temp = plugin.use_transformation_t2m(file)
198
186
  else:
199
- #vm_temp = self.__transform_to_model_from_file(file)
200
- plugin = self.plugins.get_plugin_by_extension(
201
- vm_orig.get_extension())
187
+ # vm_temp = self.__transform_to_model_from_file(file)
188
+ plugin = self.plugins.get_plugin_by_extension(vm_orig.get_extension())
202
189
 
203
190
  if operation_name not in self.get_name_operations_by_plugin(plugin.name):
204
- transformation_way = self.__search_transformation_way(
205
- plugin, operation_name)
191
+ transformation_way = self.__search_transformation_way(plugin, operation_name)
206
192
 
207
- for (_, dst) in transformation_way:
193
+ for _, dst in transformation_way:
208
194
  _plugin = self.plugins.get_plugin_by_extension(dst)
209
195
  vm_temp = _plugin.use_transformation_m2m(vm_temp, dst)
210
196
  plugin = _plugin
@@ -230,9 +216,8 @@ class DiscoverMetamodels:
230
216
  file: str,
231
217
  plugin_name: Optional[str] = None,
232
218
  configuration_file: Optional[str] = None,
233
- is_full: Optional[bool] = False
219
+ is_full: Optional[bool] = False,
234
220
  ) -> Any:
235
-
236
221
  if operation_name not in self.get_name_operations():
237
222
  raise OperationNotFound()
238
223
 
@@ -241,14 +226,12 @@ class DiscoverMetamodels:
241
226
  vm_temp = plugin.use_transformation_t2m(file)
242
227
  else:
243
228
  vm_temp = self.__transform_to_model_from_file(file)
244
- plugin = self.plugins.get_plugin_by_extension(
245
- vm_temp.get_extension())
229
+ plugin = self.plugins.get_plugin_by_extension(vm_temp.get_extension())
246
230
 
247
231
  if operation_name not in self.get_name_operations_by_plugin(plugin.name):
248
- transformation_way = self.__search_transformation_way(
249
- plugin, operation_name)
232
+ transformation_way = self.__search_transformation_way(plugin, operation_name)
250
233
 
251
- for (_, dst) in transformation_way:
234
+ for _, dst in transformation_way:
252
235
  _plugin = self.plugins.get_plugin_by_extension(dst)
253
236
  vm_temp = _plugin.use_transformation_m2m(vm_temp, dst)
254
237
  plugin = _plugin
@@ -268,10 +251,9 @@ class DiscoverMetamodels:
268
251
 
269
252
  def __transform_to_model_from_file(self, file: str) -> VariabilityModel:
270
253
  t2m_transformations = self.get_transformations_t2m()
271
- extension = file.split('.')[-1]
254
+ extension = file.split(".")[-1]
272
255
  t2m_filters = filter(
273
- lambda t2m: t2m.get_source_extension() == extension,
274
- t2m_transformations
256
+ lambda t2m: t2m.get_source_extension() == extension, t2m_transformations
275
257
  )
276
258
 
277
259
  t2m = next(t2m_filters, None)
@@ -281,27 +263,21 @@ class DiscoverMetamodels:
281
263
  return t2m(file).transform()
282
264
 
283
265
  def __search_transformation_way(
284
- self,
285
- plugin: Plugin,
286
- operation_name: str
266
+ self, plugin: Plugin, operation_name: str
287
267
  ) -> list[tuple[str, str]]:
288
- '''
268
+ """
289
269
  Search way to reach plugin with operation_name using m2m transformations
290
- '''
270
+ """
291
271
  way: list[tuple[str, str]] = []
292
272
 
293
- plugins_with_operation = self.get_plugins_with_operation(
294
- operation_name)
273
+ plugins_with_operation = self.get_plugins_with_operation(operation_name)
295
274
  m2m_transformations = self.get_transformations_m2m()
296
275
 
297
276
  input_extension = plugin.get_extension()
298
277
 
299
278
  def __search_recursive_way(
300
- input_extension: str,
301
- output_extension: str,
302
- tmp_way: list[tuple[str, str]]
279
+ input_extension: str, output_extension: str, tmp_way: list[tuple[str, str]]
303
280
  ) -> list[tuple[str, str]]:
304
-
305
281
  for m2m in m2m_transformations:
306
282
  in_m2m = m2m.get_source_extension()
307
283
  out_m2m = m2m.get_destination_extension()
@@ -327,4 +303,4 @@ class DiscoverMetamodels:
327
303
  if way and output_extension == way[-1][1]:
328
304
  return way
329
305
 
330
- raise NotImplementedError('Way to execute operation not found')
306
+ raise NotImplementedError("Way to execute operation not found")
@@ -1,4 +1,4 @@
1
1
  from .variability_model import VariabilityModel, VariabilityElement # pylint: disable=cyclic-import
2
2
  from .ast import AST, ASTOperation # pylint: disable=cyclic-import
3
3
 
4
- __all__ = ["VariabilityModel", "AST", "VariabilityElement", "ASTOperation"]
4
+ __all__ = ["AST", "ASTOperation", "VariabilityElement", "VariabilityModel"]