for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import numpy as np
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.
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:
def __init__(self, stage):
self.stage = stage
self.lower_bounds = np.asarray(self.stage.lower_bounds)
self.upper_bounds = np.asarray(self.stage.upper_bounds)
def set_initial_control_params(self):
random = np.random.rand(len(self.stage.control_params))
delta = self.upper_bounds - self.lower_bounds
control_params = self.lower_bounds + random * delta
self.stage.control_params = control_params.tolist()
def update_position(self, velocity):
self.stage.control_params = self.stage.control_params + velocity
self._fix_coordinates()
def _fix_coordinates(self):
for i in range(len(self.stage.control_params)):
if self.stage.control_params[i] > self.stage.upper_bounds[i]:
self.stage.control_params[i] = self.stage.upper_bounds[i]
elif self.stage.control_params[i] < self.stage.lower_bounds[i]:
self.stage.control_params[i] = self.stage.lower_bounds[i]
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.