Skip to content

Fix some warnings from LGTM #2420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ciphers/enigma_machine2.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ def enigma(
rotorpos1 -= 1
rotorpos2 -= 1
rotorpos3 -= 1
plugboard = plugboard

result = []

Expand Down
3 changes: 3 additions & 0 deletions graphs/directed_and_undirected_(weighted)_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def has_cycle(self):
break
else:
return True
# TODO:The following code is unreachable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If code is unreachable then determine if the lines are useful. If they are then move the return statement below them. If they are not useful then delete them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried.. i can't read that part i don't really understand what it's supposed to do

anticipating_nodes.add(stack[len_stack_minus_one])
len_stack_minus_one -= 1
if visited.count(node[1]) < 1:
Expand Down Expand Up @@ -453,6 +454,8 @@ def has_cycle(self):
break
else:
return True
# TODO: the following code is unreachable
# is this meant to be called in the else ?
anticipating_nodes.add(stack[len_stack_minus_one])
len_stack_minus_one -= 1
if visited.count(node[1]) < 1:
Expand Down
1 change: 1 addition & 0 deletions graphs/minimum_spanning_tree_boruvka.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def union(self, item1, item2):
self.parent[root2] = root1
return root1

@staticmethod
def boruvka_mst(graph):
"""
Implementation of Boruvka's algorithm
Expand Down
1 change: 0 additions & 1 deletion maths/chudnovsky_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def pi(precision: int) -> str:
getcontext().prec = precision
num_iterations = ceil(precision / 14)
constant_term = 426880 * Decimal(10005).sqrt()
multinomial_term = 1
exponential_term = 1
linear_term = 13591409
partial_sum = Decimal(linear_term)
Expand Down
3 changes: 1 addition & 2 deletions other/triplet_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def triplet_sum2(arr: List[int], target: int) -> Tuple[int, int, int]:
left += 1
elif arr[i] + arr[left] + arr[right] > target:
right -= 1
else:
return (0, 0, 0)
return (0, 0, 0)


def solution_times() -> Tuple[float, float]:
Expand Down
6 changes: 4 additions & 2 deletions scheduling/shortest_job_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
def calculate_waitingtime(
arrival_time: List[int], burst_time: List[int], no_of_processes: int
) -> List[int]:

"""
Calculate the waiting time of each processes
Return: list of waiting times.
Expand Down Expand Up @@ -126,13 +125,16 @@ def calculate_average_times(
for i in range(no_of_processes):
print("Enter the arrival time and brust time for process:--" + str(i + 1))
arrival_time[i], burst_time[i] = map(int, input().split())

waiting_time = calculate_waitingtime(arrival_time, burst_time, no_of_processes)

bt = burst_time
n = no_of_processes
wt = waiting_time
turn_around_time = calculate_turnaroundtime(bt, n, wt)

calculate_average_times(waiting_time, turn_around_time, no_of_processes)
processes = list(range(1, no_of_processes + 1))

fcfs = pd.DataFrame(
list(zip(processes, burst_time, arrival_time, waiting_time, turn_around_time)),
columns=[
Expand Down