The following issues were found

modules/gapi/misc/python/test/test_gapi_streaming.py
56 issues
Unable to import 'cv2'
Error

Line: 4 Column: 1

              #!/usr/bin/env python

import numpy as np
import cv2 as cv
import os
import sys
import unittest
import time


            

Reported by Pylint.

Unable to import 'tests_common'
Error

Line: 10 Column: 1

              import unittest
import time

from tests_common import NewOpenCVTests


try:
    if sys.version_info[:2] < (3, 0):
        raise unittest.SkipTest('Python 2.x is not supported')

            

Reported by Pylint.

Class 'GDelay' has no 'on' member
Error

Line: 271 Column: 22

                          g_in = cv.GMat()
            g_out1 = cv.gapi.copy(g_in)
            des = cv.gapi.streaming.desync(g_in)
            g_out2 = GDelay.on(des)

            c = cv.GComputation(cv.GIn(g_in), cv.GOut(g_out1, g_out2))

            kernels = cv.gapi.kernels(GDelayImpl)
            ccomp = c.compileStreaming(args=cv.gapi.compile_args(kernels))

            

Reported by Pylint.

Method has no argument
Error

Line: 318 Column: 9

                      def setUp(self):
            self.skipTest('Skip tests: ' + message)

        def test_skip():
            pass

    pass



            

Reported by Pylint.

Redefining name 'e' from outer scope (line 310)
Error

Line: 125 Column: 21

                                  break

                expected = cv.split(frame)
                for e, a in zip(expected, actual):
                    self.assertEqual(0.0, cv.norm(e, a, cv.NORM_INF))

                proc_num_frames += 1
                if proc_num_frames == max_num_frames:
                    break

            

Reported by Pylint.

Redefining name 'e' from outer scope (line 310)
Error

