Fix strings invalid with newer lint versions
authorMichele Tartara <mtartara@google.com>
Tue, 17 Sep 2013 15:33:48 +0000 (15:33 +0000)
committerMichele Tartara <mtartara@google.com>
Wed, 18 Sep 2013 10:29:00 +0000 (12:29 +0200)
Generating ASCII characters via a supported but not official escape sequence
leads to a "Anomalous backslash in string" error in newer pylint versions. This
patch fixes the issue.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

lib/constants.py
lib/daemon.py
lib/utils/__init__.py
tools/lvmstrap

index b41d870..939a729 100644 (file)
@@ -232,7 +232,7 @@ DEV_CONSOLE = "/dev/console"
 PROC_MOUNTS = "/proc/mounts"
 
 # Local UniX Interface related constants
-LUXI_EOM = "\3"
+LUXI_EOM = chr(3)
 LUXI_VERSION = CONFIG_VERSION
 #: Environment variable for the luxi override socket
 LUXI_OVERRIDE = "FORCE_LUXI_SOCKET"
index 0ef1f6e..a5cc182 100644 (file)
@@ -454,7 +454,7 @@ class AsyncAwaker(GanetiBaseAsyncoreDispatcher):
     # sending more than one wakeup token, which doesn't harm at all.
     if self.need_signal:
       self.need_signal = False
-      self.out_socket.send("\0")
+      self.out_socket.send(chr(0))
 
 
 class _ShutdownCheck:
index 48f1b15..8ca7a88 100644 (file)
@@ -672,7 +672,7 @@ class SignalWakeupFd(object):
     """Notifies the wakeup file descriptor.
 
     """
-    self._write_fh.write("\0")
+    self._write_fh.write(chr(0))
 
   def __del__(self):
     """Called before object deletion.
index b79dc11..47a710f 100755 (executable)
@@ -710,7 +710,7 @@ def WipeDisk(name):
     raise OperationalError("CRITICAL: Can't read partition table information"
                            " from /dev/%s (needed 512 bytes, got %d" %
                            (name, len(olddata)))
-  newdata = "\0" * 512
+  newdata = chr(0) * 512
   os.lseek(fd, 0, 0)
   bytes_written = os.write(fd, newdata)
   os.close(fd)