Skip to content

Commit 6168a52

Browse files
committed
simplify the code
1 parent 1444868 commit 6168a52

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

codeflash/api/cfapi.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,10 @@ def suggest_changes(
201201
"replayTests": replay_tests,
202202
"concolicTests": concolic_tests,
203203
"optimizationReview": optimization_review, # impact keyword left for legacy reasons, touches js/ts code
204+
"originalLineProfiler": original_line_profiler,
205+
"optimizedLineProfiler": optimized_line_profiler,
204206
}
205207

206-
# Add line profiler data if available
207-
if original_line_profiler:
208-
payload["originalLineProfiler"] = original_line_profiler
209-
if optimized_line_profiler:
210-
payload["optimizedLineProfiler"] = optimized_line_profiler
211-
212208
return make_cfapi_request(endpoint="/suggest-pr-changes", method="POST", payload=payload)
213209

214210

@@ -254,14 +250,10 @@ def create_pr(
254250
"replayTests": replay_tests,
255251
"concolicTests": concolic_tests,
256252
"optimizationReview": optimization_review, # Impact keyword left for legacy reasons, it touches js/ts codebase
253+
"originalLineProfiler": original_line_profiler,
254+
"optimizedLineProfiler": optimized_line_profiler,
257255
}
258256

259-
# Add line profiler data if available
260-
if original_line_profiler:
261-
payload["originalLineProfiler"] = original_line_profiler
262-
if optimized_line_profiler:
263-
payload["optimizedLineProfiler"] = optimized_line_profiler
264-
265257
return make_cfapi_request(endpoint="/create-pr", method="POST", payload=payload)
266258

267259

@@ -336,14 +328,10 @@ def create_staging(
336328
"replayTests": replay_tests,
337329
"concolicTests": concolic_tests,
338330
"optimizationReview": optimization_review, # Impact keyword left for legacy reasons, it touches js/ts codebase
331+
"originalLineProfiler": original_line_profiler,
332+
"optimizedLineProfiler": optimized_line_profiler,
339333
}
340334

341-
# Add line profiler data if available
342-
if original_line_profiler:
343-
payload["originalLineProfiler"] = original_line_profiler
344-
if optimized_line_profiler:
345-
payload["optimizedLineProfiler"] = optimized_line_profiler
346-
347335
return make_cfapi_request(endpoint="/create-staging", method="POST", payload=payload)
348336

349337

0 commit comments

Comments
 (0)