From dcb9bc254431a5312f761f006c1c2d6cc76aa0f0 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 4 Jun 2018 17:58:06 +0300 Subject: [PATCH] python: eliminate pylint warnings Tested with: - pylint 1.9.1 --- modules/python/test/test_misc.py | 6 +++--- samples/dnn/object_detection.py | 2 +- samples/python/calibrate.py | 2 +- samples/python/camera_calibration_show_extrinsics.py | 2 +- .../histogram_equalization/EqualizeHist_Demo.py | 2 +- samples/python/tutorial_code/imgProc/Smoothing/smoothing.py | 2 +- samples/python/tutorial_code/imgProc/threshold/threshold.py | 2 +- .../imgProc/threshold_inRange/threshold_inRange.py | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/python/test/test_misc.py b/modules/python/test/test_misc.py index abb66c13de..5f07d733f2 100644 --- a/modules/python/test/test_misc.py +++ b/modules/python/test/test_misc.py @@ -23,7 +23,7 @@ class Bindings(NewOpenCVTests): try: cv.imshow("", None) # This causes an assert self.assertEqual("Dead code", 0) - except cv.error as e: + except cv.error as _e: pass handler_called = [False] @@ -34,7 +34,7 @@ class Bindings(NewOpenCVTests): try: cv.imshow("", None) # This causes an assert self.assertEqual("Dead code", 0) - except cv.error as e: + except cv.error as _e: self.assertEqual(handler_called[0], True) pass @@ -42,7 +42,7 @@ class Bindings(NewOpenCVTests): try: cv.imshow("", None) # This causes an assert self.assertEqual("Dead code", 0) - except cv.error as e: + except cv.error as _e: pass diff --git a/samples/dnn/object_detection.py b/samples/dnn/object_detection.py index a299b558e7..2cfb6d2106 100644 --- a/samples/dnn/object_detection.py +++ b/samples/dnn/object_detection.py @@ -174,7 +174,7 @@ while cv.waitKey(1) < 0: net.setInput(blob) if net.getLayer(0).outputNameToIndex('im_info') != -1: # Faster-RCNN or R-FCN frame = cv.resize(frame, (inpWidth, inpHeight)) - net.setInput(np.array([inpHeight, inpWidth, 1.6], dtype=np.float32), 'im_info'); + net.setInput(np.array([inpHeight, inpWidth, 1.6], dtype=np.float32), 'im_info') outs = net.forward(getOutputsNames(net)) postprocess(frame, outs) diff --git a/samples/python/calibrate.py b/samples/python/calibrate.py index 14019127bc..a2970a95e7 100755 --- a/samples/python/calibrate.py +++ b/samples/python/calibrate.py @@ -71,7 +71,7 @@ if __name__ == '__main__': if debug_dir: vis = cv.cvtColor(img, cv.COLOR_GRAY2BGR) cv.drawChessboardCorners(vis, pattern_size, corners, found) - path, name, ext = splitfn(fn) + _path, name, _ext = splitfn(fn) outfile = os.path.join(debug_dir, name + '_chess.png') cv.imwrite(outfile, vis) diff --git a/samples/python/camera_calibration_show_extrinsics.py b/samples/python/camera_calibration_show_extrinsics.py index 7b1b0cf980..75274aea9e 100755 --- a/samples/python/camera_calibration_show_extrinsics.py +++ b/samples/python/camera_calibration_show_extrinsics.py @@ -91,7 +91,7 @@ def create_board_model(extrinsics, board_width, board_height, square_size, draw_ # draw calibration board X_board = np.ones((4,5)) - X_board_cam = np.ones((extrinsics.shape[0],4,5)) + #X_board_cam = np.ones((extrinsics.shape[0],4,5)) X_board[0:3,0] = [0,0,0] X_board[0:3,1] = [width,0,0] X_board[0:3,2] = [width,height,0] diff --git a/samples/python/tutorial_code/Histograms_Matching/histogram_equalization/EqualizeHist_Demo.py b/samples/python/tutorial_code/Histograms_Matching/histogram_equalization/EqualizeHist_Demo.py index 47caec4d0a..fb87cce75a 100644 --- a/samples/python/tutorial_code/Histograms_Matching/histogram_equalization/EqualizeHist_Demo.py +++ b/samples/python/tutorial_code/Histograms_Matching/histogram_equalization/EqualizeHist_Demo.py @@ -18,7 +18,7 @@ src = cv.cvtColor(src, cv.COLOR_BGR2GRAY) ## [Convert to grayscale] ## [Apply Histogram Equalization] -dst = cv.equalizeHist(src); +dst = cv.equalizeHist(src) ## [Apply Histogram Equalization] ## [Display results] diff --git a/samples/python/tutorial_code/imgProc/Smoothing/smoothing.py b/samples/python/tutorial_code/imgProc/Smoothing/smoothing.py index 205ee6d488..e7096580ad 100644 --- a/samples/python/tutorial_code/imgProc/Smoothing/smoothing.py +++ b/samples/python/tutorial_code/imgProc/Smoothing/smoothing.py @@ -88,7 +88,7 @@ def main(argv): def display_caption(caption): global dst dst = np.zeros(src.shape, src.dtype) - rows, cols, ch = src.shape + rows, cols, _ch = src.shape cv.putText(dst, caption, (int(cols / 4), int(rows / 2)), cv.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255)) diff --git a/samples/python/tutorial_code/imgProc/threshold/threshold.py b/samples/python/tutorial_code/imgProc/threshold/threshold.py index 0d640750aa..1ba38126c9 100644 --- a/samples/python/tutorial_code/imgProc/threshold/threshold.py +++ b/samples/python/tutorial_code/imgProc/threshold/threshold.py @@ -33,7 +33,7 @@ if src is None: print('Could not open or find the image: ', args.input) exit(0) # Convert the image to Gray -src_gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY); +src_gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY) ## [load] ## [window] diff --git a/samples/python/tutorial_code/imgProc/threshold_inRange/threshold_inRange.py b/samples/python/tutorial_code/imgProc/threshold_inRange/threshold_inRange.py index 77d95fe395..d54d93c7fc 100644 --- a/samples/python/tutorial_code/imgProc/threshold_inRange/threshold_inRange.py +++ b/samples/python/tutorial_code/imgProc/threshold_inRange/threshold_inRange.py @@ -94,7 +94,7 @@ while True: break frame_HSV = cv.cvtColor(frame, cv.COLOR_BGR2HSV) - frame_threshold = cv.inRange(frame_HSV, (low_H, low_S, low_V), (high_H, high_S, high_V)); + frame_threshold = cv.inRange(frame_HSV, (low_H, low_S, low_V), (high_H, high_S, high_V)) ## [while] ## [show]