Showing 119 of 411 total issues
PyBullet
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class PyBullet(Environment):
"""
Class to create a Mushroom environment using the PyBullet simulator.
"""
NumpyBackend
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class NumpyBackend(ArrayBackend):
@staticmethod
def get_backend_name():
return 'numpy'
TorchBackend
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class TorchBackend(ArrayBackend):
@staticmethod
def get_backend_name():
return 'torch'
Function __init__
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, model, dt, width=1920, height=1080, start_paused=False,
custom_render_callback=None, record=False, camera_params=None,
default_camera_mode="static", hide_menu_on_startup=None,
geom_group_visualization_on_startup=None, headless=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
NumpyDataset
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class NumpyDataset(Serializable):
def __init__(self, state_type, state_shape, action_type, action_shape, reward_shape, flag_shape,
policy_state_shape, mask_shape):
self._state_type = state_type
TorchDataset
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class TorchDataset(Serializable):
def __init__(self, state_type, state_shape, action_type, action_shape, reward_shape, flag_shape,
policy_state_shape, mask_shape, device=None):
self._device = TorchUtils.get_device(device)
ListDataset
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ListDataset(Serializable):
def __init__(self, is_stateful, is_vectorized):
self._dataset = list()
self._policy_dataset = list()
self._is_stateful = is_stateful
Function _process_observations
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _process_observations(self):
low = list()
high = list()
for name, obs_type in self.observation_map:
- 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 __init__
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, mdp_info, obs_normalized=False, window_size=1000,
update_freq=10, show=True):
"""
Constructor.
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
def reward(self, state, action, next_state, absorbing):
r = 0
puck_pos = self.get_sim_state(next_state, "puck", PyBulletObservationType.BODY_POS)[:2]
puck_vel = self.get_sim_state(self._state, "puck", PyBulletObservationType.BODY_LIN_VEL)[: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
File gaussian_policy.py
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy as np
from .policy import ParametricPolicy
from scipy.stats import multivariate_normal
Function __init__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, observation_spec, model, data, max_joint_velocity):
if len(observation_spec) == 0:
raise AttributeError("No Environment observations were specified. "
"Add at least one observation to the observation_spec.")
- 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 _env_worker
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _env_worker(remote, env_class, use_generator, args, kwargs):
if use_generator:
env = env_class.generate(*args, **kwargs)
else:
- 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 fit
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fit(self, dataset):
for _ in trange(self._n_iterations(), dynamic_ncols=True, disable=self._quiet, leave=False):
state = list()
action = list()
reward = list()
- 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 is_absorbing
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def is_absorbing(self, state):
if super().is_absorbing(state):
return True
if self.sub_problem == "side":
if self.has_hit:
- 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 is_absorbing
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def is_absorbing(self, state):
if super().is_absorbing(state):
return True
if self.sub_problem == "side":
if self.has_hit:
- 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 _assert_camera_params
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _assert_camera_params(self, camera_params):
"""
Asserts if the provided camera parameters are valid or not. Also, if
properties of some camera types are not specified, the default parameters
are used.
- 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 episode_start_vectorized
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def episode_start_vectorized(self, initial_states, episode_info, start_mask):
n_envs = len(start_mask)
if not isinstance(self.policy, VectorPolicy):
self.policy = VectorPolicy(self.policy, n_envs)
elif len(self.policy) != n_envs:
- 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 __init__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, horizon=None, gamma=0.99, wrappers=None, wrappers_args=None,
**env_args):
"""
Constructor.
- 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 __init__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, horizon=None, gamma=0.99, headless = False, wrappers=None, wrappers_args=None,
**env_args):
"""
Constructor.
- 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"