Showing 119 of 411 total issues
File dataset.py
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy as np
from collections import defaultdict
import torch
File viewer.py
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import glfw
import mujoco
import time
import collections
File replay_memory.py
has 455 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy as np
import torch
from mushroom_rl.core import DatasetInfo, Dataset, Serializable
from mushroom_rl.rl_utils.parameters import to_parameter
Dataset
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class Dataset(Serializable):
def __init__(self, dataset_info, n_steps=None, n_episodes=None):
assert (n_steps is not None and n_episodes is None) or (n_steps is None and n_episodes is not None)
self._array_backend = ArrayBackend.get_array_backend(dataset_info.backend)
Function create_sim_state
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def create_sim_state(self):
data_obs = list()
self._contacts.compute_contacts()
- 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 reset
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def reset(self, mask=None):
policy_states = None
if self.policy_state_shape is None:
if mask is None:
for policy in self._policy_vector:
- 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 predict
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def predict(self, *z, idx=None, prediction=None, compute_variance=False,
**predict_params):
"""
Predict.
- 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 viewer.py
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
if 'PYGAME_HIDE_SUPPORT_PROMPT' not in os.environ:
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
File array_backend.py
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import deque
import numpy as np
import torch
from mushroom_rl.utils.torch import TorchUtils
File gaussian.py
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy as np
from .distribution import Distribution
from scipy.stats import multivariate_normal
from scipy.optimize import minimize
ArrayBackend
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class ArrayBackend(object):
@staticmethod
def get_backend_name():
raise NotImplementedError
Function add
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def add(self, dataset, n_steps_return=1, gamma=1.):
"""
Add elements to the replay memory.
Args:
- 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 add
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def add(self, dataset, priority, n_steps_return, gamma):
"""
Add elements to the tree.
Args:
- 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 render
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def render(self, data, record):
"""
Main rendering function.
Args:
- 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 reward
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def reward(self, state, action, next_state, absorbing):
puck_pos, puck_vel, _ = self.get_puck(next_state)
puck_pos = puck_pos[:2]
puck_vel = puck_vel[:2]
ee_pos = self.get_ee()[0][:2]
- 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 reward
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def reward(self, state, action, next_state, absorbing):
puck_pos = self.get_sim_state(next_state, "puck", PyBulletObservationType.BODY_POS)[:2]
puck_vel = self.get_sim_state(next_state, "puck", PyBulletObservationType.BODY_LIN_VEL)[:2]
ee_pos = self.get_sim_state(next_state, "planar_robot_1/link_striker_ee",
PyBulletObservationType.LINK_POS)[:2]
- 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 keyboard
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def keyboard(self, window, key, scancode, act, mods):
"""
Keyboard callback for glfw.
Args:
- 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 basis_list is not None and tilings is None and tensor_list is None and n_outputs is None:
return BasisFeatures(basis_list)
elif basis_list is None and tilings is not None and tensor_list is None and n_outputs is None:
return TilesFeatures(tilings)
elif basis_list is None and tilings is None and tensor_list is not None and n_outputs is None:
Function save_zip
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def save_zip(self, zip_file, full_save, folder=''):
"""
Serialize and save the agent to the given path on disk.
Args:
- 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 load_zip
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def load_zip(cls, zip_file, folder=''):
config_path = Serializable._append_folder(folder, 'config')
try:
object_type, save_attributes, primitive_dictionary = \
- 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"