flamapy-bdd 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.
@@ -9,6 +9,9 @@ from flamapy.core.models import VariabilityModel
9
9
  from flamapy.core.transformations import CacheableModelToModel
10
10
  from flamapy.metamodels.fm_metamodel.models import FeatureModel
11
11
  from flamapy.metamodels.fm_metamodel.transformations import FMSecureFeaturesNames
12
+ from flamapy.metamodels.fm_metamodel.transformations.constraint_support import (
13
+ warn_non_boolean_constraints,
14
+ )
12
15
  from flamapy.metamodels.bdd_metamodel.models import BDDModel
13
16
  from flamapy.metamodels.bdd_metamodel.models.bdd_model import DD_BACKEND
14
17
  from flamapy.metamodels.bdd_metamodel.models.utils import PLModel
@@ -161,6 +164,10 @@ class FmToBDD(CacheableModelToModel):
161
164
  return model
162
165
 
163
166
  def transform(self) -> BDDModel:
167
+ _check_constraint_features(cast(FeatureModel, self.source_model))
168
+ # The BDD encodes the Boolean constraints only: say so when others are left out
169
+ # (flamapy/flamapy#5).
170
+ warn_non_boolean_constraints(cast(FeatureModel, self.source_model), 'BDD encoding')
164
171
  fm_secure_names_op = FMSecureFeaturesNames(self.source_model)
165
172
  secured_model = fm_secure_names_op.transform()
166
173
 
@@ -213,6 +220,24 @@ class FmToBDD(CacheableModelToModel):
213
220
  return model
214
221
 
215
222
 
223
+ def _check_constraint_features(feature_model: FeatureModel) -> None:
224
+ """Reject a model whose Boolean constraints name a feature it does not declare.
225
+
226
+ The constraints are handed to the BDD engine as expressions, so an undeclared name would
227
+ otherwise surface as an error of the engine (``dd``'s ``ValueError: undeclared variable``,
228
+ or ``RuntimeError: Illegal character`` for a dotted name). The SAT and Z3 backends reject
229
+ such a model with a FlamaException, and so does this one now (flamapy/bdd_metamodel#40).
230
+ Only the logical constraints are checked, since they are the only ones the BDD encodes.
231
+ """
232
+ declared = {feature.name for feature in feature_model.get_features()}
233
+ for constraint in feature_model.get_logical_constraints():
234
+ missing = sorted(set(constraint.get_features()) - declared)
235
+ if missing:
236
+ raise FlamaException(
237
+ f"Feature {', '.join(missing)} is not in the model "
238
+ f"(constraint {constraint.name}: {constraint.ast})")
239
+
240
+
216
241
  def attach_feature_mapping(model: BDDModel, source_model: FeatureModel) -> None:
