Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 20e98fc

Browse filesBrowse files
Hasenncclauss
andauthored
Fix some warnings from LGTM (TheAlgorithms#2420)
* fix assignment of a variable to itself * Fix unnecessary 'else' clause in loop * formatting and redundant reasignment fix * mark unreachable code with a TODO comment * fix variable defined multiple times * fix static method without static decorator * revert unintended autoformatting Co-authored-by: Christian Clauss <cclauss@me.com> * revert autoformatting issue * applied black autoformatting Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent f754c0d commit 20e98fc
Copy full SHA for 20e98fc

6 files changed

+9-6Lines changed: 9 additions & 6 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ciphers/enigma_machine2.py‎

Copy file name to clipboardExpand all lines: ciphers/enigma_machine2.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ def enigma(
218218
rotorpos1 -= 1
219219
rotorpos2 -= 1
220220
rotorpos3 -= 1
221-
plugboard = plugboard
222221

223222
result = []
224223

Collapse file

‎graphs/directed_and_undirected_(weighted)_graph.py‎

Copy file name to clipboardExpand all lines: graphs/directed_and_undirected_(weighted)_graph.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def has_cycle(self):
226226
break
227227
else:
228228
return True
229+
# TODO:The following code is unreachable.
229230
anticipating_nodes.add(stack[len_stack_minus_one])
230231
len_stack_minus_one -= 1
231232
if visited.count(node[1]) < 1:
@@ -453,6 +454,8 @@ def has_cycle(self):
453454
break
454455
else:
455456
return True
457+
# TODO: the following code is unreachable
458+
# is this meant to be called in the else ?
456459
anticipating_nodes.add(stack[len_stack_minus_one])
457460
len_stack_minus_one -= 1
458461
if visited.count(node[1]) < 1:
Collapse file

‎graphs/minimum_spanning_tree_boruvka.py‎

Copy file name to clipboardExpand all lines: graphs/minimum_spanning_tree_boruvka.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def union(self, item1, item2):
146146
self.parent[root2] = root1
147147
return root1
148148

149+
@staticmethod
149150
def boruvka_mst(graph):
150151
"""
151152
Implementation of Boruvka's algorithm
Collapse file

‎maths/chudnovsky_algorithm.py‎

Copy file name to clipboardExpand all lines: maths/chudnovsky_algorithm.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def pi(precision: int) -> str:
4444
getcontext().prec = precision
4545
num_iterations = ceil(precision / 14)
4646
constant_term = 426880 * Decimal(10005).sqrt()
47-
multinomial_term = 1
4847
exponential_term = 1
4948
linear_term = 13591409
5049
partial_sum = Decimal(linear_term)
Collapse file

‎other/triplet_sum.py‎

Copy file name to clipboardExpand all lines: other/triplet_sum.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def triplet_sum2(arr: List[int], target: int) -> Tuple[int, int, int]:
6161
left += 1
6262
elif arr[i] + arr[left] + arr[right] > target:
6363
right -= 1
64-
else:
65-
return (0, 0, 0)
64+
return (0, 0, 0)
6665

6766

6867
def solution_times() -> Tuple[float, float]:
Collapse file

‎scheduling/shortest_job_first.py‎

Copy file name to clipboardExpand all lines: scheduling/shortest_job_first.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
def calculate_waitingtime(
1212
arrival_time: List[int], burst_time: List[int], no_of_processes: int
1313
) -> List[int]:
14-
1514
"""
1615
Calculate the waiting time of each processes
1716
Return: list of waiting times.
@@ -126,13 +125,16 @@ def calculate_average_times(
126125
for i in range(no_of_processes):
127126
print("Enter the arrival time and brust time for process:--" + str(i + 1))
128127
arrival_time[i], burst_time[i] = map(int, input().split())
128+
129129
waiting_time = calculate_waitingtime(arrival_time, burst_time, no_of_processes)
130+
130131
bt = burst_time
131132
n = no_of_processes
132133
wt = waiting_time
133134
turn_around_time = calculate_turnaroundtime(bt, n, wt)
135+
134136
calculate_average_times(waiting_time, turn_around_time, no_of_processes)
135-
processes = list(range(1, no_of_processes + 1))
137+
136138
fcfs = pd.DataFrame(
137139
list(zip(processes, burst_time, arrival_time, waiting_time, turn_around_time)),
138140
columns=[

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.