for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Contain mechanism for changing position."""
import numpy as np
numpy
This can be caused by one of the following:
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
# .scrutinizer.yml before_commands: - sudo pip install abc # Python2 - sudo pip3 install abc # Python3
This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.
__init__.py
class PositionUpdater:
"""Class responsible for moving objects.
Attributes:
stage (AbstractStage): Stage in which we are going to move.
control_params (dict): Control params for stages.
"""
def __init__(self, control_params):
self.control_params = control_params
@staticmethod
def set_initial_control_params(control_params):
"""Set initial positions."""
for stage in control_params:
random = np.random.rand(len(control_params[stage]))
delta = np.asarray(stage.upper_bounds) - np.asarray(
stage.lower_bounds)
new_control_params = np.asarray(stage.lower_bounds) + random * delta
control_params[stage] = new_control_params.tolist()
return control_params
def update_position(self, velocities, control_params):
"""Update positions."""
for stage in velocities:
new_control_params = np.asarray(control_params[stage]) + np.asarray(
velocities[stage])
control_params[stage] = self._fix_coordinates(stage,
new_control_params) \
.tolist()
def _fix_coordinates(stage, control_params):
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
for index, single_param in enumerate(control_params):
if single_param > stage.upper_bounds[index]:
control_params[index] = stage.upper_bounds[index]
elif single_param < stage.lower_bounds[index]:
control_params[index] = stage.lower_bounds[index]
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.