]> thyrsus.com Git - ctopy.git/commitdiff
Translate null-argument methods correctly.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 4 Oct 2006 14:55:11 +0000 (14:55 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 4 Oct 2006 14:55:11 +0000 (14:55 +0000)
ctopy

diff --git a/ctopy b/ctopy
index d7dd7778f1a7031bfbfa5ddb4ef841c2ff7402ba..293eb69b74ab4ff59e2c0fe65885dc211720d10a 100755 (executable)
--- a/ctopy
+++ b/ctopy
@@ -736,8 +736,15 @@ def ctopy(input):
                             importlist.append(module)
                 for (fro, to, module) in methodmappings:
                     if re.search(r"\b" + fro + r"\b\(", regions[i]):
-                        regions[i] = re.sub(r"\b" + fro + r"\b\(([^,]*),\s*",
-                                            r"\1." + to + "(", regions[i])
+                        singlearg = r"\b"+fro+(r"\b\((%(exp)s)\)"%shorthands)
+                        if re.search(singlearg, regions[i]):
+                            regions[i] = re.sub(singlearg,
+                                                r"\1." + to +"()",
+                                                regions[i])
+                        else:
+                            regions[i] = re.sub(r"\b"+fro+r"\b\(([^,]*),\s*",
+                                                r"\1." + to + "(",
+                                                regions[i])
                         if module not in importlist:
                             importlist.append(module)
                 if debug >= 2: