Showing 157 of 288 total issues
Container
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Container(object):
'''
A container for objects that have a name attribute.
Items in the Container can be accessed by index like a list or by key (the name attribute of the item).
For convenience, an item can also be accessed as an attribute with the same name as the name attribute of the item.
Function inheritdocstring
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def inheritdocstring(name, bases, attrs):
"""
Use as metaclass to inherit class and method docstrings from parent.
Adapted from http://stackoverflow.com/questions/13937500/inherit-a-parent-class-docstring-as-doc-attribute
Use this on classes defined in solver-specific interfaces to inherit docstrings from the high-level interface.
- 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
Variable
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Variable(symbolics.Symbol):
"""Optimization variables.
Variable objects are used to represents each variable of the optimization problem. When the optimization is
performed, the combination of variable values that optimizes the objective function, while not violating any
Model
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Model(interface.Model):
def _initialize_problem(self):
self.problem = glp_create_prob()
glp_create_index(self.problem)
if self.name is not None:
Function git_versions_from_keywords
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def git_versions_from_keywords(
keywords: Dict[str, str],
tag_prefix: str,
verbose: bool,
) -> Dict[str, Any]:
- 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 git_versions_from_keywords
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def git_versions_from_keywords(
keywords: Dict[str, str],
tag_prefix: str,
verbose: bool,
) -> Dict[str, Any]:
- 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_versions
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_versions(verbose: bool = False) -> Dict[str, Any]:
"""Get the project version from whatever source is available.
Returns dict with two keys: 'version' and 'full'.
"""
- 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 _initialize_model_from_problem
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _initialize_model_from_problem(self, problem):
try:
self.problem = problem
glp_create_index(self.problem)
except TypeError:
- 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 run_command
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run_command(
commands: List[str],
args: List[str],
cwd: Optional[str] = None,
verbose: bool = False,
- 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 run_command
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run_command(
commands: List[str],
args: List[str],
cwd: Optional[str] = None,
verbose: bool = False,
- 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
Model
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Model(interface.Model):
def _initialize_problem(self):
self.problem = cplex.Cplex()
def _initialize_model_from_problem(self, problem):
Function git_get_keywords
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def git_get_keywords(versionfile_abs: str) -> Dict[str, str]:
"""Extract version information from the given file."""
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from
- 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 git_get_keywords
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def git_get_keywords(versionfile_abs: str) -> Dict[str, str]:
"""Extract version information from the given file."""
# the code embedded in _version.py can just fetch the value of these
# keywords. When used from setup.py, we don't want to import _version.py,
# so we do it with a regexp instead. This function is not used from
- 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
Model
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Model(interface.Model):
ProblemClass = MatrixProblem
status_map = _STATUS_MAP
def _initialize_problem(self):
Configuration
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Configuration(interface.MathematicalProgrammingConfiguration):
lp_methods = _LP_METHODS
qp_methods = _QP_METHODS
def __init__(
Model
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Model(interface.Model):
def _initialize_problem(self):
self.problem = gurobipy.Model()
self.problem.params.OutputFlag = 0
Function _add_constraints
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _add_constraints(self, constraints, sloppy=False):
for constraint in constraints:
constraint_id = constraint.name
if sloppy is False:
variables = constraint.variables
- 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
File inspyred_interface.py
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2013 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Function _parse_linear_expression
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _parse_linear_expression(expression, expanded=False, **kwargs):
"""
Parse the coefficients of a linear expression (linearity is assumed).
Returns a dictionary of variable: coefficient pairs.
- 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 do_vcs_install
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def do_vcs_install(versionfile_source: str, ipy: Optional[str]) -> None:
"""Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-subst keyword substitution.
- 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"