From 20601361bcd12c60edad4fba280265f0a4bdb114 Mon Sep 17 00:00:00 2001 From: Luca Bigliardi <shammash@google.com> Date: Thu, 13 May 2010 16:49:35 +0100 Subject: [PATCH] Fix some pylint warnings Disable warnings for: - except Exception, - use of __errno_location, - redeclaration of handleError() Signed-off-by: Luca Bigliardi <shammash@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/backend.py | 2 +- lib/utils.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index 10b08a277..18cf4c40e 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -2678,7 +2678,7 @@ def PowercycleNode(hypervisor_type): # ensure the child is running on ram try: utils.Mlockall() - except Exception: + except Exception: # pylint: disable-msg=W0703 pass time.sleep(5) hyper.PowercycleNode() diff --git a/lib/utils.py b/lib/utils.py index cdb02bf77..c1d5c6fbe 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -1769,9 +1769,11 @@ def Mlockall(): # By declaring this variable as a pointer to an integer we can then access # its value correctly, should the mlockall call fail, in order to see what # the actual error code was. + # pylint: disable-msg=W0212 libc.__errno_location.restype = ctypes.POINTER(ctypes.c_int) if libc.mlockall(_MCL_CURRENT | _MCL_FUTURE): + # pylint: disable-msg=W0212 logging.error("Cannot set memory lock: %s", os.strerror(libc.__errno_location().contents.value)) return @@ -2084,7 +2086,7 @@ class LogFileHandler(logging.FileHandler): logging.FileHandler.__init__(self, filename, mode, encoding) self.console = open(constants.DEV_CONSOLE, "a") - def handleError(self, record): + def handleError(self, record): # pylint: disable-msg=C0103 """Handle errors which occur during an emit() call. Try to handle errors with FileHandler method, if it fails write to @@ -2093,10 +2095,10 @@ class LogFileHandler(logging.FileHandler): """ try: logging.FileHandler.handleError(self, record) - except Exception: + except Exception: # pylint: disable-msg=W0703 try: self.console.write("Cannot log message:\n%s\n" % self.format(record)) - except Exception: + except Exception: # pylint: disable-msg=W0703 # Log handler tried everything it could, now just give up pass -- GitLab