@@ -96,7 +96,7 @@ def _simulate_sjf_np(self) -> Generator[tuple[int, str | None, list[str]]]:
9696 t += 1
9797 yield (t , None , [])
9898 continue
99- process = min (ready , key = lambda x : x ["burst" ])
99+ process = min (ready , key = lambda proc : x ["burst" ])
100100 for _ in range (process ["burst" ]):
101101 self .timeline .append ((t , process ["pid" ]))
102102 yield (t , process ["pid" ], [])
@@ -106,7 +106,7 @@ def _simulate_sjf_np(self) -> Generator[tuple[int, str | None, list[str]]]:
106106
107107 # shortest job first preemptive
108108 def _simulate_sjf_p (self ) -> Generator [tuple [int , str | None , list [str ]]]:
109- """
109+ """
110110 Simulates SJF Preemptive scheduling.
111111
112112 >>> processes = [{"pid": "P1", "arrival": 0, "burst": 3}]
@@ -128,7 +128,7 @@ def _simulate_sjf_p(self) -> Generator[tuple[int, str | None, list[str]]]:
128128 t += 1
129129 yield (t , None , [])
130130 continue
131- process = min (ready , key = lambda x : x ["remaining" ])
131+ process = min (ready , key = lambda proc : x ["remaining" ])
132132 self .timeline .append ((t , process ["pid" ]))
133133 yield (t , process ["pid" ], [])
134134 process ["remaining" ] -= 1
@@ -139,7 +139,7 @@ def _simulate_sjf_p(self) -> Generator[tuple[int, str | None, list[str]]]:
139139
140140 # priority non preemptive
141141 def _simulate_priority_np (self ) -> Generator [tuple [int , str | None , list [str ]]]:
142- """
142+ """
143143 Simulates Priority (Non-Preemptive) scheduling.
144144
145145 >>> processes = [{"pid": "P1", "arrival": 0, "burst": 2, "priority": 1}]
@@ -160,7 +160,7 @@ def _simulate_priority_np(self) -> Generator[tuple[int, str | None, list[str]]]:
160160 t += 1
161161 yield (t , None , [])
162162 continue
163- process = min (ready , key = lambda x : x ["priority" ])
163+ process = min (ready , key = lambda proc : x ["priority" ])
164164 for _ in range (process ["burst" ]):
165165 self .timeline .append ((t , process ["pid" ]))
166166 yield (t , process ["pid" ], [])
@@ -170,7 +170,7 @@ def _simulate_priority_np(self) -> Generator[tuple[int, str | None, list[str]]]:
170170
171171 # priority preemptive
172172 def _simulate_priority_p (self ) -> Generator [tuple [int , str | None , list [str ]]]:
173- """
173+ """
174174 Simulates Priority (Preemptive) scheduling.
175175
176176 >>> processes = [{"pid": "P1", "arrival": 0, "burst": 2, "priority": 1}]
@@ -190,7 +190,7 @@ def _simulate_priority_p(self) -> Generator[tuple[int, str | None, list[str]]]:
190190 t += 1
191191 yield (t , None , [])
192192 continue
193- process = min (ready , key = lambda x : x ["priority" ])
193+ process = min (ready , key = lambda proc : x ["priority" ])
194194 self .timeline .append ((t , process ["pid" ]))
195195 yield (t , process ["pid" ], [])
196196 process ["remaining" ] -= 1
@@ -299,12 +299,12 @@ def setup_ui(self) -> None:
299299 self .algo_cb = ttk .Combobox (
300300 algo_frame ,
301301 values = [
302- "FCFS" ,
303- "SJF (Non-Preemptive)" ,
304- "SJF (Preemptive)" ,
305- "Priority (Non-Preemptive)" ,
306- "Priority (Preemptive)" ,
307- "Round Robin" ,
302+ "FCFS" ,
303+ "SJF (Non-Preemptive)" ,
304+ "SJF (Preemptive)" ,
305+ "Priority (Non-Preemptive)" ,
306+ "Priority (Preemptive)" ,
307+ "Round Robin" ,
308308 ],
309309 )
310310 self .algo_cb .current (0 )
@@ -355,7 +355,7 @@ def add_process(self) -> None:
355355 >>> len(gui.processes) > 0
356356 True
357357 >>> root.destroy()
358- """
358+ """
359359 try :
360360 pid = self .pid_e .get ()
361361 arrival = int (self .arrival_e .get ())
@@ -369,7 +369,7 @@ def add_process(self) -> None:
369369 messagebox .showerror ("Error" , "Invalid input" )
370370
371371 def delete_process (self ) -> None :
372- """
372+ """
373373 Deletes a selected process.
374374
375375 >>> import tkinter as tk
@@ -383,14 +383,14 @@ def delete_process(self) -> None:
383383 >>> gui.processes
384384 []
385385 >>> root.destroy()
386- """
386+ """
387387 if sel := self .tree .selection ():
388388 pid = self .tree .item (sel [0 ])["values" ][0 ]
389389 self .processes = [p for p in self .processes if p ["pid" ] != pid ]
390390 self .tree .delete (sel [0 ])
391391
392392 def run_scheduling (self ) -> None :
393- """
393+ """
394394 Runs the selected scheduling algorithm.
395395
396396 >>> import tkinter as tk
@@ -402,7 +402,7 @@ def run_scheduling(self) -> None:
402402 >>> hasattr(gui, "engine")
403403 True
404404 >>> root.destroy()
405- """
405+ """
406406 algo = self .algo_cb .get ()
407407 quantum = int (self .quantum_e .get () or 2 )
408408 if algo .lower () == "round robin" :
@@ -427,7 +427,7 @@ def animate(self) -> None:
427427 >>> hasattr(gui, "animate")
428428 True
429429 >>> root.destroy()
430- """
430+ """
431431 self .ax .clear ()
432432 x : int = 0
433433 colors : dict [str , any ] = {}
@@ -462,7 +462,7 @@ def animate(self) -> None:
462462 self .show_results ()
463463
464464 def show_results (self ) -> None :
465- """
465+ """
466466 Displays scheduling results.
467467
468468 >>> import tkinter as tk
@@ -474,7 +474,7 @@ def show_results(self) -> None:
474474 >>> "AVG" in gui.avg_label.cget("text")
475475 True
476476 >>> root.destroy()
477- """
477+ """
478478 for item in self .result_box .get_children ():
479479 self .result_box .delete (item )
480480 total_wt = total_tat = total_rt = 0
0 commit comments