nigroup/nideep

View on GitHub

Showing 79 of 245 total issues

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

def get_train_val_split_from_names(src, val_list):
    """
    Get indices split for train and validation entity names subset

    src -- list of all entities in dataset
Severity: Minor
Found in nideep/datasets/dataset_utils.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 preprocess_a_folder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def preprocess_a_folder(folder_dir, output_path):
    if not os.path.isdir(output_path):
        os.makedirs(output_path)

    file_list = os.walk(folder_dir)
Severity: Minor
Found in nideep/datasets/washington-rgbd/preprocess_object_recognition_eitel.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 oversample_idxs_to_balance_class_count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

    def test_intersection(self):
        amfed = AMFED(self.dir_tmp)
        found_entities = amfed.find_data_intersection()

        assert_equals(len(found_entities), 2)
Severity: Minor
Found in nideep/datasets/amfed/test_amfed.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 gen_paths has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def gen_paths(dir_src, func_filter=None):
    """
    Generate a list of files below a given directory.
    A function can be passed to filter specific files (on return value: True)
    """
Severity: Minor
Found in nideep/iow/file_system_utils.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 test_big_arr_to_arrs_single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_big_arr_to_arrs_single(self):

        x = np.array([[[ 1, 2, 3],
                       [ 4, 5, 6]
                       ],
Severity: Minor
Found in nideep/datasets/nyudv2/test_nyudv2_to_lmdb.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 LearningCurveFromPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def LearningCurveFromPath(p):

    if os.path.isfile(p):
        return LearningCurve(p)
    elif os.path.isdir(p):
Severity: Minor
Found in nideep/eval/learning_curve.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 test_read_img_PIL_pixels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_img_PIL_pixels(self):

        img = r.read_img_PIL(self.path_img1)

        for ch in range(3):
Severity: Minor
Found in nideep/iow/test_read_img.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 test_read_img_caf_pixels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_img_caf_pixels(self, mock_io):

        mock_io.load_image.return_value = \
            np.array([[[0.01176471, 0.00784314, 0.00392157],
                       [0.02352941, 0.01960784, 0.01568628]
Severity: Minor
Found in nideep/iow/test_read_img.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 test_hwc_to_chw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def test_hwc_to_chw():

    x = np.array([[[ 1, 2, 3],
                   [ 4, 5, 6]
                   ],
Severity: Minor
Found in nideep/blobs/test_mat_utils.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def list(self, key, phase=Phase.TEST):

        if phase.lower() == Phase.TEST.lower():

            if 'loss' in key.lower() and 'loss' in self.test_keys:
Severity: Minor
Found in nideep/eval/learning_curve.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 _infer_to_lmdb_cur_multi_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _infer_to_lmdb_cur_multi_key(net, keys, n, dbs):
    '''
    Run network inference for n batches and save results to an lmdb for each key.
    Higher time complexity but lower space complexity.

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

    def test_read_img_cv2_subtract_mean(self):

        m = np.array((1., 2. , 3.))
        img = r.read_img_cv2(self.path_img1, mean=m)

Severity: Minor
Found in nideep/iow/test_read_img.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 copy_samples_lmdb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def copy_samples_lmdb(path_lmdb, path_dst, keys, func_data=None):
    """
    Copy select samples from an lmdb into another.
    Can be used for sampling from an lmdb into another and generating a random shuffle
    of lmdb content.
Severity: Minor
Found in nideep/iow/copy_lmdb.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 test_cwh_to_chw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def test_cwh_to_chw():

    x = np.array([[[ 1, 2, 3],
                   [ 4, 5, 6]
                   ],
Severity: Minor
Found in nideep/blobs/test_mat_utils.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 test_compare_to_sklearn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_compare_to_sklearn(self):
        """
        Comparison using calculations by hand
        """
        for n in range(2, 100):
Severity: Minor
Found in nideep/eval/test_accuracy.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 test_read_img_caf_subtract_mean has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_img_caf_subtract_mean(self, mock_io):

        mock_io.load_image.return_value = \
            np.array([[[0.01176471, 0.00784314, 0.00392157],
                       [0.02352941, 0.01960784, 0.01568628]
Severity: Minor
Found in nideep/iow/test_read_img.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 test_read_img_PIL_subtract_mean has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_img_PIL_subtract_mean(self):

        m = np.array((1., 2. , 3.))
        img = r.read_img_PIL(self.path_img1, mean=m)

Severity: Minor
Found in nideep/iow/test_read_img.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 test_read_img_cv2_pixels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_read_img_cv2_pixels(self):

        img = r.read_img_cv2(self.path_img1)

        for ch in range(3):
Severity: Minor
Found in nideep/iow/test_read_img.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