Skip to content

Commit d3e5ae7

Browse files
committed
feat: Improve graph generation
1 parent b2c720f commit d3e5ae7

File tree

10 files changed

+56
-755
lines changed

10 files changed

+56
-755
lines changed

app/controllers/file_operation_controller.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
from fastapi.responses import JSONResponse
33
from flamapy.metamodels.smt_metamodel.operations import (
44
FilterConfigs,
5-
# MinimizeImpact,
65
MaximizeImpact,
6+
MinimizeImpact,
7+
NumberOfProducts,
78
ValidModel,
8-
NumberOfProducts
99
)
10-
from app.controllers.minimize import MinimizeImpact
11-
from app.controllers.graph_to_smt2 import GraphToSMT
10+
from flamapy.metamodels.smt_metamodel.transformations import GraphToSMT
1211

1312
from app.services import (
1413
read_data_for_smt_transform,
1514
read_graph_for_info_operation,
1615
read_releases_by_counts,
1716
)
1817
from app.utils import get_manager, json_encoder
19-
import time
18+
2019
router = APIRouter()
2120

2221

@@ -25,7 +24,9 @@
2524
summary="Summarizes file information",
2625
response_description="Return file information",
2726
)
28-
async def file_info(requirement_file_id: str, file_name: str, max_level: int) -> JSONResponse:
27+
async def file_info(
28+
requirement_file_id: str, file_name: str, max_level: int
29+
) -> JSONResponse:
2930
"""
3031
Summarizes file information regarding its dependencies, edges and vulnerabilities:
3132
@@ -46,7 +47,9 @@ async def file_info(requirement_file_id: str, file_name: str, max_level: int) ->
4647
summary="Validates model satisfiability",
4748
response_description="Return True if valid, False if not",
4849
)
49-
async def valid_file(requirement_file_id: str, file_name: str, max_level: int) -> JSONResponse:
50+
async def valid_file(
51+
requirement_file_id: str, file_name: str, max_level: int
52+
) -> JSONResponse:
5053
"""
5154
Summarizes requirement file graph information regarding its dependencies,
5255
edges and vulnerabilities:
@@ -114,19 +117,13 @@ async def minimize_impact(
114117
- **max_level**: the depth of the graph to be analysed
115118
"""
116119
package_manager = await get_manager(file_name)
117-
begin = time.time()
118120
graph_data = await read_data_for_smt_transform(
119121
requirement_file_id, package_manager, max_level
120122
)
121-
print("Tiempo de Extracción: " + str(time.time()-begin))
122-
begin = time.time()
123123
smt_transform = GraphToSMT(graph_data, file_name, package_manager, agregator)
124124
smt_transform.transform()
125-
print("Tiempo de Transformación: " + str(time.time()-begin))
126-
begin = time.time()
127125
operation = MinimizeImpact(limit)
128126
operation.execute(smt_transform.destination_model)
129-
print("Tiempo de Ejecución de la Operación: " + str(time.time()-begin))
130127
result = await read_releases_by_counts(operation.get_result(), package_manager)
131128
return JSONResponse(
132129
status_code=status.HTTP_200_OK, content=json_encoder({"result": result})

app/controllers/graph_to_smt.py

Lines changed: 0 additions & 282 deletions
This file was deleted.

0 commit comments

Comments
 (0)