[PATCH python 07/15] generator: Remove use of string.replace and string.find functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Call the 'replace' and 'find' functions directly on the
string variables, instead of via the 'string' module.
Python3 only accepts the latter syntax

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 generator.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/generator.py b/generator.py
index 9f4b76b..af05d7c 100755
--- a/generator.py
+++ b/generator.py
@@ -1186,15 +1186,15 @@ def writeDoc(module, name, args, indent, output):
      if funcs[name][0] is None or funcs[name][0] == "":
          return
      val = funcs[name][0]
-     val = string.replace(val, "NULL", "None")
+     val = val.replace("NULL", "None")
      output.write(indent)
      output.write('"""')
-     i = string.find(val, "\n")
+     i = val.find("\n")
      while i >= 0:
          str = val[0:i+1]
          val = val[i+1:]
          output.write(str)
-         i = string.find(val, "\n")
+         i = val.find("\n")
          output.write(indent)
      output.write(val)
      output.write(' """\n')
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]