williamfzc/stagesepx

View on GitHub

Showing 21 of 211 total issues

File base.py has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import pathlib
import typing
from collections import OrderedDict
import os
import json
Severity: Minor
Found in stagesepx/classifier/base.py - About 5 hrs to fix

    ClassifierResult has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ClassifierResult(object):
        LABEL_DATA: str = "data"
        LABEL_VIDEO_PATH: str = "video_path"
    
        def __init__(self, data: typing.List[SingleClassifierResult]):
    Severity: Minor
    Found in stagesepx/classifier/base.py - About 2 hrs to fix

      Function classify has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def classify(
              self,
              video: typing.Union[str, VideoObject],
              valid_range: typing.List[VideoCutRange] = None,
              step: int = None,
      Severity: Minor
      Found in stagesepx/classifier/base.py - About 2 hrs 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 run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def run(config: typing.Union[dict, str]):
          """
          run with config
      
          :param config: config file path, or a preload dict
      Severity: Minor
      Found in stagesepx/api.py - About 2 hrs 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 draw has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def draw(
              self,
              classifier_result: ClassifierResult,
              report_path: str = None,
              unstable_ranges: typing.List[VideoCutRange] = None,
      Severity: Minor
      Found in stagesepx/reporter.py - About 2 hrs 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 _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 pick_and_save has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def pick_and_save(
              self,
              range_list: typing.List[VideoCutRange],
              frame_count: int,
              to_dir: str = None,
      Severity: Minor
      Found in stagesepx/cutter/cut_result.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 calc_changing_cost has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def calc_changing_cost(
              self,
          ) -> typing.Dict[str, typing.Tuple[SingleClassifierResult, SingleClassifierResult]]:
              """ calc time cost between stages """
              # add changing cost
      Severity: Minor
      Found in stagesepx/classifier/base.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 get_unstable_range has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_unstable_range(
              self, limit: int = None, range_threshold: float = None, **kwargs
          ) -> typing.List[VideoCutRange]:
              """ return unstable range only """
              change_range_list = sorted(
      Severity: Minor
      Found in stagesepx/cutter/cut_result.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 get_range has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_range(
              self, limit: int = None, unstable_limit: int = None, **kwargs
          ) -> typing.Tuple[typing.List[VideoCutRange], typing.List[VideoCutRange]]:
              """
              return stable_range_list and unstable_range_list
      Severity: Minor
      Found in stagesepx/cutter/cut_result.py - About 55 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

      Function classify has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def classify(
      Severity: Major
      Found in stagesepx/classifier/base.py - About 50 mins to fix

        Function thumbnail has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def thumbnail(
        Severity: Minor
        Found in stagesepx/cutter/cut_result.py - About 45 mins to fix

          Function analyse has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def analyse(
          Severity: Minor
          Found in stagesepx/api.py - About 45 mins to fix

            Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Minor
            Found in stagesepx/classifier/base.py - About 35 mins to fix

              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in stagesepx/video.py - About 35 mins to fix

                Function get_range_dynamic has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def get_range_dynamic(
                Severity: Minor
                Found in stagesepx/cutter/cut_result.py - About 35 mins to fix

                  Function diff has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def diff(
                  Severity: Minor
                  Found in stagesepx/cutter/cut_result.py - About 35 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

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

                        def _prune(
                            threshold: float,
                            stages: typing.List[typing.Tuple[str, typing.List[VideoFrame]]],
                        ) -> typing.List[typing.Tuple[str, typing.List[VideoFrame]]]:
                            logger.debug(
                    Severity: Minor
                    Found in stagesepx/cutter/cut_result.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

                    Function thumbnail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def thumbnail(
                            self,
                            target_range: VideoCutRange,
                            to_dir: str = None,
                            compress_rate: float = None,
                    Severity: Minor
                    Found in stagesepx/cutter/cut_result.py - About 25 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

                    Severity
                    Category
                    Status
                    Source
                    Language