Pylint report from report.jinja2

Score

9.28 / 10

Messages

Module drever.base_class (src/drever/base_class.py)

Line Col. Type Symbol ID Obj Message
135 19 warning isinstance-second-argument-not-valid-type W1116 Drever.set_input_data
Second argument of isinstance is not a type
146 19 warning isinstance-second-argument-not-valid-type W1116 Drever.get_input_data
Second argument of isinstance is not a type
162 19 warning isinstance-second-argument-not-valid-type W1116 Drever._set_output_data
Second argument of isinstance is not a type
173 19 warning isinstance-second-argument-not-valid-type W1116 Drever.get_output_data
Second argument of isinstance is not a type
228 31 warning unused-argument W0613 Drever.vunit_post_check
Unused argument 'output_path'
228 4 refactor no-self-use R0201 Drever.vunit_post_check
Method could be a function

Module drever.data_handlers.image (src/drever/data_handlers/image.py)

Line Col. Type Symbol ID Obj Message
80 4 convention missing-function-docstring C0116 ImageData.check_params
Missing function or method docstring
102 4 convention missing-function-docstring C0116 ImageData.set_params
Missing function or method docstring
110 4 convention missing-function-docstring C0116 ImageData.extract_params
Missing function or method docstring
159 4 convention missing-function-docstring C0116 ImageData.get_np_shape
Missing function or method docstring
166 4 convention missing-function-docstring C0116 ImageData.check_data
Missing function or method docstring
186 4 convention missing-function-docstring C0116 ImageData.init_with_data
Missing function or method docstring
203 4 convention missing-function-docstring C0116 ImageData.init_with_random
Missing function or method docstring
219 4 convention missing-function-docstring C0116 ImageData.get_image_data
Missing function or method docstring
378 0 convention missing-function-docstring C0116 compare_image
Missing function or method docstring
408 0 convention missing-function-docstring C0116 assert_image_equal
Missing function or method docstring

Module drever.data_handlers.stream (src/drever/data_handlers/stream.py)

Line Col. Type Symbol ID Obj Message
14 0 convention invalid-name C0103
Class name "DATA_TYPE" doesn't conform to PascalCase naming style
73 4 convention missing-function-docstring C0116 StreamData.get_np_shape
Missing function or method docstring
79 4 convention missing-function-docstring C0116 StreamData.get_stream_data
Missing function or method docstring
82 4 convention missing-function-docstring C0116 StreamData.check_params
Missing function or method docstring
108 4 convention missing-function-docstring C0116 StreamData.set_params
Missing function or method docstring
116 4 convention missing-function-docstring C0116 StreamData.extract_params
Missing function or method docstring
155 4 convention missing-function-docstring C0116 StreamData.check_data
Missing function or method docstring
175 4 convention missing-function-docstring C0116 StreamData.init_with_data
Missing function or method docstring
188 4 convention missing-function-docstring C0116 StreamData.init_with_random
Missing function or method docstring
332 0 convention missing-function-docstring C0116 compare_stream
Missing function or method docstring
361 0 convention missing-function-docstring C0116 assert_stream_equal
Missing function or method docstring

Module tests.data_handlers.test_image_data (src/tests/data_handlers/test_image_data.py)

Line Col. Type Symbol ID Obj Message
33 4 convention missing-function-docstring C0116 Test.test_set_params
Missing function or method docstring
60 4 convention missing-function-docstring C0116 Test.test_extract_params
Missing function or method docstring
148 4 convention missing-function-docstring C0116 Test.test_check_data
Missing function or method docstring
194 4 convention missing-function-docstring C0116 Test.test_check_params
Missing function or method docstring
236 4 convention missing-function-docstring C0116 Test.test_init_with_data
Missing function or method docstring
246 4 convention missing-function-docstring C0116 Test.test_init_with_random
Missing function or method docstring
260 4 convention missing-function-docstring C0116 Test.test_equal_method
Missing function or method docstring
343 4 convention missing-function-docstring C0116 Test.test_set_get_item
Missing function or method docstring
373 4 convention missing-function-docstring C0116 Test.test_save_load
Missing function or method docstring
498 4 convention missing-function-docstring C0116 Test.test_image_assertions
Missing function or method docstring

