Patchwork check-code: permit functools.reduce

login
register
mail settings
Submitter Yedidya Feldblum
Date Feb. 6, 2017, 10:22 p.m.
Message ID <47d8e895ccb734f0219d.1486419758@devbig326.prn1.facebook.com>
Download mbox | patch
Permalink /patch/18336/
State Accepted
Headers show

Comments

Yedidya Feldblum - Feb. 6, 2017, 10:22 p.m.
# HG changeset patch
# User Yedidya Feldblum <yfeldblum@fb.com>
# Date 1485038593 28800
#      Sat Jan 21 14:43:13 2017 -0800
# Node ID 47d8e895ccb734f0219dd046795b042da002b06b
# Parent  036c37bd3ec189480647ff568cee9e0b43a5bc81
check-code: permit functools.reduce
Sean Farley - Feb. 6, 2017, 11:57 p.m.
Yedidya Feldblum <yfeldblum@fb.com> writes:

> # HG changeset patch
> # User Yedidya Feldblum <yfeldblum@fb.com>
> # Date 1485038593 28800
> #      Sat Jan 21 14:43:13 2017 -0800
> # Node ID 47d8e895ccb734f0219dd046795b042da002b06b
> # Parent  036c37bd3ec189480647ff568cee9e0b43a5bc81
> check-code: permit functools.reduce

I guess? Maybe Augie should look at this, though.
Sean Farley - Feb. 7, 2017, midnight
Sean Farley <sean@farley.io> writes:

> Yedidya Feldblum <yfeldblum@fb.com> writes:
>
>> # HG changeset patch
>> # User Yedidya Feldblum <yfeldblum@fb.com>
>> # Date 1485038593 28800
>> #      Sat Jan 21 14:43:13 2017 -0800
>> # Node ID 47d8e895ccb734f0219dd046795b042da002b06b
>> # Parent  036c37bd3ec189480647ff568cee9e0b43a5bc81
>> check-code: permit functools.reduce
>
> I guess? Maybe Augie should look at this, though.

Sorry, this 'I guess' was more of me not understanding functools /
Python 3. Your part of the code looks fine :-)
Augie Fackler - Feb. 7, 2017, 5:23 a.m.
> On Feb 6, 2017, at 17:22, Yedidya Feldblum <yfeldblum@fb.com> wrote:
> 
> # HG changeset patch
> # User Yedidya Feldblum <yfeldblum@fb.com>
> # Date 1485038593 28800
> #      Sat Jan 21 14:43:13 2017 -0800
> # Node ID 47d8e895ccb734f0219dd046795b042da002b06b
> # Parent  036c37bd3ec189480647ff568cee9e0b43a5bc81
> check-code: permit functools.reduce

Sure, queued.


> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -237,7 +237,7 @@
>     (r'lambda\s*\(.*,.*\)',
>      "tuple parameter unpacking not available in Python 3+"),
>     (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
> -    (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
> +    (r'(?<!\.)\breduce\s*\(.*', "reduce is not available in Python 3+"),
>     (r'\bdict\(.*=', 'dict() is different in Py2 and 3 and is slower than {}',
>      'dict-from-generator'),
>     (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -237,7 +237,7 @@ 
     (r'lambda\s*\(.*,.*\)',
      "tuple parameter unpacking not available in Python 3+"),
     (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
-    (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
+    (r'(?<!\.)\breduce\s*\(.*', "reduce is not available in Python 3+"),
     (r'\bdict\(.*=', 'dict() is different in Py2 and 3 and is slower than {}',
      'dict-from-generator'),
     (r'\.has_key\b', "dict.has_key is not available in Python 3+"),