summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorevasquez <eric.vasquez@calxeda.com>2013-08-27 09:50:27 -0500
committerevasquez <eric.vasquez@calxeda.com>2013-08-27 09:50:27 -0500
commitd1a1f42b1e725bcc6604912c688f7b38f65c02d6 (patch)
tree0902fdb9791265e0b6b1433967eb34690b695ec2
parent5e066057941ad399eaa252f96b783f7fe1ea0209 (diff)
downloadcxmanage-d1a1f42b1e725bcc6604912c688f7b38f65c02d6.tar.gz
nojira: pylint fixes
-rw-r--r--cxmanage_api/cx_exceptions.py10
-rw-r--r--cxmanage_api/firmware_package.py7
-rw-r--r--cxmanage_api/image.py10
-rw-r--r--cxmanage_api/simg.py6
-rw-r--r--cxmanage_api/tftp.py10
-rw-r--r--cxmanage_test/tftp_test.py13
6 files changed, 43 insertions, 13 deletions
diff --git a/cxmanage_api/cx_exceptions.py b/cxmanage_api/cx_exceptions.py
index 0cfa778..d924fe9 100644
--- a/cxmanage_api/cx_exceptions.py
+++ b/cxmanage_api/cx_exceptions.py
@@ -1,3 +1,6 @@
+"""Calxeda: cx_exceptions.py"""
+
+
# Copyright (c) 2012, Calxeda Inc.
#
# All rights reserved.
@@ -28,10 +31,10 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
-"""Defines the custom exceptions used by the cxmanage_api project."""
-from pyipmi import IpmiError
-from tftpy.TftpShared import TftpException
+#
+# Defines the custom exceptions used by the cxmanage_api project.
+#
class TimeoutError(Exception):
@@ -304,6 +307,7 @@ class CommandFailedError(Exception):
def __init__(self, results, errors):
"""Default constructor for the CommandFailedError class."""
+ super(CommandFailedError, self).__init__()
self.results = results
self.errors = errors
diff --git a/cxmanage_api/firmware_package.py b/cxmanage_api/firmware_package.py
index 433b596..0be4f07 100644
--- a/cxmanage_api/firmware_package.py
+++ b/cxmanage_api/firmware_package.py
@@ -1,3 +1,6 @@
+"""Calxeda: firmware_package.py"""
+
+
# Copyright (c) 2012, Calxeda Inc.
#
# All rights reserved.
@@ -38,7 +41,8 @@ from cxmanage_api import temp_dir
from cxmanage_api.image import Image
-class FirmwarePackage:
+# pylint: disable=R0903
+class FirmwarePackage(object):
"""A firmware update package contains multiple images & version information.
.. note::
@@ -54,6 +58,7 @@ class FirmwarePackage:
"""
+ # pylint: disable=R0912
def __init__(self, filename=None):
"""Default constructor for the FirmwarePackage class."""
self.images = []
diff --git a/cxmanage_api/image.py b/cxmanage_api/image.py
index 87b73a0..a6456d4 100644
--- a/cxmanage_api/image.py
+++ b/cxmanage_api/image.py
@@ -1,3 +1,6 @@
+"""Calxeda: image.py"""
+
+
# Copyright (c) 2012, Calxeda Inc.
#
# All rights reserved.
@@ -38,7 +41,7 @@ from cxmanage_api.simg import valid_simg, get_simg_contents
from cxmanage_api.cx_exceptions import InvalidImageError
-class Image:
+class Image(object):
"""An Image consists of: an image type, a filename, and SIMG header info.
>>> from cxmanage_api.image import Image
@@ -62,6 +65,7 @@ class Image:
"""
+ # pylint: disable=R0913
def __init__(self, filename, image_type, simg=None, daddr=None,
skip_crc32=False, version=None):
"""Default constructor for the Image class."""
@@ -114,8 +118,8 @@ class Image:
skip_crc32=self.skip_crc32, align=align,
version=self.version)
filename = temp_file()
- with open(filename, "w") as f:
- f.write(simg)
+ with open(filename, "w") as file_:
+ file_.write(simg)
# Make sure the simg was built correctly
if (not valid_simg(open(filename).read())):
diff --git a/cxmanage_api/simg.py b/cxmanage_api/simg.py
index 6ae8bf8..d8901b8 100644
--- a/cxmanage_api/simg.py
+++ b/cxmanage_api/simg.py
@@ -1,3 +1,6 @@
+"""Calxeda: simg.py"""
+
+
# Copyright (c) 2012, Calxeda Inc.
#
# All rights reserved.
@@ -38,7 +41,8 @@ HEADER_LENGTH = 60
MIN_HEADER_LENGTH = 28
-class SIMGHeader:
+# pylint: disable=R0913, R0903, R0902
+class SIMGHeader(object):
"""Container for an SIMG header.
>>> from cxmanage_api.simg import SIMGHeader
diff --git a/cxmanage_api/tftp.py b/cxmanage_api/tftp.py
index 5bfc3dc..0b33db8 100644
--- a/cxmanage_api/tftp.py
+++ b/cxmanage_api/tftp.py
@@ -1,3 +1,6 @@
+"""Calxeda: tftp.py"""
+
+
# Copyright (c) 2012, Calxeda Inc.
#
# All rights reserved.
@@ -41,7 +44,8 @@ from tftpy.TftpShared import TftpException
class InternalTftp(Thread):
- """Internally serves files using the `Trivial File Transfer Protocol <http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol>`_.
+ """Internally serves files using the `Trivial File Transfer Protocol \
+<http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol>`_.
>>> # Typical instantiation ...
>>> from cxmanage_api.tftp import InternalTftp
@@ -113,7 +117,7 @@ class InternalTftp(Thread):
:param src: Source file path on the tftp_server.
:type src: string
- :param dest: Destination path (on your machine) to copy the TFTP file to.
+ :param dest: Destination path (local machine) to copy the TFTP file to.
:type dest: string
"""
@@ -182,7 +186,7 @@ class ExternalTftp(object):
>>> e_tftp.get_address()
'1.2.3.4'
- :param relative_host: Unused parameter present only for function signature.
+ :param relative_host: Unused parameter, for function signature.
:type relative_host: None
:returns: The ip address of the external TFTP server.
diff --git a/cxmanage_test/tftp_test.py b/cxmanage_test/tftp_test.py
index 784211a..94d9e38 100644
--- a/cxmanage_test/tftp_test.py
+++ b/cxmanage_test/tftp_test.py
@@ -1,3 +1,6 @@
+"""Calxeda: tftp_test.py"""
+
+
# Copyright (c) 2012, Calxeda Inc.
#
# All rights reserved.
@@ -27,7 +30,11 @@
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
-"""Unit tests for the Internal and External Tftp classes."""
+
+
+#
+# Unit tests for the Internal and External Tftp classes.
+#
import os
@@ -51,6 +58,7 @@ def _get_relative_host():
except socket.error:
raise
+# pylint: disable=R0904
class InternalTftpTest(unittest.TestCase):
""" Tests the functions of the InternalTftp class."""
@@ -79,7 +87,7 @@ class InternalTftpTest(unittest.TestCase):
self.assertEqual(open(filename).read(), contents)
os.remove(filename)
- def test_get_address_with_relative_host(self):
+ def test_get_address_with_relhost(self):
"""Tests the get_address(relative_host) function with a relative_host
specified.
"""
@@ -97,6 +105,7 @@ class InternalTftpTest(unittest.TestCase):
sock.close()
+# pylint: disable=R0904
class ExternalTftpTest(unittest.TestCase):
"""Tests the ExternalTftp class.
..note: