[PATCH 1 of 3 RFC] current failings for "redefinition of function"

Matt Mackall mpm at selenic.com
Tue May 3 15:44:32 CDT 2011


On Sun, 2011-05-01 at 14:17 -0500, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1304276315 -7200
> # Node ID 43e7814696adbe3e32cba0f2f6b479b8ac43a638
> # Parent  d04a2cd57b76603b18c2c0058acf68e3b27e197e
> current failings for "redefinition of function"
> 
> diff --git a/tests/filterpyflakes.py b/tests/filterpyflakes.py
> --- a/tests/filterpyflakes.py
> +++ b/tests/filterpyflakes.py
> @@ -22,6 +22,7 @@ for line in sys.stdin:
>              r"imported but unused",
>              r"local variable '.*' is assigned to but never used",
>              r"unable to detect undefined names",
> +            r"redefinition of function",
>             ]
>      if not re.search('|'.join(pats), line):
>          continue
> diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
> --- a/tests/test-check-pyflakes.t
> +++ b/tests/test-check-pyflakes.t
> @@ -11,5 +11,23 @@
>    mercurial/util.py:*: 'from posix import *' used; unable to detect undefined names (glob)
>    mercurial/windows.py:*: 'from win32 import *' used; unable to detect undefined names (glob)
>    mercurial/util.py:*: 'from windows import *' used; unable to detect undefined names (glob)
> +  mercurial/commands.py:*: redefinition of function 'events' from line * (glob)
> +  mercurial/dirstate.py:*: redefinition of function 'f' from line * (glob)
> +  mercurial/dirstate.py:*: redefinition of function 'f' from line * (glob)
> +  mercurial/util.py:*: redefinition of function 'f' from line * (glob)
> +  mercurial/util.py:*: redefinition of function 'f' from line * (glob)
> +  mercurial/util.py:*: redefinition of function 'fakebuffer' from line * (glob)
> +  mercurial/dispatch.py:*: redefinition of function 'fn' from line * (glob)
> +  mercurial/dispatch.py:*: redefinition of function 'fn' from line * (glob)
> +  mercurial/dispatch.py:*: redefinition of function 'fn' from line * (glob)
> +  mercurial/dispatch.py:*: redefinition of function 'fn' from line * (glob)
> +  hgext/churn.py:*: redefinition of function 'format' from line * (glob)
> +  mercurial/changegroup.py:*: redefinition of function 'generator' from line * (glob)
> +  hgext/inotify/server.py:*: redefinition of function 'genresult' from line * (glob)
> +  hgext/churn.py:*: redefinition of function 'getkey' from line * (glob)
> +  hgext/convert/git.py:*: redefinition of function 'gitopen' from line * (glob)
> +  mercurial/scmutil.py:*: redefinition of function 'system_rcpath' from line * (glob)
> +  mercurial/scmutil.py:*: redefinition of function 'user_rcpath' from line * (glob)
> +  mercurial/cmdutil.py:*: redefinition of function 'want' from line * (glob)

On reflection, I think this one is too aggressive.

Most of these are things of the form:

if expr:
  def fn():
    ...
else:
  def fn():
    ...

foo(fn)

..and I frankly feel that's a perfectly reasonable way to do things.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list