Showing 620 of 631 total issues
File configure_problem.py
has 1850 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable, Any
import numpy as np
from casadi import vertcat, Function, DM
File optimal_control_program.py
has 1506 lines of code (exceeds 250 allowed). Consider refactoring. Open
from math import inf
from typing import Callable, Any
import biorbd_casadi as biorbd
import casadi
Function _create_plots
has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring. Open
def _create_plots(self, only_initialize_variables: bool):
"""
Setup the plots
Parameters
- 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 solution.py
has 1261 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy as np
from casadi import vertcat, DM, Function
from copy import deepcopy
from matplotlib import pyplot as plt
from scipy import interpolate as sci_interp
File penalty.py
has 1154 lines of code (exceeds 250 allowed). Consider refactoring. Open
import inspect
from typing import Any
from casadi import horzcat, vertcat, Function, acos, dot, norm_fro, MX_eye, SX_eye, SX, jacobian, trace
from math import inf
File path_conditions.py
has 1140 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable, Any, List, Tuple
import numpy as np
from casadi import MX, SX, vertcat
from scipy.interpolate import interp1d
File constraints.py
has 1088 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable, Any
import numpy as np
from casadi import sum1, if_else, vertcat, lt, SX, MX, jacobian, Function, MX_eye, SX_eye, horzcat, ldl, diag
Function __set_costs
has a Cognitive Complexity of 127 (exceeds 5 allowed). Consider refactoring. Open
def __set_costs(self, ocp):
"""
Set the cost functions from ocp
Parameters
- 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 dynamics_functions.py
has 1010 lines of code (exceeds 250 allowed). Consider refactoring. Open
from casadi import horzcat, vertcat, MX, SX, DM
from .dynamics_evaluation import DynamicsEvaluation
from .fatigue.fatigue_dynamics import FatigueList
from ..misc.enums import DefectType
File biorbd_model.py
has 958 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable
import biorbd_casadi as biorbd
import numpy as np
from biorbd_casadi import (
File plot.py
has 876 lines of code (exceeds 250 allowed). Consider refactoring. Open
import tkinter
from typing import Callable, Any
import numpy as np
from casadi import DM
File multi_biorbd_model.py
has 870 lines of code (exceeds 250 allowed). Consider refactoring. Open
import biorbd_casadi as biorbd
from casadi import MX, vertcat, Function, horzcat
from typing import Callable
from .biorbd_model import BiorbdModel
File penalty_option.py
has 826 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Any, Callable
import numpy as np
from casadi import vertcat, Function, MX, SX, jacobian, diag
Function _process_time_vector
has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring. Open
def _process_time_vector(
self,
time_resolution: TimeResolution,
to_merge: SolutionMerge | list[SolutionMerge],
time_alignment: TimeAlignment,
- 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 receding_horizon_optimization.py
has 755 lines of code (exceeds 250 allowed). Consider refactoring. Open
from copy import deepcopy
from math import inf
from typing import Callable
from time import perf_counter
File acados_interface.py
has 741 lines of code (exceeds 250 allowed). Consider refactoring. Open
from time import perf_counter
from datetime import datetime
import numpy as np
from scipy import linalg
Function _declare_cx_and_plot
has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring. Open
def _declare_cx_and_plot(self):
if self.as_states:
for node_index in range(
self.nlp.n_states_nodes if self.nlp.phase_dynamics == PhaseDynamics.ONE_PER_NODE else 1
):
- 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 arm_reaching_muscle_driven.py
has 716 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
This example replicates the results from "An approximate stochastic optimal control framework to simulate nonlinear
neuro-musculoskeletal models in the presence of noise"(https://doi.org/10.1371/journal.pcbi.1009338).
The task is to unfold the arm to reach a target further from the trunk.
Noise is added on the motor execution (motor_noise) and on the feedback (wEE=wP and wEE_dot=wPdot).
File graph.py
has 711 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy as np
from ..limits.constraints import Constraint
from ..limits.objective_functions import ObjectiveFcn, ObjectiveList, Objective
from ..limits.path_conditions import Bounds
BiorbdModel
has 85 functions (exceeds 20 allowed). Consider refactoring. Open
class BiorbdModel:
"""
This class wraps the biorbd model and allows the user to call the biorbd functions from the biomodel protocol
"""