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): def get_all(self):
LOG.debug("Fetch workbooks.") LOG.debug("Fetch workbooks.")
workbooks = [Workbook.from_dict(values) workbooks_list = [Workbook.from_dict(values)
for values in db_api.workbooks_get()] 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) 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: try:
set_ctx(ctx) set_ctx(context)
func(*args, **kwargs) func(*args, **kwargs)
except Exception as e: except Exception as e:
LOG.exception("Thread '%s' fails with exception: '%s'" LOG.exception("Thread '%s' fails with exception: '%s'"
% (thread_description, e)) % (thread_desc, e))
if thread_group and not thread_group.exc: if thread_group and not thread_group.exc:
thread_group.exc = e thread_group.exc = e
thread_group.failed_thread = thread_description thread_group.failed_thread = thread_desc
finally: finally:
if thread_group: if thread_group:
thread_group._on_thread_exit() thread_group._on_thread_exit()

View File

@ -54,7 +54,7 @@ class Parser(object):
def get_tasks(self): def get_tasks(self):
tasks = self.doc.get("Workflow", {}).get("tasks", {}) 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] task_dsl["service_name"] = task_dsl["action"].split(':')[0]
req = task_dsl.get("requires") req = task_dsl.get("requires")
if req and isinstance(req, list): if req and isinstance(req, list):

View File

@ -52,7 +52,7 @@ def do_task_action(task):
action.run() action.run()
def handle_task_error(task, exc): def handle_task_error(task, exception):
try: try:
db_api.start_tx() db_api.start_tx()
try: try:

View File

@ -37,12 +37,14 @@ class MistralException(ex.Error):
class DataAccessException(MistralException): class DataAccessException(MistralException):
def __init__(self, message=None): def __init__(self, message=None):
super(DataAccessException, self).__init__(message)
if message: if message:
self.message = message self.message = message
class InvalidActionException(MistralException): class InvalidActionException(MistralException):
def __init__(self, message=None): def __init__(self, message=None):
super(InvalidActionException, self).__init__(message)
if message: if message:
self.message = message self.message = message
@ -52,6 +54,7 @@ class DBDuplicateEntry(MistralException):
code = "DB_DUPLICATE_ENTRY" code = "DB_DUPLICATE_ENTRY"
def __init__(self, message=None): def __init__(self, message=None):
super(DBDuplicateEntry, self).__init__(message)
if message: if message:
self.message = message self.message = message