Line: 218 Column: 21

                              expected = cv.goodFeaturesToTrack(frame, max_corners, quality_lvl,
                                                  min_distance, mask=mask,
                                                  blockSize=block_sz, useHarrisDetector=use_harris_detector, k=k)
                for e, a in zip(expected, actual):
                    # NB: OpenCV & G-API have different output shapes:
                    # OpenCV - (num_points, 1, 2)
                    # G-API  - (num_points, 2)
                    self.assertEqual(0.0, cv.norm(e.flatten(),
                                                  np.array(a, np.float32).flatten(),

            

Reported by Pylint.

Unused variable 'ksize'
Error

Line: 232 Column: 13

              

        def test_gapi_streaming_meta(self):
            ksize = 3
            path = self.find_file('cv/video/768x576.avi', [os.environ['OPENCV_TEST_DATA_PATH']])

            # G-API
            g_in = cv.GMat()
            g_ts = cv.gapi.streaming.timestamp(g_in)

            

Reported by Pylint.

Unused variable 'ts'
Error

Line: 252 Column: 29

                          max_num_frames  = 10
            curr_frame_number = 0
            while True:
                has_frame, (ts, seqno, seqid) = ccomp.pull()

                if not has_frame:
                    break

                self.assertEqual(curr_frame_number, seqno)

            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 321 Column: 5

                      def test_skip():
            pass

    pass


if __name__ == '__main__':
    NewOpenCVTests.bootstrap()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

import numpy as np
import cv2 as cv
import os
import sys
import unittest
import time


            

Reported by Pylint.

platforms/osx/build_framework.py
56 issues
Unable to import 'cv_build_utils'
Error

Line: 13 Column: 1

              sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_framework import Builder
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../apple'))
from cv_build_utils import print_error, get_cmake_version

MACOSX_DEPLOYMENT_TARGET='10.12'  # default, can be changed via command line options or environment variable

class OSXBuilder(Builder):


            

Reported by Pylint.

Unused import traceback
Error

Line: 7 Column: 1

              """

from __future__ import print_function
import os, os.path, sys, argparse, traceback, multiprocessing

# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_framework import Builder
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../apple'))

            

Reported by Pylint.

Module import itself
Error

Line: 11 Column: 1

              
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_framework import Builder
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../apple'))
from cv_build_utils import print_error, get_cmake_version

MACOSX_DEPLOYMENT_TARGET='10.12'  # default, can be changed via command line options or environment variable


            

Reported by Pylint.

Unused argument 'target'
Error

Line: 29 Column: 34

                      else:
            return 'osx'

    def getToolchain(self, arch, target):
        return None

    def getBuildCommand(self, arch, target):
        buildcmd = [
            "xcodebuild",

            

Reported by Pylint.

Unused argument 'arch'
Error

Line: 29 Column: 28

                      else:
            return 'osx'

    def getToolchain(self, arch, target):
        return None

    def getBuildCommand(self, arch, target):
        buildcmd = [
            "xcodebuild",

            

Reported by Pylint.

TODO: When we can make breaking changes, we should make the out argument explicit and required like in build_xcframework.py.
Error

Line: 61 Column: 3

              if __name__ == "__main__":
    folder = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../.."))
    parser = argparse.ArgumentParser(description='The script builds OpenCV.framework for OSX.')
    # TODO: When we can make breaking changes, we should make the out argument explicit and required like in build_xcframework.py.
    parser.add_argument('out', metavar='OUTDIR', help='folder to put built framework')
    parser.add_argument('--opencv', metavar='DIR', default=folder, help='folder with opencv repository (default is "../.." relative to script location)')
    parser.add_argument('--contrib', metavar='DIR', default=None, help='folder with opencv_contrib repository (default is "None" - build only main framework)')
    parser.add_argument('--without', metavar='MODULE', default=[], action='append', help='OpenCV modules to exclude from the framework. To exclude multiple, specify this flag again, e.g. "--without video --without objc"')
    parser.add_argument('--disable', metavar='FEATURE', default=[], action='append', help='OpenCV features to disable (add WITH_*=OFF). To disable multiple, specify this flag again, e.g. "--disable tbb --disable openmp"')

            

Reported by Pylint.

TODO: To avoid breaking existing CI, catalyst_archs has no defaults. When we can make a breaking change, this should specify a default arch.
Error

Line: 105 Column: 3

                  catalyst_archs = None
    if args.catalyst_archs:
        catalyst_archs = args.catalyst_archs.split(',')
    # TODO: To avoid breaking existing CI, catalyst_archs has no defaults. When we can make a breaking change, this should specify a default arch.
    print('Using Catalyst ARCHS=' + str(catalyst_archs))

    # Prevent the build from happening if the same architecture is specified for multiple platforms.
    # When `lipo` is run to stitch the frameworks together into a fat framework, it'll fail, so it's
    # better to stop here while we're ahead.

            

Reported by Pylint.

Expression "(targets.append((catalyst_archs, 'Catalyst')), )" is assigned to nothing
Error

Line: 129 Column: 9

                  if macos_archs:
        targets.append((macos_archs, "MacOSX"))
    if catalyst_archs:
        targets.append((catalyst_archs, "Catalyst")),

    b = OSXBuilder(args.opencv, args.contrib, args.dynamic, True, args.without, args.disable, args.enablenonfree, targets, args.debug, args.debug_info, args.framework_name, args.run_tests, args.build_docs, args.swiftdisabled)
    b.build(args.out)

            

Reported by Pylint.

Multiple imports on one line (os, os.path, sys, argparse, traceback, multiprocessing)
Error

Line: 7 Column: 1

              """

from __future__ import print_function
import os, os.path, sys, argparse, traceback, multiprocessing

# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_framework import Builder
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../apple'))

            

Reported by Pylint.

Import "from build_framework import Builder" should be placed at the top of the module
Error

Line: 11 Column: 1

              
# import common code
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../ios'))
from build_framework import Builder
sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../apple'))
from cv_build_utils import print_error, get_cmake_version

MACOSX_DEPLOYMENT_TARGET='10.12'  # default, can be changed via command line options or environment variable


            

Reported by Pylint.

samples/python/digits.py
56 issues
Unable to import 'cv2'
Error

Line: 31 Column: 1

              from __future__ import print_function

import numpy as np
import cv2 as cv

# built-in modules
from multiprocessing.pool import ThreadPool

from numpy.linalg import norm

            

Reported by Pylint.

Too many positional arguments for method call
Error

Line: 53 Column: 17

                  cells = [np.hsplit(row, w//sx) for row in np.vsplit(img, h//sy)]
    cells = np.array(cells)
    if flatten:
        cells = cells.reshape(-1, sy, sx)
    return cells

def load_digits(fn):
    fn = cv.samples.findFile(fn)
    print('loading "%s" ...' % fn)

            

Reported by Pylint.

Too many positional arguments for method call
Error

Line: 133 Column: 12

                  return mosaic(25, vis)

def preprocess_simple(digits):
    return np.float32(digits).reshape(-1, SZ*SZ) / 255.0

def preprocess_hog(digits):
    samples = []
    for img in digits:
        gx = cv.Sobel(img, cv.CV_32F, 1, 0)

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 165 Column: 12

              
    print('preprocessing...')
    # shuffle digits
    rand = np.random.RandomState(321)
    shuffle = rand.permutation(len(digits))
    digits, labels = digits[shuffle], labels[shuffle]

    digits2 = list(map(deskew, digits))
    samples = preprocess_hog(digits2)

            

Reported by Pylint.

Unused ThreadPool imported from multiprocessing.pool
Error

Line: 34 Column: 1

              import cv2 as cv

# built-in modules
from multiprocessing.pool import ThreadPool

from numpy.linalg import norm

# local modules
from common import clock, mosaic

            

Reported by Pylint.

Unused clock imported from common
Error

Line: 39 Column: 1

              from numpy.linalg import norm

# local modules
from common import clock, mosaic



SZ = 20 # size of each digit is SZ x SZ
CLASS_N = 10

            

Reported by Pylint.

Redefining name 'digits' from outer scope (line 161)
Error

Line: 60 Column: 5

                  fn = cv.samples.findFile(fn)
    print('loading "%s" ...' % fn)
    digits_img = cv.imread(fn, cv.IMREAD_GRAYSCALE)
    digits = split2d(digits_img, (SZ, SZ))
    labels = np.repeat(np.arange(CLASS_N), len(digits)/CLASS_N)
    return digits, labels

def deskew(img):
    m = cv.moments(img)

            

Reported by Pylint.

Redefining name 'labels' from outer scope (line 161)
Error

Line: 61 Column: 5

                  print('loading "%s" ...' % fn)
    digits_img = cv.imread(fn, cv.IMREAD_GRAYSCALE)
    digits = split2d(digits_img, (SZ, SZ))
    labels = np.repeat(np.arange(CLASS_N), len(digits)/CLASS_N)
    return digits, labels

def deskew(img):
    m = cv.moments(img)
    if abs(m['mu02']) < 1e-2:

            

Reported by Pylint.

Redefining name 'samples' from outer scope (line 170)
Error

Line: 79 Column: 21

                      self.k = k
        self.model = cv.ml.KNearest_create()

    def train(self, samples, responses):
        self.model.train(samples, cv.ml.ROW_SAMPLE, responses)

    def predict(self, samples):
        _retval, results, _neigh_resp, _dists = self.model.findNearest(samples, self.k)
        return results.ravel()

            

Reported by Pylint.

Redefining name 'samples' from outer scope (line 170)
Error

Line: 82 Column: 23

                  def train(self, samples, responses):
        self.model.train(samples, cv.ml.ROW_SAMPLE, responses)

    def predict(self, samples):
        _retval, results, _neigh_resp, _dists = self.model.findNearest(samples, self.k)
        return results.ravel()

    def load(self, fn):
        self.model = cv.ml.KNearest_load(fn)

            

Reported by Pylint.

samples/java/tutorial_code/ImgTrans/distance_transformation/ImageSegmentationDemo.java
55 issues
System.err.println is used
Design

Line: 28

                      String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {
            System.err.println("Cannot read image: " + filename);
            System.exit(0);
        }

        // Show source image
        HighGui.imshow("Source Image", srcOriginal);

            

Reported by PMD.

The class 'ImageSegmentation' has a Standard Cyclomatic Complexity of 12 (Highest = 11).
Design

Line: 21

               * and Distance Transformation
 *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);

            

Reported by PMD.

The class 'ImageSegmentation' has a Modified Cyclomatic Complexity of 12 (Highest = 11).
Design

Line: 21

               * and Distance Transformation
 *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);

            

Reported by PMD.

The method 'run' has a Standard Cyclomatic Complexity of 11.
Design

Line: 22

               *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {

            

Reported by PMD.

Avoid really long methods.
Design

Line: 22

               *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {

            

Reported by PMD.

The method 'run' has a Modified Cyclomatic Complexity of 11.
Design

Line: 22

               *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {

            

Reported by PMD.

The method 'run(String)' has an NPath complexity of 480, current threshold is 200
Design

Line: 22

               *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {

            

Reported by PMD.

The method run() has an NCSS line count of 105
Design

Line: 22

               *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {

            

Reported by PMD.

The method 'run(String)' has a NCSS line count of 105.
Design

Line: 22

               *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {

            

Reported by PMD.

The method 'run(String)' has a cyclomatic complexity of 14.
Design

Line: 22

               *
 */
class ImageSegmentation {
    public void run(String[] args) {
        //! [load_image]
        // Load the image
        String filename = args.length > 0 ? args[0] : "../data/cards.png";
        Mat srcOriginal = Imgcodecs.imread(filename);
        if (srcOriginal.empty()) {

            

Reported by PMD.

samples/python/tst_scene_render.py
55 issues
Unable to import 'cv2'
Error

Line: 8 Column: 1

              from __future__ import print_function

import numpy as np
import cv2 as cv

from numpy import pi, sin, cos


defaultSize = 512

            

Reported by Pylint.

Unused pi imported from numpy
Error

Line: 10 Column: 1

              import numpy as np
import cv2 as cv

from numpy import pi, sin, cos


defaultSize = 512

class TestSceneRender():

            

Reported by Pylint.

Unused argument 'params'
Error

Line: 17 Column: 1

              
class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None,
        deformation = False, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0
        self.foreground = fgImg
        self.deformation = deformation

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python


# Python 2/3 compatibility
from __future__ import print_function

import numpy as np
import cv2 as cv


            

Reported by Pylint.

Constant name "defaultSize" doesn't conform to UPPER_CASE naming style
Error

Line: 13 Column: 1

              from numpy import pi, sin, cos


defaultSize = 512

class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None,
        deformation = False, speed = 0.25, **params):

            

Reported by Pylint.

Too many instance attributes (14/7)
Error

Line: 15 Column: 1

              
defaultSize = 512

class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None,
        deformation = False, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0

            

Reported by Pylint.

Missing class docstring
Error

Line: 15 Column: 1

              
defaultSize = 512

class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None,
        deformation = False, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0

            

Reported by Pylint.

Attribute name "timeStep" doesn't conform to snake_case naming style
Error

Line: 20 Column: 9

                  def __init__(self, bgImg = None, fgImg = None,
        deformation = False, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0
        self.foreground = fgImg
        self.deformation = deformation
        self.speed = speed

        if bgImg is not None:

            

Reported by Pylint.

Attribute name "sceneBg" doesn't conform to snake_case naming style
Error

Line: 26 Column: 13

                      self.speed = speed

        if bgImg is not None:
            self.sceneBg = bgImg.copy()
        else:
            self.sceneBg = np.zeros(defaultSize, defaultSize, np.uint8)

        self.w = self.sceneBg.shape[0]
        self.h = self.sceneBg.shape[1]

            

Reported by Pylint.

Attribute name "w" doesn't conform to snake_case naming style
Error

Line: 30 Column: 9

                      else:
            self.sceneBg = np.zeros(defaultSize, defaultSize, np.uint8)

        self.w = self.sceneBg.shape[0]
        self.h = self.sceneBg.shape[1]

        if fgImg is not None:
            self.foreground = fgImg.copy()
            self.center = self.currentCenter = (int(self.w/2 - fgImg.shape[0]/2), int(self.h/2 - fgImg.shape[1]/2))

            

Reported by Pylint.

samples/dnn/tf_text_graph_faster_rcnn.py
55 issues
Unused import listToTensor from wildcard import
Error

Line: 3 Column: 1

              import argparse
import numpy as np
from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',

            

Reported by Pylint.

Unused import parseMessage from wildcard import
Error

Line: 3 Column: 1

              import argparse
import numpy as np
from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',

            

Reported by Pylint.

Unused import GraphDef from wildcard import
Error

Line: 3 Column: 1

              import argparse
import numpy as np
from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',

            

Reported by Pylint.

Wildcard import tf_text_graph_common
Error

Line: 3 Column: 1

              import argparse
import numpy as np
from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',

            

Reported by Pylint.

Unused import tokenize from wildcard import
Error

Line: 3 Column: 1

              import argparse
import numpy as np
from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import argparse
import numpy as np
from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',

            

Reported by Pylint.

Argument name "configPath" doesn't conform to snake_case naming style
Error

Line: 6 Column: 1

              from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',
                    'CropAndResize',
                    'MaxPool2D',

            

Reported by Pylint.

Too many branches (22/12)
Error

Line: 6 Column: 1

              from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',
                    'CropAndResize',
                    'MaxPool2D',

            

Reported by Pylint.

Function name "createFasterRCNNGraph" doesn't conform to snake_case naming style
Error

Line: 6 Column: 1

              from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',
                    'CropAndResize',
                    'MaxPool2D',

            

Reported by Pylint.

Argument name "modelPath" doesn't conform to snake_case naming style
Error

Line: 6 Column: 1

              from tf_text_graph_common import *


def createFasterRCNNGraph(modelPath, configPath, outputPath):
    scopesToKeep = ('FirstStageFeatureExtractor', 'Conv',
                    'FirstStageBoxPredictor/BoxEncodingPredictor',
                    'FirstStageBoxPredictor/ClassPredictor',
                    'CropAndResize',
                    'MaxPool2D',

            

Reported by Pylint.

modules/python/test/tst_scene_render.py
54 issues
Unable to import 'cv2'
Error

Line: 10 Column: 1

              import numpy as np
from numpy import pi, sin, cos

import cv2 as cv

defaultSize = 512

class TestSceneRender():


            

Reported by Pylint.

Unused pi imported from numpy
Error

Line: 8 Column: 1

              from __future__ import print_function

import numpy as np
from numpy import pi, sin, cos

import cv2 as cv

defaultSize = 512


            

Reported by Pylint.

Unused argument 'params'
Error

Line: 16 Column: 1

              
class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None, deformation = False, noise = 0.0, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0
        self.foreground = fgImg
        self.deformation = deformation
        self.noise = noise

            

Reported by Pylint.

Redefining name 'img' from outer scope (line 113)
Error

Line: 81 Column: 9

                          return np.array([x0, y0, x1, y1])

    def getNextFrame(self):
        img = self.sceneBg.copy()

        if self.foreground is not None:
            self.currentCenter = (self.center[0] + self.getXOffset(self.time), self.center[1] + self.getYOffset(self.time))
            img[self.currentCenter[0]:self.currentCenter[0]+self.foreground.shape[0],
             self.currentCenter[1]:self.currentCenter[1]+self.foreground.shape[1]] = self.foreground

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python


# Python 2/3 compatibility
from __future__ import print_function

import numpy as np
from numpy import pi, sin, cos


            

Reported by Pylint.

Constant name "defaultSize" doesn't conform to UPPER_CASE naming style
Error

Line: 12 Column: 1

              
import cv2 as cv

defaultSize = 512

class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None, deformation = False, noise = 0.0, speed = 0.25, **params):
        self.time = 0.0

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

              
defaultSize = 512

class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None, deformation = False, noise = 0.0, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0
        self.foreground = fgImg

            

Reported by Pylint.

Too many instance attributes (15/7)
Error

Line: 14 Column: 1

              
defaultSize = 512

class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None, deformation = False, noise = 0.0, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0
        self.foreground = fgImg

            

Reported by Pylint.

Line too long (109/100)
Error

Line: 16 Column: 1

              
class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None, deformation = False, noise = 0.0, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0
        self.foreground = fgImg
        self.deformation = deformation
        self.noise = noise

            

Reported by Pylint.

Too many arguments (6/5)
Error

Line: 16 Column: 5

              
class TestSceneRender():

    def __init__(self, bgImg = None, fgImg = None, deformation = False, noise = 0.0, speed = 0.25, **params):
        self.time = 0.0
        self.timeStep = 1.0 / 30.0
        self.foreground = fgImg
        self.deformation = deformation
        self.noise = noise

            

Reported by Pylint.

samples/dnn/tf_text_graph_efficientdet.py
52 issues
Unused sqrt imported from math
Error

Line: 14 Column: 1

              # See details and examples on the following wiki page: https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API
import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):

            

Reported by Pylint.

Unused import readTextMessage from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Unused import listToTensor from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Unused import GraphDef from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Unused import addSoftMax from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Unused import addReshape from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Unused import addSlice from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Wildcard import tf_text_graph_common
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Unused import parseMessage from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

Unused import tokenize from wildcard import
Error

Line: 15 Column: 1

              import argparse
import re
from math import sqrt
from tf_text_graph_common import *


class AnchorGenerator:
    def __init__(self, min_level, aspect_ratios, num_scales, anchor_scale):
        self.min_level = min_level

            

Reported by Pylint.

samples/python/find_obj.py
51 issues
Unable to import 'cv2'
Error

Line: 21 Column: 1

              from __future__ import print_function

import numpy as np
import cv2 as cv

from common import anorm, getsize

FLANN_INDEX_KDTREE = 1  # bug: flann enums are missing
FLANN_INDEX_LSH    = 6

            

Reported by Pylint.

Too many positional arguments for method call
Error

Line: 84 Column: 53

              
    if H is not None:
        corners = np.float32([[0, 0], [w1, 0], [w1, h1], [0, h1]])
        corners = np.int32( cv.perspectiveTransform(corners.reshape(1, -1, 2), H).reshape(-1, 2) + (w1, 0) )
        cv.polylines(vis, [corners], True, (255, 255, 255))

    if status is None:
        status = np.ones(len(kp_pairs), np.bool_)
    p1, p2 = [], []  # python 2 / python 3 change of zip unpacking

            

Reported by Pylint.

Argument '.ndarray' does not match format type 'd'
Error

Line: 180 Column: 19

                      p1, p2, kp_pairs = filter_matches(kp1, kp2, raw_matches)
        if len(p1) >= 4:
            H, status = cv.findHomography(p1, p2, cv.RANSAC, 5.0)
            print('%d / %d  inliers/matched' % (np.sum(status), len(status)))
        else:
            H, status = None, None
            print('%d matches found, not enough for homography estimation' % len(p1))

        _vis = explore_match(win, img1, img2, kp_pairs, status, H)

            

Reported by Pylint.

Unused getsize imported from common
Error

Line: 23 Column: 1

              import numpy as np
import cv2 as cv

from common import anorm, getsize

FLANN_INDEX_KDTREE = 1  # bug: flann enums are missing
FLANN_INDEX_LSH    = 6



            

Reported by Pylint.

Unused argument 'param'
Error

Line: 117 Column: 37

              
    cv.imshow(win, vis)

    def onmouse(event, x, y, flags, param):
        cur_vis = vis
        if flags & cv.EVENT_FLAG_LBUTTON:
            cur_vis = vis0.copy()
            r = 8
            m = (anorm(np.array(p1) - (x, y)) < r) | (anorm(np.array(p2) - (x, y)) < r)

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 117 Column: 17

              
    cv.imshow(win, vis)

    def onmouse(event, x, y, flags, param):
        cur_vis = vis
        if flags & cv.EVENT_FLAG_LBUTTON:
            cur_vis = vis0.copy()
            r = 8
            m = (anorm(np.array(p1) - (x, y)) < r) | (anorm(np.array(p2) - (x, y)) < r)

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 148 Column: 5

                  feature_name = opts.get('--feature', 'brisk')
    try:
        fn1, fn2 = args
    except:
        fn1 = 'box.png'
        fn2 = 'box_in_scene.png'

    img1 = cv.imread(cv.samples.findFile(fn1), cv.IMREAD_GRAYSCALE)
    img2 = cv.imread(cv.samples.findFile(fn2), cv.IMREAD_GRAYSCALE)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 1

              FLANN_INDEX_LSH    = 6


def init_feature(name):
    chunks = name.split('-')
    if chunks[0] == 'sift':
        detector = cv.SIFT_create()
        norm = cv.NORM_L2
    elif chunks[0] == 'surf':

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 62 Column: 1

                  return detector, matcher


def filter_matches(kp1, kp2, matches, ratio = 0.75):
    mkp1, mkp2 = [], []
    for m in matches:
        if len(m) == 2 and m[0].distance < m[1].distance * ratio:
            m = m[0]
            mkp1.append( kp1[m.queryIdx] )

            

Reported by Pylint.

Variable name "m" doesn't conform to snake_case naming style
Error

Line: 64 Column: 9

              
def filter_matches(kp1, kp2, matches, ratio = 0.75):
    mkp1, mkp2 = [], []
    for m in matches:
        if len(m) == 2 and m[0].distance < m[1].distance * ratio:
            m = m[0]
            mkp1.append( kp1[m.queryIdx] )
            mkp2.append( kp2[m.trainIdx] )
    p1 = np.float32([kp.pt for kp in mkp1])

            

Reported by Pylint.

platforms/winpack_dldt/2021.2/sysroot.config.py
51 issues
Undefined variable 'self'
Error

Line: 1 Column: 31

              sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin')
copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')

build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config

def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir

            

Reported by Pylint.

Undefined variable 'prepare_dir'
Error

Line: 1 Column: 19

              sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin')
copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')

build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config

def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir

            

Reported by Pylint.

Undefined variable 'self'
Error

Line: 2 Column: 38

              sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin')
copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')

build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config

def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir

            

Reported by Pylint.

Undefined variable 'self'
Error

Line: 2 Column: 10

              sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin')
copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')

build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config

def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir

            

Reported by Pylint.

Undefined variable 'copytree'
Error

Line: 2 Column: 1

              sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin')
copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')

build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config

def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir

            

Reported by Pylint.

Undefined variable 'self'
Error

Line: 5 Column: 33

              copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph')
#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')

build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config

def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir
    copytree(build_bin_dir / name, sysroot_bin_dir / name)

            

Reported by Pylint.

Undefined variable 'self'
Error

Line: 6 Column: 17

              #rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll')

build_config = 'Release' if not self.config.build_debug else 'Debug'
build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config

def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir
    copytree(build_bin_dir / name, sysroot_bin_dir / name)


            

Reported by Pylint.

Undefined variable 'copytree'
Error

Line: 10 Column: 5

              
def copy_bin(name):
    global build_bin_dir, sysroot_bin_dir
    copytree(build_bin_dir / name, sysroot_bin_dir / name)

dll_suffix = 'd' if self.config.build_debug else ''
def copy_dll(name):
    global copy_bin, dll_suffix
    copy_bin(name + dll_suffix + '.dll')

            

Reported by Pylint.

Undefined variable 'self'
Error

Line: 12 Column: 21

                  global build_bin_dir, sysroot_bin_dir
    copytree(build_bin_dir / name, sysroot_bin_dir / name)

dll_suffix = 'd' if self.config.build_debug else ''
def copy_dll(name):
    global copy_bin, dll_suffix
    copy_bin(name + dll_suffix + '.dll')
    copy_bin(name + dll_suffix + '.pdb')


            

Reported by Pylint.

Undefined variable 'copytree'
Error

Line: 34 Column: 1

              copy_bin('pcie-ma2x8x.elf')
copy_bin('usb-ma2x8x.mvcmd')

copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb' / 'bin', sysroot_bin_dir)
copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb', self.sysrootdir / 'tbb')

sysroot_ie_dir = prepare_dir(self.sysrootdir / 'deployment_tools' / 'inference_engine')
sysroot_ie_lib_dir = prepare_dir(sysroot_ie_dir / 'lib' / 'intel64')


            

Reported by Pylint.