flamapy-fm 2.0.0.dev1__tar.gz → 2.0.0.dev3__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 (39) hide show
  1. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/PKG-INFO +1 -1
  2. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/models/feature_model.py +2 -2
  3. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/__init__.py +2 -1
  4. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_estimated_configurations_number.py +1 -1
  5. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_metrics.py +1 -0
  6. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/clafer_writer.py +4 -4
  7. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/json_reader.py +9 -13
  8. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/json_writer.py +18 -18
  9. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/pysat_to_fm.py +2 -2
  10. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy_fm.egg-info/PKG-INFO +1 -1
  11. flamapy-fm-2.0.0.dev3/flamapy_fm.egg-info/dependency_links.txt +1 -0
  12. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy_fm.egg-info/requires.txt +3 -3
  13. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/setup.py +12 -17
  14. flamapy-fm-2.0.0.dev1/flamapy_fm.egg-info/dependency_links.txt +0 -1
  15. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/README.md +0 -0
  16. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/__init__.py +0 -0
  17. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/models/__init__.py +0 -0
  18. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_atomic_sets.py +0 -0
  19. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_average_branching_factor.py +0 -0
  20. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_core_features.py +0 -0
  21. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_count_leafs.py +0 -0
  22. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_feature_ancestors.py +0 -0
  23. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_generate_random_attribute.py +0 -0
  24. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_leaf_features.py +0 -0
  25. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/operations/fm_max_depth_tree.py +0 -0
  26. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/__init__.py +0 -0
  27. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/afm_reader.py +0 -0
  28. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/afm_writer.py +0 -0
  29. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/featureide_reader.py +0 -0
  30. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/featureide_writer.py +0 -0
  31. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/glencoe_reader.py +0 -0
  32. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/glencoe_writer.py +0 -0
  33. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/splot_writer.py +0 -0
  34. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/uvl_reader.py +0 -0
  35. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/uvl_writer.py +0 -0
  36. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy/metamodels/fm_metamodel/transformations/xml_reader.py +0 -0
  37. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy_fm.egg-info/SOURCES.txt +0 -0
  38. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/flamapy_fm.egg-info/top_level.txt +0 -0
  39. {flamapy-fm-2.0.0.dev1 → flamapy-fm-2.0.0.dev3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flamapy-fm
3
- Version: 2.0.0.dev1
3
+ Version: 2.0.0.dev3
4
4
  Summary: flamapy-fm is a plugin to Flamapy module
5
5
  Home-page: https://github.com/flamapy/fm_metamodel
6
6
  Author: Flamapy
@@ -275,14 +275,14 @@ class Constraint:
275
275
  (i.e., it can be transformed to a set of simple constraints)."""
276
276
  split_ctcs = split_constraint(self)
277
277
  return len(split_ctcs) > 1 and all(
278
- self.is_simple_constraint() for ctc in split_ctcs
278
+ ctc.is_simple_constraint() for ctc in split_ctcs
279
279
  )
280
280
 
281
281
  def is_strictcomplex_constraint(self) -> bool:
282
282
  """Return true if the constraint is a strict-complex constraint
283
283
  (i.e., it cannot be transformed to a set of simple constraints)."""
284
284
  split_ctcs = split_constraint(self)
285
- return any(self.is_complex_constraint() for ctc in split_ctcs)
285
+ return any(ctc.is_complex_constraint() for ctc in split_ctcs)
286
286
 
287
287
  def __str__(self) -> str:
288
288
  return f"({self.name}) {str(self.ast)}"
@@ -4,7 +4,8 @@ from .fm_leaf_features import FMLeafFeatures, get_leaf_features
4
4
  from .fm_average_branching_factor import FMAverageBranchingFactor, average_branching_factor
5
5
  from .fm_feature_ancestors import FMFeatureAncestors, get_feature_ancestors
6
6
  from .fm_max_depth_tree import FMMaxDepthTree, max_depth_tree
7
- from .fm_estimated_configurations_number import FMEstimatedConfigurationsNumber, count_configurations
7
+ from .fm_estimated_configurations_number import FMEstimatedConfigurationsNumber, \
8
+ count_configurations
8
9
  from .fm_atomic_sets import FMAtomicSets, get_atomic_sets
9
10
  from .fm_metrics import FMMetrics
10
11
  from .fm_generate_random_attribute import GenerateRandomAttribute
@@ -19,7 +19,7 @@ class FMEstimatedConfigurationsNumber(EstimatedConfigurationsNumber):
19
19
  self.result = 0
20
20
  self.feature_model: Optional[FeatureModel] = None
21
21
 
22
- def execute(self, model: VariabilityModel) -> 'FMEstimatedProductsNumber':
22
+ def execute(self, model: VariabilityModel) -> 'FMEstimatedConfigurationsNumber':
23
23
  self.feature_model = cast(FeatureModel, model)
24
24
  self.result = self.get_configurations_number()
25
25
  return self
@@ -70,6 +70,7 @@ class FMMetrics(Metrics): # pylint: disable=too-many-instance-attributes
70
70
  if callable(getattr(self, method_name))
71
71
  and hasattr(getattr(self, method_name), "_is_metric_method")
72
72
  ]
73
+
73
74
  if self.filter is not None:
74
75
  metric_methods = [
75
76
  method for method in metric_methods if method.__name__ in self.filter
@@ -1,6 +1,6 @@
1
1
  import re
2
2
  from enum import Enum
3
- from typing import Any
3
+ from typing import Any, Optional
4
4
 
5
5
  from flamapy.core.transformations import ModelToText
6
6
  from flamapy.core.models.ast import ASTOperation
@@ -93,7 +93,7 @@ def read_feature_attributes(feature: Feature, tab_count: int) -> str:
93
93
  return result
94
94
 
95
95
 
96
- def parse_group_type(feature: Feature) -> str | None:
96
+ def parse_group_type(feature: Feature) -> Optional[str]:
97
97
  group_type = None
98
98
  if feature.is_alternative_group():
99
99
  group_type = 'xor'
@@ -134,8 +134,8 @@ def attributes_definition(feature_model: FeatureModel) -> str:
134
134
  result = ''
135
135
  if attributes:
136
136
  result = f'abstract {ATTRIBUTED_FEATURE}\n'
137
- for name, type in attributes.items():
138
- result += f'\t{name} -> {type}\n'
137
+ for name, v_type in attributes.items():
138
+ result += f'\t{name} -> {v_type}\n'
139
139
  return result
140
140
 
141
141
 
@@ -1,6 +1,6 @@
1
1
  import functools
2
2
  import json
3
- from typing import Any
3
+ from typing import Any, Dict, List, Optional
4
4
 
5
5
  from flamapy.core.models.ast import Node, AST, ASTOperation
6
6
  from flamapy.core.exceptions import ParsingException
@@ -26,7 +26,7 @@ class JSONReader(TextToModel):
26
26
  def __init__(self, path: str) -> None:
27
27
  self.path = path
28
28
 
29
- def transform(self) -> str:
29
+ def transform(self) -> FeatureModel:
30
30
  with open(self.path, 'r', encoding='utf-8') as file:
31
31
  data = json.load(file)
32
32
  features_info = data['features']
@@ -36,7 +36,7 @@ class JSONReader(TextToModel):
36
36
  return FeatureModel(root_feature, constraints)
37
37
 
38
38
  @staticmethod
39
- def parse_json(json_content: str) -> FeatureModel:
39
+ def parse_json(json_content: Dict[str, Any]) -> FeatureModel:
40
40
  features_info = json_content['features']
41
41
  constraints_info = json_content['constraints']
42
42
  root_feature = parse_tree(None, features_info)
@@ -44,7 +44,7 @@ class JSONReader(TextToModel):
44
44
  return FeatureModel(root_feature, constraints)
45
45
 
46
46
 
47
- def parse_tree(parent: Feature, feature_node: dict[str, Any]) -> Feature:
47
+ def parse_tree(parent: Optional[Feature], feature_node: Dict[str, Any]) -> Feature:
48
48
  """Parse the tree structure and returns the root feature."""
49
49
  feature_name = feature_node['name']
50
50
  is_abstract = feature_node['abstract']
@@ -55,20 +55,17 @@ def parse_tree(parent: Feature, feature_node: dict[str, Any]) -> Feature:
55
55
  return feature
56
56
 
57
57
 
58
- def parse_attributes(feature: Feature, feature_node: dict[str, Any]) -> None:
58
+ def parse_attributes(feature: Feature, feature_node: Dict[str, Any]) -> None:
59
59
  if 'attributes' in feature_node:
60
60
  for attribute in feature_node['attributes']:
61
61
  attribute_name = attribute['name']
62
- if 'value' in attribute:
63
- attribute_value = attribute['value']
64
- else:
65
- attribute_value = None
62
+ attribute_value = attribute.get('value')
66
63
  attr = Attribute(attribute_name, None, attribute_value, None)
67
64
  attr.set_parent(feature)
68
65
  feature.add_attribute(attr)
69
66
 
70
67
 
71
- def parse_relations(feature: Feature, feature_node: dict[str, Any]) -> None:
68
+ def parse_relations(feature: Feature, feature_node: Dict[str, Any]) -> None:
72
69
  if 'relations' in feature_node:
73
70
  for relation in feature_node['relations']:
74
71
  children = []
@@ -93,11 +90,10 @@ def parse_relations(feature: Feature, feature_node: dict[str, Any]) -> None:
93
90
  feature.add_relation(new_relation)
94
91
 
95
92
 
96
- def parse_constraints(constraints_info: dict[str, Any]) -> list[Constraint]:
93
+ def parse_constraints(constraints_info: List[Dict[str, Any]]) -> List[Constraint]:
97
94
  constraints = []
98
95
  for ctc_info in constraints_info:
99
96
  name = ctc_info['name']
100
- # ctc_expr = ctc_info['expr'] # not used
101
97
  ast_tree = ctc_info['ast']
102
98
  ctc_node = parse_ast_constraint(ast_tree)
103
99
  ctc = Constraint(name, AST(ctc_node))
@@ -105,7 +101,7 @@ def parse_constraints(constraints_info: dict[str, Any]) -> list[Constraint]:
105
101
  return constraints
106
102
 
107
103
 
108
- def parse_ast_constraint(ctc_info: dict[str, Any]) -> Node:
104
+ def parse_ast_constraint(ctc_info: Dict[str, Any]) -> Node:
109
105
  ctc_type = ctc_info['type']
110
106
  ctc_operands = ctc_info['operands']
111
107
  node = None
@@ -1,6 +1,6 @@
1
1
  import json
2
2
  from enum import Enum
3
- from typing import Any
3
+ from typing import Any, Dict, List
4
4
 
5
5
  from flamapy.core.models.ast import Node
6
6
  from flamapy.core.transformations import ModelToText
@@ -40,21 +40,21 @@ class JSONWriter(ModelToText):
40
40
  return json.dumps(json_object, indent=4)
41
41
 
42
42
 
43
- def to_json(feature_model: FeatureModel) -> dict[str, Any]:
44
- result: dict[str, Any] = {}
43
+ def to_json(feature_model: FeatureModel) -> Dict[str, Any]:
44
+ result: Dict[str, Any] = {}
45
45
  result['features'] = get_tree_info(feature_model.root)
46
46
  result['constraints'] = get_constraints_info(feature_model.get_constraints())
47
47
  return result
48
48
 
49
49
 
50
- def get_tree_info(feature: Feature) -> dict[str, Any]:
51
- feature_info = {}
50
+ def get_tree_info(feature: Feature) -> Dict[str, Any]:
51
+ feature_info: Dict[str, Any] = {}
52
52
  feature_info['name'] = feature.name
53
- feature_info['abstract'] = feature.is_abstract
53
+ feature_info['abstract'] = str(feature.is_abstract)
54
54
 
55
- relations = []
55
+ relations: List[Dict[str, Any]] = []
56
56
  for relation in feature.get_relations():
57
- relation_info = {}
57
+ relation_info: Dict[str, Any] = {}
58
58
  relation_type = JSONFeatureType.FEATURE.value
59
59
  if relation.is_alternative():
60
60
  relation_type = JSONFeatureType.XOR.value
@@ -71,7 +71,7 @@ def get_tree_info(feature: Feature) -> dict[str, Any]:
71
71
  relation_info['type'] = relation_type
72
72
  relation_info['card_min'] = relation.card_min
73
73
  relation_info['card_max'] = relation.card_max
74
- children = []
74
+ children: List[Dict[str, Any]] = []
75
75
  for child in relation.children:
76
76
  children.append(get_tree_info(child))
77
77
  relation_info['children'] = children
@@ -86,10 +86,10 @@ def get_tree_info(feature: Feature) -> dict[str, Any]:
86
86
  return feature_info
87
87
 
88
88
 
89
- def get_attributes_info(attributes: list[Attribute]) -> list[dict[str, Any]]:
90
- attributes_info = []
89
+ def get_attributes_info(attributes: List[Attribute]) -> List[Dict[str, Any]]:
90
+ attributes_info: List[Dict[str, Any]] = []
91
91
  for attribute in attributes:
92
- attr_info = {}
92
+ attr_info: Dict[str, Any] = {}
93
93
  attr_info['name'] = attribute.name
94
94
  if attribute.default_value is not None:
95
95
  attr_info['value'] = attribute.default_value
@@ -97,10 +97,10 @@ def get_attributes_info(attributes: list[Attribute]) -> list[dict[str, Any]]:
97
97
  return attributes_info
98
98
 
99
99
 
100
- def get_constraints_info(constraints: list[Constraint]) -> list[dict[str, Any]]:
101
- constraints_info = []
100
+ def get_constraints_info(constraints: List[Constraint]) -> List[Dict[str, Any]]:
101
+ constraints_info: List[Dict[str, Any]] = []
102
102
  for ctc in constraints:
103
- ctc_info = {}
103
+ ctc_info: Dict[str, Any] = {}
104
104
  ctc_info['name'] = ctc.name
105
105
  ctc_info['expr'] = ctc.ast.pretty_str()
106
106
  ctc_info['ast'] = get_ctc_info(ctc.ast.root)
@@ -108,14 +108,14 @@ def get_constraints_info(constraints: list[Constraint]) -> list[dict[str, Any]]:
108
108
  return constraints_info
109
109
 
110
110
 
111
- def get_ctc_info(ast_node: Node) -> dict[str, Any]:
112
- ctc_info: dict[str, Any] = {}
111
+ def get_ctc_info(ast_node: Node) -> Dict[str, Any]:
112
+ ctc_info: Dict[str, Any] = {}
113
113
  if ast_node.is_term():
114
114
  ctc_info['type'] = JSONFeatureType.FEATURE.value
115
115
  ctc_info['operands'] = [ast_node.data]
116
116
  else:
117
117
  ctc_info['type'] = ast_node.data.value
118
- operands = []
118
+ operands: List[Dict[str, Any]] = []
119
119
  left = get_ctc_info(ast_node.left)
120
120
  operands.append(left)
121
121
  if ast_node.right is not None:
@@ -1,5 +1,5 @@
1
1
  import functools
2
- from typing import Optional
2
+ from typing import Optional, Union
3
3
 
4
4
  from flamapy.core.models.ast import AST, Node, ASTOperation
5
5
  from flamapy.core.transformations import ModelToModel
@@ -62,7 +62,7 @@ class PysatToFM(ModelToModel):
62
62
  raise FlamaException('Error converting from SAT to FM. ',
63
63
  'There is not candidate for the root feature.')
64
64
 
65
- def _get_node_from_clause_term(self, term: Node | int) -> Node:
65
+ def _get_node_from_clause_term(self, term: Union[Node, int]) -> Node:
66
66
  if isinstance(term, Node):
67
67
  return term
68
68
  name = self.source_model.features[abs(term)]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flamapy-fm
3
- Version: 2.0.0.dev1
3
+ Version: 2.0.0.dev3
4
4
  Summary: flamapy-fm is a plugin to Flamapy module
5
5
  Home-page: https://github.com/flamapy/fm_metamodel
6
6
  Author: Flamapy
@@ -1,6 +1,6 @@
1
- flamapy-fw~=2.0.0.dev1
2
- uvlparser~=2.0.1
3
- afmparser~=1.0.3
1
+ flamapy-fw==2.0.0.dev3
2
+ uvlparser==2.0.1
3
+ afmparser==1.0.3
4
4
 
5
5
  [dev]
6
6
  pytest
@@ -4,10 +4,19 @@ import setuptools
4
4
  with open("README.md", "r") as fh:
5
5
  long_description = fh.read()
6
6
 
7
+ def read_requirements(file):
8
+ with open(file, "r") as fh:
9
+ return fh.read().splitlines()
10
+
11
+ # Read requirements from the requirements.txt file
12
+ requirements = read_requirements("requirements.txt")
13
+
14
+ # Read development requirements from the dev-requirements.txt file
15
+ dev_requirements = read_requirements("requirements-dev.txt")
7
16
 
8
17
  setuptools.setup(
9
18
  name="flamapy-fm",
10
- version="2.0.0.dev1",
19
+ version="2.0.0.dev3",
11
20
  author="Flamapy",
12
21
  author_email="flamapy@us.es",
13
22
  description="flamapy-fm is a plugin to Flamapy module",
@@ -21,22 +30,8 @@ setuptools.setup(
21
30
  "Operating System :: OS Independent",
22
31
  ],
23
32
  python_requires='>=3.9',
24
- install_requires=[
25
- 'flamapy-fw~=2.0.0.dev1',
26
- 'uvlparser~=2.0.1',
27
- 'afmparser~=1.0.3',
28
- ],
33
+ install_requires=requirements,
29
34
  extras_require={
30
- 'dev': [
31
- 'pytest',
32
- 'pytest-mock',
33
- 'prospector',
34
- 'mypy',
35
- 'coverage',
36
- 'antlr4-tools',
37
- ]
35
+ 'dev': dev_requirements
38
36
  },
39
- dependency_links=[
40
- 'flamapy~=2.0.0.dev1',
41
- ],
42
37
  )
@@ -1 +0,0 @@
1
- flamapy~=2.0.0.dev1