File molecule_util.py
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
""" Utilities for dealing with molecules
:Author: Yosef Roth <yosefdroth@gmail.com>
:Author: Jonathan <jonrkarr@gmail.com>
:Date: 2017-04-12
Function is_equal
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def is_equal(self, other,
check_protonation=True, check_double_bonds=True, check_stereochemistry=True,
check_isotopes=True, check_fixed_hydrogens=True, check_reconnected_metals=True):
""" Determine if two molecules are semantically equal (all of their layers are equal).
- 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
Consider simplifying this complex logical expression. Open
if len(self.structure) >= 7 and self.structure[0:6] == 'InChI=' and \
obConversion.SetInFormat('inchi') and \
obConversion.ReadString(mol, self.structure):
return 'inchi'
elif obConversion.SetInFormat('can') and \
Function is_equal
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_equal(self, other,
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return None
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Function __init__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, structure):
"""
Args:
structure (:obj:`str`): InChI-encoded structure of a molecule
- 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 get_format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_format(self):
""" Get the format of the structure
Returns:
:obj:`str`: format
- 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"