217
242
  """Attach to `model` the feature <-> variable mapping of `source_model`.
218
243
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamapy-bdd
3
- Version: 2.9.0.dev2
3
+ Version: 2.9.0.dev4
4
4
  Summary: bdd-plugin for the automated analysis of feature models
5
5
  Author-email: Flamapy <flamapy@us.es>
6
6
  License-Expression: GPL-3.0-or-later
@@ -8,8 +8,8 @@ Project-URL: Homepage, https://github.com/flamapy/bdd_metamodel
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
11
+ Requires-Dist: flamapy-fw~=2.9.0.dev4
12
+ Requires-Dist: flamapy-fm~=2.9.0.dev4
13
13
  Requires-Dist: dd~=0.6.0
14
14
  Requires-Dist: graphviz~=0.20
15
15
  Provides-Extra: dev
@@ -20,7 +20,7 @@ Requires-Dist: mypy; extra == "dev"
20
20
  Requires-Dist: coverage; extra == "dev"
21
21
  Provides-Extra: test
22
22
  Requires-Dist: pytest; extra == "test"
23
- Requires-Dist: flamapy-sat~=2.9.0.dev2; extra == "test"
23
+ Requires-Dist: flamapy-sat~=2.9.0.dev4; extra == "test"
24
24
  Dynamic: license-file
25
25
 
26
26
  # flamapy-bdd
@@ -39,15 +39,15 @@ flamapy/metamodels/bdd_metamodel/operations/interfaces/variant_features.py,sha25
39
39
  flamapy/metamodels/bdd_metamodel/transformations/__init__.py,sha256=ZWF5BEXRZzRTrh8AcxJJ1Rck8Sd0yzkEY3JO8N0GsQI,437
40
40
  flamapy/metamodels/bdd_metamodel/transformations/dddmp_reader.py,sha256=_USYSdZyVeoouM8_ppvhaGzH1xoBGqYDC1UBoGKj98U,7255
41
41
  flamapy/metamodels/bdd_metamodel/transformations/dddmp_writer.py,sha256=ae40bgt1TfjfzkMAmkTQCiph7GXmUyn51bv3R-9-wp0,2036
42
- flamapy/metamodels/bdd_metamodel/transformations/fm_to_bdd.py,sha256=HQ_x3OiJ0_Zv7MT8SzPZmdX6VQ2TWvnXfqmt06OT_tQ,11519
42
+ flamapy/metamodels/bdd_metamodel/transformations/fm_to_bdd.py,sha256=9HF0G3sYzSB6X5uqH20sXZq74GdWCaiGxY8m9Va3jQM,12949
43
43
  flamapy/metamodels/bdd_metamodel/transformations/json_reader.py,sha256=hdOt8vvcrGhYToiGkt8KbLXzV7ukZN-bsOlVrA_TqZI,382
44
44
  flamapy/metamodels/bdd_metamodel/transformations/json_writer.py,sha256=V9WB2lZf3FSe7a9QypT55RFcE20i7Q6COxcaJbwf2-s,1116
45
45
  flamapy/metamodels/bdd_metamodel/transformations/pdf_writer.py,sha256=9gVPvsE7a5zrWs90Ga9zEFmZx8psDxGxArckEP6BytQ,618
46
46
  flamapy/metamodels/bdd_metamodel/transformations/png_writer.py,sha256=I9kzWHiiv2HH5xgReua6FlXLSUrTbFAoQYN8HPRN0fo,618
47
47
  flamapy/metamodels/bdd_metamodel/transformations/svg_writer.py,sha256=AOrP_nWyHTOFNZyfk93FQgYdax2wdG5ZU6j30cnU33U,618
48
- flamapy_bdd-2.9.0.dev2.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
49
- flamapy_bdd-2.9.0.dev2.dist-info/METADATA,sha256=9tyFsS4SL60Ik2GBYv0W4ObKDvfEpvF1s8WjsoSJ0Qs,3113
50
- flamapy_bdd-2.9.0.dev2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
51
- flamapy_bdd-2.9.0.dev2.dist-info/entry_points.txt,sha256=0tU2El7cp44QtkP_MQ5gWcX2HKEP8oIqzybN1v_CUqs,57
52
- flamapy_bdd-2.9.0.dev2.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
53
- flamapy_bdd-2.9.0.dev2.dist-info/RECORD,,
48
+ flamapy_bdd-2.9.0.dev4.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
49
+ flamapy_bdd-2.9.0.dev4.dist-info/METADATA,sha256=lCd7WZGbvtVnn7fsfM2LnKRxEyke1g5GPdaFjqmlEx8,3113
50
+ flamapy_bdd-2.9.0.dev4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
51
+ flamapy_bdd-2.9.0.dev4.dist-info/entry_points.txt,sha256=0tU2El7cp44QtkP_MQ5gWcX2HKEP8oIqzybN1v_CUqs,57
52
+ flamapy_bdd-2.9.0.dev4.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
53
+ flamapy_bdd-2.9.0.dev4.dist-info/RECORD,,