Module tests.data_handlers.test_stream_data (src/tests/data_handlers/test_stream_data.py)

Line Col. Type Symbol ID Obj Message
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:161
==tests.data_handlers.test_stream_data:221
        self.assertIn("'channels': 3", out_parts[4])

        del out_parts[4]

        self.assertEqual(
            "\n".join(out_parts),
            "*************************************************\n" +
            "Data Check Error\n" +
            "*************************************************\n" +
            "- Extracted Parameters:\n"
            "- Set Parameters:\n" +
            "None\n" +
            "*************************************************"
        )

        self.assertFalse(
            check_result,
            "check_data should return False because no params were set!"
        )

        uut.set_params({
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:16
==tests.data_handlers.test_stream_data:17
class Test(unittest.TestCase):
    '''
    Testing class for ImageData class
    '''

    tmp_dir = ""

    @classmethod
    def setUpClass(cls):

        # Create temporary directory for testdata files if not jet available
        cls.tmp_dir = os.path.join(drever.__path__[0], "../../tmp")
        if not os.path.exists(cls.tmp_dir):  # pragma: no cover
            os.makedirs(cls.tmp_dir)
            print("tmp directory created: " + cls.tmp_dir)

    def test_set_params(self):

        set_of_valid_params = [
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.test_stream_filter:14
==tests.test_video_filter:14
class Test(unittest.TestCase):

    tmp_dir = ""

    @classmethod
    def setUpClass(cls):

        # Create temporary directory for testdata files if not jet available
        cls.tmp_dir = os.path.join(drever.__path__[0], "../../tmp")
        if not os.path.exists(cls.tmp_dir):  # pragma: no cover
            os.makedirs(cls.tmp_dir)
            print("tmp directory created: " + cls.tmp_dir)

    def test_default_video_filter(self):

        set_of_valid_params = [
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.test_stream_filter:40
==tests.test_video_filter:40
                stimulus.init_with_random()

                uut.set_input_data(stimulus)
                uut.run()

                self.assertEqual(
                    uut.get_output_data(),
                    stimulus,
                    "Data missmatch!"
                )

    def test_vector_dump(self):
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==drever.data_handlers.image:172
==drever.data_handlers.stream:161
        if extracted_params != self.params:
            print("*************************************************")
            print("Data Check Error")
            print("*************************************************")
            print("- Extracted Parameters:")
            print(extracted_params)
            print("- Set Parameters:")
            print(self.params)
            print("*************************************************")
            return False

        return True
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:294
==tests.data_handlers.test_stream_data:321
                uut_b.init_with_random(1)

                self.assertNotEqual(
                    uut_a,
                    uut_b,
                    "Data missmatch!"
                )

        # Equality not given due missmatching image params
        for params in set_of_valid_params:
            with self.subTest(params=params):
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:278
==tests.data_handlers.test_stream_data:305
                uut_b.init_with_random(0)

                self.assertEqual(
                    uut_a,
                    uut_b,
                    "Data missmatch!"
                )

        # Equality not given due missmatching image data
        for params in set_of_valid_params:
            with self.subTest(params=params):
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:52
==tests.data_handlers.test_stream_data:51
        ]

        for params in set_of_failing_params:
            with self.subTest(params=params):
                with self.assertRaises(AssertionError):
                    uut.set_params(params)

    def test_extract_params(self):

        set_of_tests = [
            {
                'params': {
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.test_stream_filter:103
==tests.test_video_filter:106
                with self.assertRaises(FileNotFoundError):
                    uut_b.load(filename + ".tmp")

                # Add empty lines to see if bypassing is working
                with open(filename, 'r') as uut_a_file:
                    origin_content = uut_a_file.read()
                    uut_a_file.close()
                with open(filename, 'w') as uut_a_file:
                    uut_a_file.write("    \n")
                    uut_a_file.write(origin_content)
                    uut_a_file.close()
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==drever.data_handlers.image:97
==drever.data_handlers.stream:103
                return False

        return True

    def set_params(self, params):

        if params is None:
            self.params = None
        elif self.check_params(params, True):
            self.params = params

    @classmethod
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:372
==tests.data_handlers.test_stream_data:391
    def test_save_load(self):

        def add_empty_line(filename):
            with open(filename, 'r') as tmp_file:
                origin_content = tmp_file.read()
                tmp_file.close()
            with open(filename, 'w') as tmp_file:
                tmp_file.write("    \n")
                tmp_file.write(origin_content)
                tmp_file.close()
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:327
==tests.data_handlers.test_stream_data:354
                uut_b.init_with_random(0)

                # unsupported types must return NotImplemented flag
                self.assertEqual(
                    uut_a.__eq__("Strings aren't objs from ImageData class."),
                    NotImplemented,
                    "Type missmatch!"
                )

                self.assertEqual(
                    uut_a,
1 0 refactor duplicate-code R0801
Similar lines in 4 files
==tests.data_handlers.test_image_data:21
==tests.data_handlers.test_stream_data:22
==tests.test_stream_filter:16
==tests.test_video_filter:16
    tmp_dir = ""

    @classmethod
    def setUpClass(cls):

        # Create temporary directory for testdata files if not jet available
        cls.tmp_dir = os.path.join(drever.__path__[0], "../../tmp")
        if not os.path.exists(cls.tmp_dir):  # pragma: no cover
            os.makedirs(cls.tmp_dir)
            print("tmp directory created: " + cls.tmp_dir)
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==drever.stream_filter:18
==drever.video_filter:18
    }

    # Overwrite this dictionary with your default Drever algorithm parameters.
    DEFAULT_PARAMS = {}

    def run(self):
        self._set_output_data(self.get_input_data())

    @classmethod
    def dump_vectors(cls, path, vectors):
        vectors.save(path, False)
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:313
==tests.data_handlers.test_stream_data:340
                self.assertNotEqual(
                    uut_a,
                    uut_b,
                    "Params missmatch!"
                )

        # Equality not given due missmatching class type
        for params in set_of_valid_params:
            with self.subTest(params=params):
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.test_stream_filter:90
==tests.test_video_filter:93
                if os.path.exists(filename):  # pragma: no cover
                    os.remove(filename)

                uut.set_input_data(uut_a)
                uut.dump_input_vectors(filename)

                # Saving again must raise an error
                with self.assertRaises(FileExistsError):
                    uut.dump_input_vectors(filename)
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:226
==tests.data_handlers.test_stream_data:200
        for test in set_of_tests:
            with self.subTest(test=test):
                self.assertEqual(
                    uut.check_params(test["params"], False),
                    test["expected"],
                    "check_params result missmatch!"
                )
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:401
==tests.test_video_filter:71
            },
            {
                "params": {
                    "width":    20,
                    "height":   10,
                    "bitdepth": 16,
                    "channels":  3
                },
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:392
==tests.test_video_filter:62
            },
            {
                "params": {
                    "width":    20,
                    "height":   10,
                    "bitdepth": 10,
                    "channels":  2
                },
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:383
==tests.test_video_filter:53
        ppm_files = [
            {
                "params": {
                    "width":    20,
                    "height":   10,
                    "bitdepth":  8,
                    "channels":  1
                },
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_stream_data:463
==tests.test_stream_filter:115
                    uut_b.load(filename)

                    np.testing.assert_array_equal(
                        uut_b.get_stream_data(),
                        uut_a.get_stream_data(),
                        "Data Missmatch"
                    )
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==drever.data_handlers.image:411
==drever.data_handlers.stream:364
    if result["num_errors"] < 0:
        total_msg = "Image Parameter Missmatch!\n"
        total_msg += msg
        assert result["num_errors"] == 0, total_msg
    elif result["num_errors"] > 0:
        total_msg = "Image Data Missmatch!\n"
        total_msg += msg
        assert result["num_errors"] == 0, total_msg
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==drever.data_handlers.image:65
==drever.data_handlers.stream:58
            elif isinstance(obj["obj"], np.ndarray):
                obj["data"] = obj["obj"]
            else:
                return NotImplemented

        if not np.array_equal(objs[0]["data"], objs[1]["data"]):
            return False
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_image_data:140
==tests.data_handlers.test_stream_data:146
            with self.subTest(extracted=extracted, expected=test['expected']):
                self.assertDictEqual(
                    extracted,
                    test['expected'],
                    'Extracted params missmatch!'
                )
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==tests.data_handlers.test_stream_data:402
==tests.test_stream_filter:53
        txt_files = [
            {
                "params": {
                    "size":       10,
                    "data_width":  8,
                    "channels":    1
                },
34 4 convention missing-function-docstring C0116 Test.test_set_params
Missing function or method docstring
59 4 convention missing-function-docstring C0116 Test.test_extract_params
Missing function or method docstring
171 4 convention missing-function-docstring C0116 Test.test_check_params
Missing function or method docstring
209 4 convention missing-function-docstring C0116 Test.test_check_data
Missing function or method docstring
254 4 convention missing-function-docstring C0116 Test.test_init_with_data
Missing function or method docstring
261 4 convention missing-function-docstring C0116 Test.test_init_with_random
Missing function or method docstring
288 4 convention missing-function-docstring C0116 Test.test_equal_method
Missing function or method docstring
370 4 convention missing-function-docstring C0116 Test.test_set_get_item
Missing function or method docstring
392 4 convention missing-function-docstring C0116 Test.test_save_load
Missing function or method docstring
472 4 convention missing-function-docstring C0116 Test.test_stream_assertions
Missing function or method docstring

Module tests.test_stream_filter (src/tests/test_stream_filter.py)

Line Col. Type Symbol ID Obj Message
15 0 convention missing-class-docstring C0115 Test
Missing class docstring
28 4 convention missing-function-docstring C0116 Test.test_default_video_filter
Missing function or method docstring
52 4 convention missing-function-docstring C0116 Test.test_vector_dump
Missing function or method docstring

Module tests.test_video_filter (src/tests/test_video_filter.py)

Line Col. Type Symbol ID Obj Message
15 0 convention missing-class-docstring C0115 Test
Missing class docstring
28 4 convention missing-function-docstring C0116 Test.test_default_video_filter
Missing function or method docstring
52 4 convention missing-function-docstring C0116 Test.test_vector_dump
Missing function or method docstring

Metrics

Count per types

Name Count
warning 5
refactor 26
convention 47

Count per messages

Name Count
isinstance-second-argument-not-valid-type 4
unused-argument 1
no-self-use 1
invalid-name 1
missing-function-docstring 44
missing-class-docstring 2
duplicate-code 25

Count per modules

Name Count
drever.base_class 6
drever.data_handlers.stream 11
drever.data_handlers.image 10
tests.test_stream_filter 3
tests.test_video_filter 3
tests.data_handlers.test_image_data 10
tests.data_handlers.test_stream_data 35

Count per path

Name Count
src/drever/base_class.py 6
src/drever/data_handlers/stream.py 11
src/drever/data_handlers/image.py 10
src/tests/test_stream_filter.py 3
src/tests/test_video_filter.py 3
src/tests/data_handlers/test_image_data.py 10
src/tests/data_handlers/test_stream_data.py 35