williamfzc/stagesepx

View on GitHub

Showing 25 of 220 total issues

File base.py has 423 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 6 hrs to fix

    ClassifierResult has 25 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 multi_compare_ssim has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def multi_compare_ssim(
          pic1_list: typing.List, pic2_list: typing.List, hooks: typing.List = None
      ) -> typing.List[float]:
          # avoid import loop
          from stagesepx.video import VideoFrame
      Severity: Minor
      Found in stagesepx/toolbox.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 diff has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def diff(
        Severity: Major
        Found in stagesepx/cutter/cut_result.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 _diff has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _diff(
                Severity: Minor
                Found in stagesepx/api.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_range.py - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language