[cedar-backup-svn] SF.net SVN: cedar-backup:[1023] cedar-backup2/trunk
Brought to you by:
pronovic
|
From: <pro...@us...> - 2011-10-11 23:44:57
|
Revision: 1023
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=1023&view=rev
Author: pronovic
Date: 2011-10-11 23:44:50 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Handle Pylint warnings
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/extend/split.py
cedar-backup2/trunk/CedarBackup2/testutil.py
cedar-backup2/trunk/CedarBackup2/util.py
cedar-backup2/trunk/testcase/utiltests.py
cedar-backup2/trunk/testcase/writersutiltests.py
Modified: cedar-backup2/trunk/CedarBackup2/extend/split.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/extend/split.py 2011-10-11 23:27:49 UTC (rev 1022)
+++ cedar-backup2/trunk/CedarBackup2/extend/split.py 2011-10-11 23:44:50 UTC (rev 1023)
@@ -475,7 +475,7 @@
dirname = os.path.dirname(sourcePath)
filename = os.path.basename(sourcePath)
prefix = "%s_" % filename
- bytes = int(splitSize.bytes)
+ bytes = int(splitSize.bytes) # pylint: disable=W0622
os.chdir(dirname) # need to operate from directory that we want files written to
command = resolveCommand(SPLIT_COMMAND)
args = [ "--verbose", "--numeric-suffixes", "--suffix-length=5", "--bytes=%d" % bytes, filename, prefix, ]
Modified: cedar-backup2/trunk/CedarBackup2/testutil.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/testutil.py 2011-10-11 23:27:49 UTC (rev 1022)
+++ cedar-backup2/trunk/CedarBackup2/testutil.py 2011-10-11 23:44:50 UTC (rev 1023)
@@ -369,7 +369,8 @@
exec "obj.%s = value" % prop # pylint: disable=W0122
missed = True
except exception: pass
- except Exception, e: instead = e
+ except Exception, e:
+ instead = e
if missed:
testCase.fail("Expected assignment to raise %s, but got no exception." % (exception.__name__))
if instead is not None:
Modified: cedar-backup2/trunk/CedarBackup2/util.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/util.py 2011-10-11 23:27:49 UTC (rev 1022)
+++ cedar-backup2/trunk/CedarBackup2/util.py 2011-10-11 23:44:50 UTC (rev 1023)
@@ -1134,7 +1134,7 @@
# displayBytes() function
##########################
-def displayBytes(bytes, digits=2):
+def displayBytes(bytes, digits=2): # pylint: disable=W0622
"""
Format a byte quantity so it can be sensibly displayed.
@@ -1167,18 +1167,18 @@
raise ValueError("Cannot display byte value of None.")
bytes = float(bytes)
if math.fabs(bytes) < BYTES_PER_KBYTE:
- format = "%.0f bytes"
+ fmt = "%.0f bytes"
value = bytes
elif math.fabs(bytes) < BYTES_PER_MBYTE:
- format = "%." + "%d" % digits + "f kB"
+ fmt = "%." + "%d" % digits + "f kB"
value = bytes / BYTES_PER_KBYTE
elif math.fabs(bytes) < BYTES_PER_GBYTE:
- format = "%." + "%d" % digits + "f MB"
+ fmt = "%." + "%d" % digits + "f MB"
value = bytes / BYTES_PER_MBYTE
else:
- format = "%." + "%d" % digits + "f GB"
+ fmt = "%." + "%d" % digits + "f GB"
value = bytes / BYTES_PER_GBYTE
- return format % value
+ return fmt % value
##################################
Modified: cedar-backup2/trunk/testcase/utiltests.py
===================================================================
--- cedar-backup2/trunk/testcase/utiltests.py 2011-10-11 23:27:49 UTC (rev 1022)
+++ cedar-backup2/trunk/testcase/utiltests.py 2011-10-11 23:44:50 UTC (rev 1023)
@@ -3534,7 +3534,7 @@
"""
Test display for a positive value < 1 KB
"""
- bytes = 12
+ bytes = 12 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("12 bytes", result)
result = displayBytes(bytes, 3)
@@ -3544,7 +3544,7 @@
"""
Test display for a negative value < 1 KB
"""
- bytes = -12
+ bytes = -12 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("-12 bytes", result)
result = displayBytes(bytes, 3)
@@ -3554,7 +3554,7 @@
"""
Test display for a positive value = 1kB
"""
- bytes = 1024
+ bytes = 1024 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("1.00 kB", result)
result = displayBytes(bytes, 3)
@@ -3564,7 +3564,7 @@
"""
Test display for a positive value >= 1kB
"""
- bytes = 5678
+ bytes = 5678 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("5.54 kB", result)
result = displayBytes(bytes, 3)
@@ -3574,7 +3574,7 @@
"""
Test display for a negative value >= 1kB
"""
- bytes = -5678
+ bytes = -5678 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("-5.54 kB", result)
result = displayBytes(bytes, 3)
@@ -3584,7 +3584,7 @@
"""
Test display for a positive value = 1MB
"""
- bytes = 1024.0 * 1024.0
+ bytes = 1024.0 * 1024.0 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("1.00 MB", result)
result = displayBytes(bytes, 3)
@@ -3594,7 +3594,7 @@
"""
Test display for a positive value >= 1MB
"""
- bytes = 72372224
+ bytes = 72372224 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("69.02 MB", result)
result = displayBytes(bytes, 3)
@@ -3604,7 +3604,7 @@
"""
Test display for a negative value >= 1MB
"""
- bytes = -72372224.0
+ bytes = -72372224.0 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("-69.02 MB", result)
result = displayBytes(bytes, 3)
@@ -3614,7 +3614,7 @@
"""
Test display for a positive value = 1GB
"""
- bytes = 1024.0 * 1024.0 * 1024.0
+ bytes = 1024.0 * 1024.0 * 1024.0 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("1.00 GB", result)
result = displayBytes(bytes, 3)
@@ -3624,7 +3624,7 @@
"""
Test display for a positive value >= 1GB
"""
- bytes = 4.4 * 1024.0 * 1024.0 * 1024.0
+ bytes = 4.4 * 1024.0 * 1024.0 * 1024.0 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("4.40 GB", result)
result = displayBytes(bytes, 3)
@@ -3634,7 +3634,7 @@
"""
Test display for a negative value >= 1GB
"""
- bytes = -1234567891011
+ bytes = -1234567891011 # pylint: disable=W0622
result = displayBytes(bytes)
self.failUnlessEqual("-1149.78 GB", result)
result = displayBytes(bytes, 3)
@@ -3644,14 +3644,14 @@
"""
Test display with an invalid quantity (None).
"""
- bytes = None
+ bytes = None # pylint: disable=W0622
self.failUnlessRaises(ValueError, displayBytes, bytes)
def testDisplayBytes_013(self):
"""
Test display with an invalid quantity (not a floating point).
"""
- bytes = "ken"
+ bytes = "ken" # pylint: disable=W0622
self.failUnlessRaises(ValueError, displayBytes, bytes)
Modified: cedar-backup2/trunk/testcase/writersutiltests.py
===================================================================
--- cedar-backup2/trunk/testcase/writersutiltests.py 2011-10-11 23:27:49 UTC (rev 1022)
+++ cedar-backup2/trunk/testcase/writersutiltests.py 2011-10-11 23:44:50 UTC (rev 1023)
@@ -503,21 +503,21 @@
have complete control over the mounting and unmounting process. So, for
these tests to work, we need to disable GNOME auto-mounting.
"""
- self.orig_media_automount = None
- self.orig_media_automount_open = None
+ self.origMediaAutomount = None
+ self.origMediaAutomountOpen = None
if runAllTests():
args = [ "--get", "/apps/nautilus/preferences/media_automount", ]
(result, output) = executeCommand(GCONF_CMD, args, returnOutput=True)
if result == 0:
- self.orig_media_automount = output[0][:-1]
- if self.orig_media_automount == "true":
+ self.origMediaAutomount = output[0][:-1] # pylint: disable=W0201
+ if self.origMediaAutomount == "true":
args = [ "--type", "bool", "--set", "/apps/nautilus/preferences/media_automount", "false", ]
executeCommand(GCONF_CMD, args)
args = [ "--get", "/apps/nautilus/preferences/media_automount_open", ]
(result, output) = executeCommand(GCONF_CMD, args, returnOutput=True)
if result == 0:
- self.orig_media_automount_open = output[0][:-1] # should be either "true" or "false"
- if self.orig_media_automount_open == "true":
+ self.origMediaAutomountOpen = output[0][:-1] # pylint: disable=W0201
+ if self.origMediaAutomountOpen == "true":
args = [ "--type", "bool", "--set", "/apps/nautilus/preferences/media_automount_open", "false", ]
executeCommand(GCONF_CMD, args)
@@ -525,10 +525,10 @@
"""
Resets GNOME auto-mounting options back to their state prior to disableGnomeAutomount().
"""
- if self.orig_media_automount == "true":
+ if self.origMediaAutomount == "true":
args = [ "--type", "bool", "--set", "/apps/nautilus/preferences/media_automount", "true", ]
executeCommand(GCONF_CMD, args)
- if self.orig_media_automount_open == "true":
+ if self.origMediaAutomountOpen == "true":
args = [ "--type", "bool", "--set", "/apps/nautilus/preferences/media_automount_open", "true", ]
executeCommand(GCONF_CMD, args)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|