File: fix-syntax-warning.patch

package info (click to toggle)
python-hpilo 4.4.3-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,784 kB
  • sloc: python: 3,418; ruby: 467; makefile: 122; sh: 31
file content (38 lines) | stat: -rw-r--r-- 1,720 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From b2f3131b7e85d92a1b490dfebea662d2e02c9c1d Mon Sep 17 00:00:00 2001
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date: Mon, 8 Jul 2024 14:42:57 +0200
Subject: [PATCH] Mark strings with backslashes as raw strings

---
 hpilo.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/hpilo.py
+++ b/hpilo.py
@@ -201,7 +201,7 @@
         self.hponcfg = "/sbin/hponcfg"
         hponcfg = 'hponcfg'
         if platform.system() == 'Windows':
-            self.hponcfg = 'C:\Program Files\HP Lights-Out Configuration Utility\cpqlocfg.exe'
+            self.hponcfg = r'C:\Program Files\HP Lights-Out Configuration Utility\cpqlocfg.exe'
             hponcfg = 'cpqlocfg.exe'
         for path in os.environ.get('PATH','').split(os.pathsep):
             maybe = os.path.join(path, hponcfg)
@@ -333,7 +333,7 @@
             body = re.search('<body>(.*)</body>', data, flags=re.DOTALL).group(1)
             body = re.sub('<[^>]*>', '', body).strip()
             body = re.sub('Return to last page', '', body).strip()
-            body = re.sub('\s+', ' ', body).strip()
+            body = re.sub(r'\s+', ' ', body).strip()
             raise IloError(body)
         self.cookie = re.search('Set-Cookie: *(.*)', data).group(1)
         self._debug(2, "Cookie: %s" % self.cookie)
@@ -429,7 +429,7 @@
         if self.protocol != ILO_LOCAL:
             sock.write(self.XML_HEADER)
         if b'$EMBED' in xml:
-            pre, name, post = re.compile(b'(.*)\$EMBED:(.*)\$(.*)', re.DOTALL).match(xml).groups()
+            pre, name, post = re.compile(rb'(.*)\$EMBED:(.*)\$(.*)', re.DOTALL).match(xml).groups()
             sock.write(pre)
             sent = 0
             fwlen = os.path.getsize(name)