From 04962c0d17b82f349e0453b06b76d9f594e2b024 Mon Sep 17 00:00:00 2001 From: Denis Trofimov Date: Sat, 21 Sep 2019 17:23:34 +0300 Subject: [PATCH] Fix lgtm error display #1024 (#1190) * fix: Syntax Error lgtm display in matrix/matrix_operation.py. * Testing for None should use the 'is' operator. * fix: Too many arguments for string format. * fix: supress lgtm alert as false positive. * style: Unnecessary 'pass' statement. * Revert "fix: Syntax Error lgtm display in matrix/matrix_operation.py." This reverts commit 4c629b4ce16a32b99a8127f5553cdb9015bf5e80. --- data_structures/heap/binomial_heap.py | 2 +- divide_and_conquer/convex_hull.py | 2 +- neural_network/convolution_neural_network.py | 3 +-- strings/boyer_moore_search.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/data_structures/heap/binomial_heap.py b/data_structures/heap/binomial_heap.py index bc9cb5145..0154390d7 100644 --- a/data_structures/heap/binomial_heap.py +++ b/data_structures/heap/binomial_heap.py @@ -307,7 +307,7 @@ class BinomialHeap: # No right subtree corner case # The structure of the tree implies that this should be the bottom root # and there is at least one other root - if self.min_node.right == None: + if self.min_node.right is None: # Update size self.size -= 1 diff --git a/divide_and_conquer/convex_hull.py b/divide_and_conquer/convex_hull.py index a0c319e76..534ebda2c 100644 --- a/divide_and_conquer/convex_hull.py +++ b/divide_and_conquer/convex_hull.py @@ -191,7 +191,7 @@ def _validate_input(points): else: raise ValueError("Expecting an iterable of type Point, list or tuple. " "Found objects of type {} instead" - .format(["point", "list", "tuple"], type(points[0]))) + .format(type(points[0]))) elif not hasattr(points, "__iter__"): raise ValueError("Expecting an iterable object " "but got an non-iterable type {}".format(points)) diff --git a/neural_network/convolution_neural_network.py b/neural_network/convolution_neural_network.py index e4dd0a11d..786992c05 100644 --- a/neural_network/convolution_neural_network.py +++ b/neural_network/convolution_neural_network.py @@ -297,7 +297,6 @@ class CNN(): if __name__ == '__main__': - pass ''' I will put the example on other file -''' + ''' diff --git a/strings/boyer_moore_search.py b/strings/boyer_moore_search.py index 781ff0ca6..2d67043dc 100644 --- a/strings/boyer_moore_search.py +++ b/strings/boyer_moore_search.py @@ -70,7 +70,7 @@ class BoyerMooreSearch: positions.append(i) else: match_index = self.match_in_pattern(self.text[mismatch_index]) - i = mismatch_index - match_index #shifting index + i = mismatch_index - match_index #shifting index lgtm [py/multiple-definition] return positions