IBM/pytorchpipe

View on GitHub

Showing 102 of 320 total issues

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

    def export_to_tensorboard(self, tb_writer=None):
        """
        Method exports current statistics to tensorboard.

        :param tb_writer: TensorBoard writer, optional.
Severity: Minor
Found in ptp/utils/statistics_collector.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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self, chkpt_dir, training_status, loss):
        """
        Generic method saving the parameters of all models in the pipeline to a file.

        :param chkpt_dir: Directory where the model will be saved.
Severity: Minor
Found in ptp/application/pipeline_manager.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 leafs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def leafs(self):
        """
        Yields the leafs of the current :py:class:`ConfigInterface`.

        """
Severity: Minor
Found in ptp/configuration/config_interface.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 export_to_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def export_to_string(self, additional_tag=''):
        """
        Method returns current statistics in the form of string using the
        possessed formatting.

Severity: Minor
Found in ptp/utils/statistics_collector.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 __call__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, data_streams):
        """
        Shows a sample from the batch.

        :param data_streams: :py:class:`ptp.utils.DataStreams` object.
Severity: Minor
Found in ptp/components/viewers/image_viewer.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 run_experiment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def run_experiment(self):
        """
        Main function of the ``Processor``: Test the loaded model over the set.

        Iterates over the ``DataLoader`` for a maximum number of episodes equal to the set size.
Severity: Minor
Found in ptp/workers/processor.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 recursive_summarize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def recursive_summarize(self, module_, indent_, module_name_):
        """
        Function that recursively inspects the (sub)modules and records their statistics\
          (like names, types, parameters, their numbers etc.)

Severity: Minor
Found in ptp/components/models/model.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

Avoid too many return statements within this function.
Open

            return list(map(type(obj), zip(*map(scatter_map, obj.items()))))    
Severity: Major
Found in ptp/utils/data_streams_parallel.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return type(out)(map(gather_map, zip(*outputs)))
    Severity: Major
    Found in ptp/utils/data_streams_parallel.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return [obj for _ in target_gpus]
      Severity: Major
      Found in ptp/utils/data_streams_parallel.py - About 30 mins to fix

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

            def output_data_definitions(self):
                """ 
                Function returns a dictionary with definitions of output data produced the component.
        
                :return: dictionary containing output data definitions (each of type :py:class:`ptp.utils.DataDefinition`).
        Severity: Minor
        Found in ptp/components/models/general_usage/recurrent_neural_network.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

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

            def calculate_accuracy(self, data_streams):
                """
                Calculates accuracy equal to mean number of correct classification in a given batch.
        
                :param data_streams: DataStreams containing the targets.
        Severity: Minor
        Found in ptp/components/statistics/accuracy_statistics.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

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

            def load_testset_without_answers(self, data_file, image_folder):
                """
                Loads the test set without answers.
        
                :param data_file: Source file.
        Severity: Minor
        Found in ptp/components/tasks/image_text_to_class/vqa_med_2019.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

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

            def export_to_csv(self, csv_file=None):
                """
                This method writes the current statistical aggregators values to the `csv_file` using the associated formatting.
        
                :param csv_file: File stream opened for writing, optional.
        Severity: Minor
        Found in ptp/utils/statistics_aggregator.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

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

            def set_types(self):
                """
                Enables computations on CUDA if GPU is available.
                Sets the default data types.
                """
        Severity: Minor
        Found in ptp/utils/app_state.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

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

            def build(name, config):
                """
                Method creates a single component on the basis of configuration section.
                Raises ConfigurationError exception when encountered issues.
        
        
        Severity: Minor
        Found in ptp/application/component_factory.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

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

            def export_to_checkpoint(self):
                """
                This method exports the collected data into a dictionary using the associated formatting.
        
                """
        Severity: Minor
        Found in ptp/utils/statistics_collector.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

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

            def input_data_definitions(self):
                """ 
                Function returns a dictionary with definitions of input data that are required by the component.
        
                :return: dictionary containing input data definitions (each of type :py:class:`ptp.utils.DataDefinition`).
        Severity: Minor
        Found in ptp/components/models/general_usage/recurrent_neural_network.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

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

            def sentences_to_tensor(self, data_streams):
                """
                Encodes "inputs" in the format of batch of list of words into a single tensor with corresponding indices.
        
                :param data_streams: :py:class:`ptp.datatypes.DataStreams` object containing (among others):
        Severity: Minor
        Found in ptp/components/language/sentence_indexer.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

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

            def load_dataset(self, source_files, source_image_folders, source_categories):
                """
                Loads the dataset from one or more files.
        
                :param source_files: List of source files.
        Severity: Minor
        Found in ptp/components/tasks/image_text_to_class/vqa_med_2019.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