Get rid of pylint E0203 in filter_scheduler.py

by refactoring

Change-Id: I0b39293e7a7bb2154a6121ea8cdda8454dff2184
This commit is contained in:
Arata Notsu
2012-11-10 11:11:45 +09:00
parent 910a548735
commit d993d947c7

View File

@@ -39,6 +39,7 @@ class FilterScheduler(driver.Scheduler):
"""Scheduler that can be used for filtering and weighing."""
def __init__(self, *args, **kwargs):
super(FilterScheduler, self).__init__(*args, **kwargs)
self.cost_function_cache = None
self.options = scheduler_options.SchedulerOptions()
def schedule_run_instance(self, context, request_spec,
@@ -294,7 +295,7 @@ class FilterScheduler(driver.Scheduler):
"""Returns a list of tuples containing weights and cost functions to
use for weighing hosts
"""
if getattr(self, 'cost_function_cache', None) is not None:
if self.cost_function_cache is not None:
return self.cost_function_cache
cost_fns = []