flamapy 2.9.0.dev2__py3-none-any.whl → 2.9.0.dev4__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.
@@ -32,6 +32,7 @@ from flamapy.core.operations import (
32
32
  from flamapy.core.planner import Plan, plan as plan_backend
33
33
  from flamapy.metamodels.configuration_metamodel.models import Configuration
34
34
  from flamapy.metamodels.fm_metamodel.models import FeatureModel
35
+ from flamapy.metamodels.fm_metamodel.transformations import FlatFM
35
36
  from flamapy.metamodels.fm_metamodel.operations.fm_language_level import (
36
37
  calculate_language_level,
37
38
  )
@@ -175,6 +176,16 @@ class FLAMAFeatureModel:
175
176
  self.model_path = model_path
176
177
  self.discover_metamodel = DiscoverMetamodels()
177
178
  self.fm_model = self._read(model_path)
179
+ # The backends identify a feature by its name, so two features with one name are
180
+ # analysed as a single feature: no result on such a model can be trusted. The result
181
+ # envelopes still say exact=True, which only tells whether the backend approximates.
182
+ repeated = self._repeated_names()
183
+ if repeated:
184
+ warnings.warn(
185
+ f"The model has {len(repeated)} feature name(s) used by more than one "
186
+ f"feature ({', '.join(repeated)}). Features are identified by name, so the "
187
+ "analysis results on this model cannot be guaranteed.",
188
+ UserWarning, stacklevel=2)
178
189
  self.backend = Backend(backend) if backend is not None else None
179
190
  self.allow_approximate = allow_approximate
180
191
  self.raise_errors = raise_errors
@@ -186,7 +197,16 @@ class FLAMAFeatureModel:
186
197
  self._model_language_level: Optional[LanguageLevel] = None
187
198
 
188
199
  def _read(self, model_path: str) -> FeatureModel:
189
- return self.discover_metamodel.use_transformation_t2m(model_path, "fm")
200
+ model = self.discover_metamodel.use_transformation_t2m(model_path, "fm")
201
+ if getattr(model, 'imports', None):
202
+ # The analyses work on one tree: without this the imported models would count
203
+ # as leaf features, and their features and constraints would be ignored.
204
+ model = FlatFM(model).transform()
205
+ return model
206
+
207
+ def _repeated_names(self) -> list[str]:
208
+ names = [feature.name for feature in self.fm_model.get_features()]
209
+ return sorted({name for name in names if names.count(name) > 1})
190
210
 
191
211
  def _as_configuration(
192
212
  self, configuration: Union[str, Dict[str, Any], Configuration]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamapy
3
- Version: 2.9.0.dev2
3
+ Version: 2.9.0.dev4
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,21 +8,21 @@ 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.9.0.dev2
12
- Requires-Dist: flamapy-fm~=2.9.0.dev2
13
- Requires-Dist: flamapy-sat~=2.9.0.dev2
14
- Requires-Dist: flamapy-bdd~=2.9.0.dev2
15
- Requires-Dist: flamapy-z3~=2.9.0.dev2
11
+ Requires-Dist: flamapy-fw~=2.9.0.dev4
12
+ Requires-Dist: flamapy-fm~=2.9.0.dev4
13
+ Requires-Dist: flamapy-sat~=2.9.0.dev4
14
+ Requires-Dist: flamapy-bdd~=2.9.0.dev4
15
+ Requires-Dist: flamapy-z3~=2.9.0.dev4
16
16
  Provides-Extra: sharpsat
17
- Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "sharpsat"
17
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev4; extra == "sharpsat"
18
18
  Provides-Extra: dnnf
19
- Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "dnnf"
19
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev4; extra == "dnnf"
20
20
  Provides-Extra: sdd
21
- Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "sdd"
21
+ Requires-Dist: flamapy-sdd~=2.9.0.dev4; extra == "sdd"
22
22
  Provides-Extra: all-solvers
23
- Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "all-solvers"
24
- Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "all-solvers"
25
- Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "all-solvers"
23
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev4; extra == "all-solvers"
24
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev4; extra == "all-solvers"
25
+ Requires-Dist: flamapy-sdd~=2.9.0.dev4; extra == "all-solvers"
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest; extra == "dev"
28
28
  Requires-Dist: pytest-mock; extra == "dev"
@@ -1,11 +1,11 @@
1
1
  flamapy/commands/__init__.py,sha256=DdRS2Xyt37H_k2YaaFWUcE6xfJALzllraerIup1l_OU,14646
2
2
  flamapy/interfaces/python/__init__.py,sha256=NVQH1l6O9ElD8YvUVBXJN0Y_ETmu3AbyQBZJJ9qiuoU,86
3
3
  flamapy/interfaces/python/_stub.py,sha256=7JMmnmxHFbpC7XHVqozZUooLwPbHS4p1-B8QXH5wQf8,3898
4
- flamapy/interfaces/python/flamapy_feature_model.py,sha256=m_aPkDi_B11789mHpJPLRws1vKB3PLPAfAtiQGICcdY,29902
4
+ flamapy/interfaces/python/flamapy_feature_model.py,sha256=2cXOtYClp7vgybleRNL9JMV-T0UM3cMX-OTWjWszM90,31110
5
5
  flamapy/interfaces/python/flamapy_feature_model.pyi,sha256=u-GtNc1wRslPO1I2sIIsNuOxrdT-dR0GZpqzyskHT34,6189
6
- flamapy-2.9.0.dev2.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
7
- flamapy-2.9.0.dev2.dist-info/METADATA,sha256=LP-2mlXxcwWaCu1wNCIN7h20Gq9fonomlp7eYBjYwfI,1731
8
- flamapy-2.9.0.dev2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
- flamapy-2.9.0.dev2.dist-info/entry_points.txt,sha256=CS_W4K9LW9xOf-7ymWD58KklNHBnhMHm0RXAZ9JLgVo,57
10
- flamapy-2.9.0.dev2.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
11
- flamapy-2.9.0.dev2.dist-info/RECORD,,
6
+ flamapy-2.9.0.dev4.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
7
+ flamapy-2.9.0.dev4.dist-info/METADATA,sha256=J2QN8FSx63TAiazGlvFLXLCvNKMrAatnn_JOESBX9ic,1731
8
+ flamapy-2.9.0.dev4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
+ flamapy-2.9.0.dev4.dist-info/entry_points.txt,sha256=CS_W4K9LW9xOf-7ymWD58KklNHBnhMHm0RXAZ9JLgVo,57
10
+ flamapy-2.9.0.dev4.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
11
+ flamapy-2.9.0.dev4.dist-info/RECORD,,