Showing 33 of 54 total issues
FormFeatureExtraction
has 69 functions (exceeds 20 allowed). Consider refactoring. Open
class FormFeatureExtraction(object):
def __init__(self, segmentation):
self.segmentation = segmentation
def get_features(self, features=None):
File form_feature_extraction.py
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import division
import re
from cached_property import cached_property
Function normalized_cut
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def normalized_cut(adj, rid=None):
"""Perform NormalizedCut on a given adjacency matrix. Return a cluster
map indicating the resulting pairwise cluster."""
if rid is None:
- Read upRead up
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_feature_extraction
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_feature_extraction(self):
segmentation = np.array([[0, 1, 1, 4, 6, 6], [0, 0, 1, 4, 6, 7],
[0, 3, 1, 5, 5, 7], [0, 2, 2, 2, 5, 7],
[8, 8, 2, 5, 5, 9], [8, 8, 8, 9, 9, 9]])
Function train
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def train(model,
data,
preprocess_algorithm,
batch_size,
dropout,
- Read upRead up
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_coarsen_adj_with_efficient_pooling
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_coarsen_adj_with_efficient_pooling(self):
adj = [[0, 1, 1, 0, 0], [1, 0, 0, 1, 0], [1, 0, 0, 1, 0],
[0, 1, 1, 0, 1], [0, 0, 0, 1, 0]]
adj = sp.coo_matrix(adj)
points = np.array([[1, 1], [3, 2], [3, 0], [4, 1], [8, 3]])
Function __init__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, data_dir, dataset, preprocess_algorithm):
self._data_dir = data_dir
self.epochs_completed = 0
self._index_in_epoch = 0
- Read upRead up
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 __init__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self,
dataset,
preprocess_algorithm,
augment,
batch_size,
- Read upRead up
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_conv_K2_P4
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_conv_K2_P4(self):
features = [[1, 2], [3, 4], [5, 6], [7, 8]]
features = tf.constant(features, dtype=tf.float32)
adj_dist = [[0, 2, 1, 0], [2, 0, 0, 1], [1, 0, 0, 2], [0, 1, 2, 0]]
Function train
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def train(model,
Function test_coarsen_adj
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_coarsen_adj(self):
adj = [[0, 1, 1, 0, 0], [1, 0, 0, 1, 0], [1, 0, 0, 1, 0],
[0, 1, 1, 0, 1], [0, 0, 0, 1, 0]]
adj = sp.coo_matrix(adj)
points = np.array([[1, 1], [3, 2], [3, 0], [4, 1], [8, 3]])
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function test_coarsen_clustered_adj
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_coarsen_clustered_adj(self):
adj = [[0, 1, 0, 1, 0], [1, 0, 1, 0, 0], [0, 1, 0, 1, 0],
[1, 0, 1, 0, 1], [0, 0, 0, 1, 0]]
adj = sp.coo_matrix(adj)
points = np.array([[1, 1], [3, 1], [3, 3], [1, 3], [0, 8]])
Function coarsen_adj
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def coarsen_adj(adj,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function _coarsen_adj
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _coarsen_adj(adj,
Function preprocess_spatial_fixed
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def preprocess_spatial_fixed(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function preprocess_pipeline
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def preprocess_pipeline(image,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,