From: Eric S. Raymond Date: Wed, 4 Oct 2006 14:55:11 +0000 (+0000) Subject: Translate null-argument methods correctly. X-Git-Tag: 1.0~22 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=8eee78b9ab15148e7243b65e2487dba4c4c74e9e;p=ctopy.git Translate null-argument methods correctly. --- diff --git a/ctopy b/ctopy index d7dd777..293eb69 100755 --- 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: