Fixed critical pylint warnings

Fixed the following pylint warnings:
   W0231
   W0621
   W0621

Change-Id: I6d49a19f843ab2b63740199ef387e7e878fa030f
Partial-Fixes: bug #1281164
This commit is contained in:
Timur Nurlygayanov 2014-02-25 22:54:35 +04:00
parent b3c23b7e1b
commit e1cfad9f0b
5 changed files with 12 additions and 9 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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):

View File

@ -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:

View File

@ -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