nigroup/nideep

View on GitHub

Showing 79 of 245 total issues

Function merge_indep_net_spec has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

def merge_indep_net_spec(net_specs, suffix_fmt=suffix_fmt_idx):
    """
    list of network specification instances
    suffix formatter given index
    """
Severity: Minor
Found in nideep/nets/net_merge.py - About 5 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

File test_read_lmdb.py has 366 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'''
Created on Oct 30, 2015

@author: kashefy
'''
Severity: Minor
Found in nideep/iow/test_read_lmdb.py - About 4 hrs to fix

    Function test_duplicate has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_duplicate(self):
    
            fpath = os.path.join(os.path.dirname(ROOT_PKG_PATH),
                                 TEST_DATA_DIRNAME, TEST_NET_FILENAME)
    
    
    Severity: Minor
    Found in nideep/nets/test_net_merge.py - About 4 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 test_duplicate_hdf5data has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_duplicate_hdf5data():
    
            fpath = os.path.join(os.path.dirname(ROOT_PKG_PATH),
                                 TEST_DATA_DIRNAME, TEST_NET_HDF5DATA_FILENAME)
    
    
    Severity: Minor
    Found in nideep/nets/test_net_merge.py - About 4 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

    File washington_rgbd.py has 318 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    import numpy as np
    import cv2
    import argparse
    import shutil
    Severity: Minor
    Found in nideep/datasets/washington-rgbd/washington_rgbd.py - About 3 hrs to fix

      Function train_test_split_eitel_stereo_rgb has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def train_test_split_eitel_stereo_rgb(self, seed=1000, rotation_index=10, train_output='', test_output=''):
              self.logger.info('Splitting train/test for stereo rgb')
              washington_aggredated_df = self.aggregate_frame_data()
      
              dicts = []
      Severity: Minor
      Found in nideep/datasets/washington-rgbd/washington_rgbd.py - About 3 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 frames has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def frames(self, projection=[], valid_only=False):
              """
              Get a list of dicts corresponding to the decoded frames of the video. Each dict has the following keys:
              - 'features': if valid, the numpy array corresponding to the frame else None
              - 'labels': a numpy array corresponding to the labels
      Severity: Minor
      Found in nideep/datasets/amfed/entity.py - About 3 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

      File test_to_lmdb.py has 301 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      '''
      Created on Oct 30, 2015
      
      @author: kashefy
      '''
      Severity: Minor
      Found in nideep/iow/test_to_lmdb.py - About 3 hrs to fix

        Function infer_to_h5_fixed_dims has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        def infer_to_h5_fixed_dims(net, keys, n, dst_fpath, preserve_batch=False):
            """
            Run network inference for n batches and save results to file
            """
            with h5py.File(dst_fpath, "w") as f:
        Severity: Minor
        Found in nideep/eval/inference.py - About 3 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 est_min_num_fwd_passes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        def est_min_num_fwd_passes(fpath_net, mode_str, key=None):
            """
            if multiple source for same mode, base num_passes on last
            fpath_net -- path to network definition
            mode_str -- train or test?
        Severity: Minor
        Found in nideep/eval/inference.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

        File test_nyudv2_to_lmdb.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from nose.tools import assert_false, assert_greater, assert_is_instance, \
            assert_list_equal, assert_raises, assert_true, assert_equal
        from mock import patch
        import os
        import tempfile
        Severity: Minor
        Found in nideep/datasets/nyudv2/test_nyudv2_to_lmdb.py - About 2 hrs to fix

          Function interpolate_poses has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def interpolate_poses(self, data_frame):
                  if os.path.isfile(self.csv_interpolated_default):
                      self.logger.info('reading from ' + self.csv_interpolated_default)
                      return pd.read_csv(self.csv_interpolated_default)
          
          
          Severity: Minor
          Found in nideep/datasets/washington-rgbd/washington_rgbd.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 load_metadata has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def load_metadata(self):
                  if os.path.isfile(self.csv_default):
                      self.logger.info('reading from ' + self.csv_default)
                      return pd.read_csv(self.csv_default)
          
          
          Severity: Minor
          Found in nideep/datasets/washington-rgbd/washington_rgbd.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 sample_idxs_to_target_count has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def sample_idxs_to_target_count(self, class_counts, target_count):
                  """
                  Determine indices with with which we can sample from the dataset
                  and get a balanced inter-class distribution
                  Classes with count < target_count will sub-sampled without replacement.
          Severity: Minor
          Found in nideep/datasets/balance.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 nyudv2_to_lmdb has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def nyudv2_to_lmdb(path_mat,
                             dst_prefix,
                             dir_dst,
                             val_list=None):
          
          
          Severity: Minor
          Found in nideep/datasets/nyudv2/nyudv2_to_lmdb.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 test_read_values_at has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def test_read_values_at(self, mock_dat):
          
                  # mocks
                  dstr = ['\x01\x04\x07\n\r\x10\x13\x16\x02\x05\x08\x0b\x0e\x11\x14\x17\x03\x06\t\x0c\x0f\x12\x15\x18',
                          '\x10\x16\x11\x17\x12\x18']
          Severity: Minor
          Found in nideep/iow/test_read_lmdb.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 fname_pairs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def fname_pairs(paths_a, paths_b):
              """
              find filename pairs between two lists.
              The filenames of the first list are used as a prefix to match with entries
              in the second list
          Severity: Minor
          Found in nideep/iow/file_system_utils.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 test_read_values_pixels_no_labels has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def test_read_values_pixels_no_labels(self, mock_dat):
          
                  # expected content: img1_data, img1_data[2:,1:,:]
          
                  # mocks
          Severity: Minor
          Found in nideep/iow/test_read_lmdb.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 test_read_values has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def test_read_values(self, mock_dat):
          
                  img2_data = self.img1_data[2:, 1:, :]
          
                  # mocks
          Severity: Minor
          Found in nideep/iow/test_read_lmdb.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 map_to_gan_data_with_depth has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def map_to_gan_data_with_depth(original_training_df, gan_image_dir, saving_dir, pose_preprocess=False, depth_preprocess=False,
                                         need_actual_preprocess=False):
              if not os.path.isdir(saving_dir):
                  os.mkdir(saving_dir)
          
          

          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