sdpt3glue/result.py
Function extract_X
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
def extract_X(msg):
'''
Given the output message from running SDPT3solve.m, reconstruct the X
matrix from the printed output and return it.
'''
- 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
Avoid deeply nested control flow statements. Open
Open
for k, item in enumerate(re.split(r'\s+', line)):
Xlist[i][row, col_start + k] = float(item)
print "Imported X[{0}] as a matrix with shape {1}.".format(i, Xlist[i].shape)
Function handle_msg_item
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def handle_msg_item(x):
'''
A function that takes a string x and returns it's interpretation as an int,
float, or string in that order of preference. If x is None, None is
returned.
- 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"