From e1cfad9f0bf253894c94fce35c9104946018d91d Mon Sep 17 00:00:00 2001 From: Timur Nurlygayanov Date: Tue, 25 Feb 2014 22:54:35 +0400 Subject: [PATCH] Fixed critical pylint warnings Fixed the following pylint warnings: W0231 W0621 W0621 Change-Id: I6d49a19f843ab2b63740199ef387e7e878fa030f Partial-Fixes: bug #1281164 --- mistral/api/controllers/v1/workbook.py | 6 +++--- mistral/context.py | 8 ++++---- mistral/dsl.py | 2 +- mistral/engine/scalable/executor/executor.py | 2 +- mistral/exceptions.py | 3 +++ 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mistral/api/controllers/v1/workbook.py b/mistral/api/controllers/v1/workbook.py index c7ac6f87e..74d4f6cab 100644 --- a/mistral/api/controllers/v1/workbook.py +++ b/mistral/api/controllers/v1/workbook.py @@ -89,7 +89,7 @@ class WorkbooksController(rest.RestController): def get_all(self): LOG.debug("Fetch workbooks.") - workbooks = [Workbook.from_dict(values) - for values in db_api.workbooks_get()] + workbooks_list = [Workbook.from_dict(values) + for values in db_api.workbooks_get()] - return Workbooks(workbooks=workbooks) + return Workbooks(workbooks=workbooks_list) diff --git a/mistral/context.py b/mistral/context.py index b03dcd260..c75977ff2 100644 --- a/mistral/context.py +++ b/mistral/context.py @@ -90,16 +90,16 @@ def set_ctx(new_ctx): utils.set_thread_local(_CTX_THREAD_LOCAL_NAME, new_ctx) -def _wrapper(ctx, thread_description, thread_group, func, *args, **kwargs): +def _wrapper(context, thread_desc, thread_group, func, *args, **kwargs): try: - set_ctx(ctx) + set_ctx(context) func(*args, **kwargs) except Exception as e: LOG.exception("Thread '%s' fails with exception: '%s'" - % (thread_description, e)) + % (thread_desc, e)) if thread_group and not thread_group.exc: thread_group.exc = e - thread_group.failed_thread = thread_description + thread_group.failed_thread = thread_desc finally: if thread_group: thread_group._on_thread_exit() diff --git a/mistral/dsl.py b/mistral/dsl.py index 390fa0d51..421df1354 100644 --- a/mistral/dsl.py +++ b/mistral/dsl.py @@ -54,7 +54,7 @@ class Parser(object): def get_tasks(self): tasks = self.doc.get("Workflow", {}).get("tasks", {}) - for task_name, task_dsl in tasks.iteritems(): + for _, task_dsl in tasks.iteritems(): task_dsl["service_name"] = task_dsl["action"].split(':')[0] req = task_dsl.get("requires") if req and isinstance(req, list): diff --git a/mistral/engine/scalable/executor/executor.py b/mistral/engine/scalable/executor/executor.py index 369be02f7..1a4fd6206 100644 --- a/mistral/engine/scalable/executor/executor.py +++ b/mistral/engine/scalable/executor/executor.py @@ -52,7 +52,7 @@ def do_task_action(task): action.run() -def handle_task_error(task, exc): +def handle_task_error(task, exception): try: db_api.start_tx() try: diff --git a/mistral/exceptions.py b/mistral/exceptions.py index 8d151153e..3b1533187 100644 --- a/mistral/exceptions.py +++ b/mistral/exceptions.py @@ -37,12 +37,14 @@ class MistralException(ex.Error): class DataAccessException(MistralException): def __init__(self, message=None): + super(DataAccessException, self).__init__(message) if message: self.message = message class InvalidActionException(MistralException): def __init__(self, message=None): + super(InvalidActionException, self).__init__(message) if message: self.message = message @@ -52,6 +54,7 @@ class DBDuplicateEntry(MistralException): code = "DB_DUPLICATE_ENTRY" def __init__(self, message=None): + super(DBDuplicateEntry, self).__init__(message) if message: self.message = message