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

Daniel P. Berrange berrange at redhat.com
Tue Dec 3 16:36:43 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

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 at redhat.com>
---
 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




More information about the libvir-list mailing list