nigroup/nideep

View on GitHub

Showing 79 of 245 total issues

Function test_read_values_pixels_with_labels has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_values_pixels_with_labels(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 test_read_values_pixels_with_labels_uint8 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_values_pixels_with_labels_uint8(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 test_read_values_at_key_string has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_values_at_key_string(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 test_read_values_float has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_values_float(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 stack has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def stack(net, level):

    n = pu.copy_net_params(net)

    enc_prev = None
Severity: Minor
Found in nideep/nets/layerwise.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 forward has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def forward(self, bottom, top):
 #           self.forwardIter+=1
#        print 'iteration',self.forwardIter

        mu = 0.0
Severity: Minor
Found in nideep/layers/caffe_jitterlayer.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_response_to_lmdb has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def test_response_to_lmdb(self, mock_net, mock_num):

        # fake minimal test data
        b = {k : Bunch(data=np.random.rand(4, 1, 3, 2)) for k in ['x', 'y', 'z']}

Severity: Minor
Found in nideep/eval/test_inference.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 as_numpy_array has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def as_numpy_array(self, projection=['Smile', 'Trackerfail'], valid_only=True, train_proportion=0.8):
        tmp_train_images = os.path.join(self.cache_dir, self.TMP_TRAIN_IMAGES)
        tmp_train_labels = os.path.join(self.cache_dir, self.TMP_TRAIN_LABELS)
        tmp_test_images = os.path.join(self.cache_dir, self.TMP_TEST_IMAGES)
        tmp_test_labels = os.path.join(self.cache_dir, self.TMP_TEST_LABELS)
Severity: Minor
Found in nideep/datasets/amfed/amfed.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 combine_viewpoints has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def combine_viewpoints(self, angle, video_no, should_include_depth, output_path, split_method='random'):

        def join(df, output_path):
            for i in range(len(df.index)):
                current_original_file_df = df.iloc[[i]]
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 get_labels_lut has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def get_labels_lut(labels_list, labels_subset):
    """
    Generate a look-up-table for mapping labels from a list to a subset
    Unmapped labels are mapped to class id zero.
    Can be used for selecting a subset of classes and grouping everything else.
Severity: Minor
Found in nideep/datasets/dataset_utils.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 as_numpy_array has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def as_numpy_array(self, projection=['Smiling'], train_proportion=0.8, imbalance_proportion=None, oversample=False,
                       filter_by=None, cache=True):
        tmp_train_labels = os.path.join(self.cache_dir, self.TMP_TRAIN_LABELS)
        tmp_test_labels = os.path.join(self.cache_dir, self.TMP_TEST_LABELS)
        tmp_train_fnames = os.path.join(self.cache_dir, self.TMP_TRAIN_FILES)
Severity: Minor
Found in nideep/datasets/celeba/celeba.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 scalars_to_lmdb has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def scalars_to_lmdb(scalars, path_dst,
                    lut=None):
    '''
    Generate LMDB file from list of scalars
    '''
Severity: Minor
Found in nideep/iow/to_lmdb.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 from_list_to_tuple has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def from_list_to_tuple(self, items, lists, list_names):

        AMFEDEntity = namedtuple('AMFEDEntity', list_names)
        intersection = []
        for e in items:
Severity: Minor
Found in nideep/datasets/amfed/amfed.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 train_test_split_eitel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def train_test_split_eitel(train_info_df, seed=1000, train_output='', test_output=''):
        if train_output != '' and not os.path.isdir(os.path.split(train_output)[0]):
            os.makedirs(os.path.split(train_output)[0])
        if test_output != '' and not os.path.isdir(os.path.split(test_output)[0]):
            os.makedirs(os.path.split(test_output)[0])
Severity: Minor
Found in nideep/datasets/washington-rgbd/washington_rgbd.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 pascal_context_to_lmdb has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def pascal_context_to_lmdb(dir_imgs,
Severity: Major
Found in nideep/datasets/pascal_context/pascal_context_to_lmdb.py - About 50 mins to fix

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

    def find_video_labels_pairs(dir_imgs,
    Severity: Major
    Found in nideep/datasets/amfed/utils.py - About 50 mins to fix

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

      def save_balanced_sampled_class_count_hdf5(fpath,
      Severity: Major
      Found in nideep/datasets/balance_hdf5.py - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if l.type.lower() == l1.type.lower() and \
                                   [t.split('_nidx')[0] for t in l.top] == list(l1.top) and \
                                   [b.split('_nidx')[0] for b in l.bottom] == list(l1.bottom):
        
                                    assert_true(l.name.startswith(l1.name))
        Severity: Major
        Found in nideep/nets/test_net_merge.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if b not in data_tops:
                                  l.bottom.append(unicode(b + suffix))
                              else:
                                  l.bottom.append(unicode(b))  # preserve order of layer bottoms, label as bottom has to come last
          
          
          Severity: Major
          Found in nideep/nets/net_merge.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if original_item.pose > rotated_item.pose:
                                        (original_item, rotated_item) = (rotated_item, original_item)
            
            
            Severity: Major
            Found in nideep/datasets/washington-rgbd/washington_rgbd.py - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language