williamfzc/stagesepx

View on GitHub
stagesepx/cutter/cutter.py

Summary

Maintainability
A
2 hrs
Test Coverage

Function _convert_video_into_range_list has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def _convert_video_into_range_list(
        self, video: VideoObject, block: int, window_size: int, window_coefficient: int
    ) -> typing.List[VideoCutRange]:

        step = self.step
Severity: Minor
Found in stagesepx/cutter/cutter.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function cut has 7 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

    def cut(
Severity: Major
Found in stagesepx/cutter/cutter.py - About 50 mins to fix

    Function compare_frame_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def compare_frame_list(
            self, src: typing.List[np.ndarray], target: typing.List[np.ndarray]
        ) -> typing.List[float]:
            """
            core method about how to compare two lists of ndarray and get their ssim/mse/psnr
    Severity: Minor
    Found in stagesepx/cutter/cutter.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Line too long (83 > 79 characters)
    Open

            logger.info(f"total frame count: {video_length}, size: {video.frame_size}")
    Severity: Minor
    Found in stagesepx/cutter/cutter.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 (87 > 79 characters)
    Open

            self, video: VideoObject, block: int, window_size: int, window_coefficient: int
    Severity: Minor
    Found in stagesepx/cutter/cutter.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 (85 > 79 characters)
    Open

                    f"no compress rate or target size received. set compress rate to 0.2"
    Severity: Minor
    Found in stagesepx/cutter/cutter.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 (89 > 79 characters)
    Open

            core method about how to compare two lists of ndarray and get their ssim/mse/psnr
    Severity: Minor
    Found in stagesepx/cutter/cutter.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 (106 > 79 characters)
    Open

                        f"between {cur_frame.frame_id} & {each.frame_id}: ssim={ssim}; mse={mse}; psnr={psnr}"
    Severity: Minor
    Found in stagesepx/cutter/cutter.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

            # TODO other analysis results can be added to VideoCutResult, such as AI cutter?
    Severity: Minor
    Found in stagesepx/cutter/cutter.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

                overwrite=True, compress_rate=compress_rate, target_size=target_size
    Severity: Minor
    Found in stagesepx/cutter/cutter.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"part {part_index}: ssim={part_ssim}; mse={part_mse}; psnr={part_psnr}"
    Severity: Minor
    Found in stagesepx/cutter/cutter.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 (93 > 79 characters)
    Open

            :param block: default to 3. when block == 3, frame will be split into 3 * 3 = 9 parts
    Severity: Minor
    Found in stagesepx/cutter/cutter.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