williamfzc/stagesepx

View on GitHub
stagesepx/classifier/keras.py

Summary

Maintainability
A
0 mins
Test Coverage

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

            assert number_of_dir <= self.MODEL_DENSE, (
                f"dataset has {number_of_dir} classes (more than " + str(self.MODEL_DENSE) + "), please see "
Severity: Info
Found in stagesepx/classifier/keras.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert self._model, "model is empty"
Severity: Info
Found in stagesepx/classifier/keras.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert os.path.isfile(model_path), f"model file {model_path} not existed"
        # assert model data is empty
Severity: Info
Found in stagesepx/classifier/keras.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

            assert p.is_dir(), f"{p} is not a valid directory"
            # validate: at least two classes
Severity: Info
Found in stagesepx/classifier/keras.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

            assert (
                number_of_dir > 1
            ), f"dataset only contains one class. maybe some path errors happened: {p}?"

            # more than 6 classes?
Severity: Info
Found in stagesepx/classifier/keras.py by bandit

Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

    def __init__(
Severity: Major
Found in stagesepx/classifier/keras.py - About 1 hr to fix

    Line too long (81 > 79 characters)
    Open

            assert os.path.isfile(model_path), f"model file {model_path} not existed"
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (88 > 79 characters)
    Open

                ), f"dataset only contains one class. maybe some path errors happened: {p}?"
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (84 > 79 characters)
    Open

                rescale=1.0 / 16, shear_range=0.2, zoom_range=0.2, validation_split=0.33
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (80 > 79 characters)
    Open

                    f"max score is lower than {self.score_threshold}, unknown class"
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (109 > 79 characters)
    Open

                    f"dataset has {number_of_dir} classes (more than " + str(self.MODEL_DENSE) + "), please see "
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (100 > 79 characters)
    Open

                    f"model file {model_path} already existed, you can set `overwrite` True to cover it"
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (88 > 79 characters)
    Open

                number_of_dir = len([each for each in os.listdir(p) if (p / each).is_dir()])
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Line too long (84 > 79 characters)
    Open

            """model structure. you can overwrite this method to build your own model"""
    Severity: Minor
    Found in stagesepx/classifier/keras.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    There are no issues that match your filters.

    Category
    Status