for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Basic optimizer."""
from grortir.externals.pyswarm.pso import pso
from grortir.main.model.core.optimization_status import OptimizationStatus
from networkx import topological_sort
networkx
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 Optimizer(object):
"""Optimizer is object which optimize process."""
def __init__(self, process):
self.process = process
self.ordered_stages = topological_sort(self.process)
def set_custom_optimizing_order(self, ordered_stages):
"""Set custom order."""
if set(self.ordered_stages) == set(ordered_stages) and len(
self.ordered_stages) == len(ordered_stages):
self.ordered_stages = ordered_stages
else:
raise ValueError("List of stages must contain all stages.")
def optimize_process(self):
"""Optimize process.
Returns:
True if success, False otherwise."""
for stage in self.ordered_stages:
if len(self.process.predecessors(stage)) == 0:
pso(stage)
elif len(self.process.predecessors(stage)) == 1:
predecessor = self.process.predecessors(stage)[0]
stage.input_vector = predecessor.get_output_of_stage()
raise AttributeError('Incorrect process structure.')
if stage.optimization_status != OptimizationStatus.success:
return False
return True
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.