flamapy 2.6.0.dev2__py3-none-any.whl → 2.6.0.dev3__py3-none-any.whl
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/interfaces/python/flamapy_feature_model.py +51 -32
- {flamapy-2.6.0.dev2.dist-info → flamapy-2.6.0.dev3.dist-info}/METADATA +6 -6
- flamapy-2.6.0.dev3.dist-info/RECORD +9 -0
- flamapy-2.6.0.dev2.dist-info/RECORD +0 -9
- {flamapy-2.6.0.dev2.dist-info → flamapy-2.6.0.dev3.dist-info}/WHEEL +0 -0
- {flamapy-2.6.0.dev2.dist-info → flamapy-2.6.0.dev3.dist-info}/entry_points.txt +0 -0
- {flamapy-2.6.0.dev2.dist-info → flamapy-2.6.0.dev3.dist-info}/licenses/LICENSE +0 -0
- {flamapy-2.6.0.dev2.dist-info → flamapy-2.6.0.dev3.dist-info}/top_level.txt +0 -0
|
@@ -90,6 +90,24 @@ class FLAMAFeatureModel:
|
|
|
90
90
|
self.fm_model, "pysat_diagnosis"
|
|
91
91
|
)
|
|
92
92
|
|
|
93
|
+
def _as_configuration(
|
|
94
|
+
self, configuration: Union[str, Dict[str, Any], Configuration]
|
|
95
|
+
) -> Configuration:
|
|
96
|
+
"""Resolve a configuration argument into a Configuration model.
|
|
97
|
+
|
|
98
|
+
Accepts a path to a configuration file (read via the configuration
|
|
99
|
+
transformation), a ``{feature: value}`` mapping, or an already-built
|
|
100
|
+
Configuration. This lets callers that already hold a configuration in
|
|
101
|
+
memory (e.g. an interactive UI) pass it directly without writing a file.
|
|
102
|
+
"""
|
|
103
|
+
if isinstance(configuration, Configuration):
|
|
104
|
+
return configuration
|
|
105
|
+
if isinstance(configuration, dict):
|
|
106
|
+
return Configuration(configuration)
|
|
107
|
+
return self.discover_metamodel.use_transformation_t2m(
|
|
108
|
+
configuration, "configuration"
|
|
109
|
+
)
|
|
110
|
+
|
|
93
111
|
def atomic_sets(self) -> Union[None, List[List[Any]]]:
|
|
94
112
|
"""
|
|
95
113
|
This operation is used to find the atomic sets in a model:
|
|
@@ -297,12 +315,13 @@ class FLAMAFeatureModel:
|
|
|
297
315
|
This operation selects a subset of the products of a product line based on certain
|
|
298
316
|
criteria. For example, you might filter the products to only include those that
|
|
299
317
|
contain a certain feature.
|
|
318
|
+
|
|
319
|
+
``configuration_path`` accepts a configuration file path, a ``{feature: value}``
|
|
320
|
+
mapping, or a Configuration object.
|
|
300
321
|
"""
|
|
301
322
|
try:
|
|
302
323
|
self._transform_to_sat()
|
|
303
|
-
configuration = self.
|
|
304
|
-
configuration_path, "configuration"
|
|
305
|
-
)
|
|
324
|
+
configuration = self._as_configuration(configuration_path)
|
|
306
325
|
operation = self.discover_metamodel.get_operation(self.sat_model, "PySATFilter")
|
|
307
326
|
operation.set_configuration(configuration)
|
|
308
327
|
operation.execute(self.sat_model)
|
|
@@ -350,12 +369,13 @@ class FLAMAFeatureModel:
|
|
|
350
369
|
This is a measure of how often a feature appears in the products of a
|
|
351
370
|
product line. It's usually expressed as a percentage. A feature with
|
|
352
371
|
100 per cent commonality is a core feature, as it appears in all products.
|
|
372
|
+
|
|
373
|
+
``configuration_path`` accepts a configuration file path, a ``{feature: value}``
|
|
374
|
+
mapping, or a Configuration object.
|
|
353
375
|
"""
|
|
354
376
|
try:
|
|
355
377
|
self._transform_to_sat()
|
|
356
|
-
configuration = self.
|
|
357
|
-
configuration_path, "configuration"
|
|
358
|
-
)
|
|
378
|
+
configuration = self._as_configuration(configuration_path)
|
|
359
379
|
|
|
360
380
|
operation = self.discover_metamodel.get_operation(self.sat_model, "PySATCommonality")
|
|
361
381
|
operation.set_configuration(configuration)
|
|
@@ -375,13 +395,13 @@ class FLAMAFeatureModel:
|
|
|
375
395
|
This is a product that is produced from a valid configuration of features. A valid
|
|
376
396
|
product satisfies all the constraints and dependencies in the feature model.
|
|
377
397
|
|
|
398
|
+
``configuration_path`` accepts a configuration file path, a ``{feature: value}``
|
|
399
|
+
mapping, or a Configuration object.
|
|
378
400
|
``backend`` selects the analysis plugin ("sat", "bdd" or "z3"); defaults to sat.
|
|
379
401
|
"""
|
|
380
402
|
try:
|
|
381
403
|
model = self._select_backend(backend, Backend.SAT)
|
|
382
|
-
configuration = self.
|
|
383
|
-
configuration_path, "configuration"
|
|
384
|
-
)
|
|
404
|
+
configuration = self._as_configuration(configuration_path)
|
|
385
405
|
operation = self.discover_metamodel.get_operation(
|
|
386
406
|
model, "SatisfiableConfiguration"
|
|
387
407
|
)
|
|
@@ -635,27 +655,27 @@ class FLAMAFeatureModel:
|
|
|
635
655
|
def diagnosis(
|
|
636
656
|
self,
|
|
637
657
|
configuration_path: str,
|
|
638
|
-
test_case_path: str,
|
|
658
|
+
test_case_path: Optional[str] = None,
|
|
639
659
|
max_diagnoses: Optional[int] = None,
|
|
640
660
|
) -> Union[None, List[str]]:
|
|
641
661
|
"""
|
|
642
|
-
Returns a list of diagnoses explaining why a
|
|
643
|
-
|
|
644
|
-
|
|
662
|
+
Returns a list of diagnoses explaining why a configuration is not valid against the
|
|
663
|
+
feature model: each diagnosis is a minimal set of constraints whose removal would
|
|
664
|
+
resolve the inconsistency. Requires the pysat_diagnosis plugin.
|
|
665
|
+
|
|
666
|
+
``configuration_path`` accepts a configuration file path, a ``{feature: value}``
|
|
667
|
+
mapping, or a Configuration object. ``test_case_path`` is optional and, when given,
|
|
668
|
+
diagnoses against that expected outcome instead; it accepts the same input types.
|
|
645
669
|
"""
|
|
646
670
|
try:
|
|
647
671
|
self._transform_to_diagnosis()
|
|
648
|
-
configuration = self.discover_metamodel.use_transformation_t2m(
|
|
649
|
-
configuration_path, "configuration"
|
|
650
|
-
)
|
|
651
|
-
test_case = self.discover_metamodel.use_transformation_t2m(
|
|
652
|
-
test_case_path, "configuration"
|
|
653
|
-
)
|
|
654
672
|
operation = self.discover_metamodel.get_operation(
|
|
655
673
|
self.diagnosis_model, "PySATDiagnosis"
|
|
656
674
|
)
|
|
657
|
-
|
|
658
|
-
|
|
675
|
+
if configuration_path is not None:
|
|
676
|
+
operation.set_configuration(self._as_configuration(configuration_path))
|
|
677
|
+
if test_case_path is not None:
|
|
678
|
+
operation.set_test_case(self._as_configuration(test_case_path))
|
|
659
679
|
if max_diagnoses is not None:
|
|
660
680
|
operation.set_max_diagnoses(max_diagnoses)
|
|
661
681
|
operation.execute(self.diagnosis_model)
|
|
@@ -667,27 +687,26 @@ class FLAMAFeatureModel:
|
|
|
667
687
|
def conflict(
|
|
668
688
|
self,
|
|
669
689
|
configuration_path: str,
|
|
670
|
-
test_case_path: str,
|
|
690
|
+
test_case_path: Optional[str] = None,
|
|
671
691
|
max_conflicts: Optional[int] = None,
|
|
672
692
|
) -> Union[None, List[str]]:
|
|
673
693
|
"""
|
|
674
694
|
Returns a list of conflict sets: minimal subsets of the model constraints that are
|
|
675
|
-
inconsistent with the given configuration
|
|
676
|
-
|
|
695
|
+
inconsistent with the given configuration. Requires the pysat_diagnosis plugin.
|
|
696
|
+
|
|
697
|
+
``configuration_path`` accepts a configuration file path, a ``{feature: value}``
|
|
698
|
+
mapping, or a Configuration object. ``test_case_path`` is optional and, when given,
|
|
699
|
+
looks for conflicts against that expected outcome instead; same input types.
|
|
677
700
|
"""
|
|
678
701
|
try:
|
|
679
702
|
self._transform_to_diagnosis()
|
|
680
|
-
configuration = self.discover_metamodel.use_transformation_t2m(
|
|
681
|
-
configuration_path, "configuration"
|
|
682
|
-
)
|
|
683
|
-
test_case = self.discover_metamodel.use_transformation_t2m(
|
|
684
|
-
test_case_path, "configuration"
|
|
685
|
-
)
|
|
686
703
|
operation = self.discover_metamodel.get_operation(
|
|
687
704
|
self.diagnosis_model, "PySATConflict"
|
|
688
705
|
)
|
|
689
|
-
|
|
690
|
-
|
|
706
|
+
if configuration_path is not None:
|
|
707
|
+
operation.set_configuration(self._as_configuration(configuration_path))
|
|
708
|
+
if test_case_path is not None:
|
|
709
|
+
operation.set_test_case(self._as_configuration(test_case_path))
|
|
691
710
|
if max_conflicts is not None:
|
|
692
711
|
operation.set_max_conflicts(max_conflicts)
|
|
693
712
|
operation.execute(self.diagnosis_model)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flamapy
|
|
3
|
-
Version: 2.6.0.
|
|
3
|
+
Version: 2.6.0.dev3
|
|
4
4
|
Summary: Flamapy feature model is a distribution of the flama framework containing all plugins required to analyze feature models. It also offers a richer API and a complete command line interface and documentation.
|
|
5
5
|
Author-email: Flamapy <flamapy@us.es>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -8,11 +8,11 @@ Project-URL: Homepage, https://github.com/flamapy/flamapy-feature-model
|
|
|
8
8
|
Requires-Python: >=3.11
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Requires-Dist: flamapy-fw~=2.6.0.
|
|
12
|
-
Requires-Dist: flamapy-fm~=2.6.0.
|
|
13
|
-
Requires-Dist: flamapy-sat~=2.6.0.
|
|
14
|
-
Requires-Dist: flamapy-bdd~=2.6.0.
|
|
15
|
-
Requires-Dist: flamapy-z3~=2.6.0.
|
|
11
|
+
Requires-Dist: flamapy-fw~=2.6.0.dev3
|
|
12
|
+
Requires-Dist: flamapy-fm~=2.6.0.dev3
|
|
13
|
+
Requires-Dist: flamapy-sat~=2.6.0.dev3
|
|
14
|
+
Requires-Dist: flamapy-bdd~=2.6.0.dev3
|
|
15
|
+
Requires-Dist: flamapy-z3~=2.6.0.dev3
|
|
16
16
|
Provides-Extra: dev
|
|
17
17
|
Requires-Dist: pytest; extra == "dev"
|
|
18
18
|
Requires-Dist: pytest-mock; extra == "dev"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
flamapy/commands/__init__.py,sha256=S9KJB8u4Ww5_6KQYs70iwQFbtDm08J7UvE7vxAB6DeE,6609
|
|
2
|
+
flamapy/interfaces/python/__init__.py,sha256=NVQH1l6O9ElD8YvUVBXJN0Y_ETmu3AbyQBZJJ9qiuoU,86
|
|
3
|
+
flamapy/interfaces/python/flamapy_feature_model.py,sha256=ojxMc3XtAvnBs9T7ETLo1rFpt1g0XRMc8MRdHf1HJ2w,30598
|
|
4
|
+
flamapy-2.6.0.dev3.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
5
|
+
flamapy-2.6.0.dev3.dist-info/METADATA,sha256=7Wxg3ihkwqbab3vygVZ_4xZvcq6jEjc9H652F3kxBBY,1265
|
|
6
|
+
flamapy-2.6.0.dev3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
7
|
+
flamapy-2.6.0.dev3.dist-info/entry_points.txt,sha256=CS_W4K9LW9xOf-7ymWD58KklNHBnhMHm0RXAZ9JLgVo,57
|
|
8
|
+
flamapy-2.6.0.dev3.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
|
|
9
|
+
flamapy-2.6.0.dev3.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
flamapy/commands/__init__.py,sha256=S9KJB8u4Ww5_6KQYs70iwQFbtDm08J7UvE7vxAB6DeE,6609
|
|
2
|
-
flamapy/interfaces/python/__init__.py,sha256=NVQH1l6O9ElD8YvUVBXJN0Y_ETmu3AbyQBZJJ9qiuoU,86
|
|
3
|
-
flamapy/interfaces/python/flamapy_feature_model.py,sha256=2wM0rdu2BS9vPuVlGfWwmPA1RsTPQLiDLiyM0BMjE1M,29296
|
|
4
|
-
flamapy-2.6.0.dev2.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
5
|
-
flamapy-2.6.0.dev2.dist-info/METADATA,sha256=heJJ6_V1houSKATb_r_JduUUa282Pd3yhHIbDOTc4TI,1265
|
|
6
|
-
flamapy-2.6.0.dev2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
7
|
-
flamapy-2.6.0.dev2.dist-info/entry_points.txt,sha256=CS_W4K9LW9xOf-7ymWD58KklNHBnhMHm0RXAZ9JLgVo,57
|
|
8
|
-
flamapy-2.6.0.dev2.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
|
|
9
|
-
flamapy-2.6.0.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|