Fix pylint errors

New pylint release catches 'consider-using-with' errors on some class
members. This new checker looks interesting for future errors but it is
not justified for the detected issues.

Change-Id: Iacf485f8d7ac61e79c3bc9073b40d0813c006745
This commit is contained in:
Gregory Thiemonge 2021-04-26 19:00:58 +02:00
parent 725e1c5313
commit 4e53676b2a
4 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,7 @@ class NetworkNamespace(object):
def __enter__(self): def __enter__(self):
# Save the current network namespace # Save the current network namespace
# pylint: disable=consider-using-with
self.current_netns_fd = open(self.current_netns) self.current_netns_fd = open(self.current_netns)
with open(self.target_netns) as fd: with open(self.target_netns) as fd:
self.set_netns(fd.fileno(), self.CLONE_NEWNET) self.set_netns(fd.fileno(), self.CLONE_NEWNET)

View File

@ -53,8 +53,10 @@ class UDPStatusGetter(object):
self.sock = None self.sock = None
self.update(self.key, self.ip, self.port) self.update(self.key, self.ip, self.port)
# pylint: disable=consider-using-with
self.health_executor = futures.ProcessPoolExecutor( self.health_executor = futures.ProcessPoolExecutor(
max_workers=CONF.health_manager.health_update_threads) max_workers=CONF.health_manager.health_update_threads)
# pylint: disable=consider-using-with
self.stats_executor = futures.ProcessPoolExecutor( self.stats_executor = futures.ProcessPoolExecutor(
max_workers=CONF.health_manager.stats_update_threads) max_workers=CONF.health_manager.stats_update_threads)
self.health_updater = UpdateHealthDb() self.health_updater = UpdateHealthDb()

View File

@ -57,6 +57,7 @@ class BaseTaskFlowEngine(object):
def __init__(self): def __init__(self):
# work around for https://bugs.python.org/issue7980 # work around for https://bugs.python.org/issue7980
datetime.datetime.strptime('2014-06-19 22:47:16', '%Y-%m-%d %H:%M:%S') datetime.datetime.strptime('2014-06-19 22:47:16', '%Y-%m-%d %H:%M:%S')
# pylint: disable=consider-using-with
self.executor = concurrent.futures.ThreadPoolExecutor( self.executor = concurrent.futures.ThreadPoolExecutor(
max_workers=CONF.task_flow.max_workers) max_workers=CONF.task_flow.max_workers)

View File

@ -63,6 +63,7 @@ class HealthManager(object):
else: else:
self.cw = cw1.ControllerWorker() self.cw = cw1.ControllerWorker()
self.threads = CONF.health_manager.failover_threads self.threads = CONF.health_manager.failover_threads
# pylint: disable=consider-using-with
self.executor = futures.ThreadPoolExecutor(max_workers=self.threads) self.executor = futures.ThreadPoolExecutor(max_workers=self.threads)
self.amp_repo = repo.AmphoraRepository() self.amp_repo = repo.AmphoraRepository()
self.amp_health_repo = repo.AmphoraHealthRepository() self.amp_health_repo = repo.AmphoraHealthRepository()