[PATCH] casesmash.py: Removed compatibility warnings of Py3.
Sean Farley
sean at farley.io
Tue Mar 1 17:12:10 EST 2016
Pulkit Goyal <7895pulkit at gmail.com> writes:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1456870004 -19800
> # Wed Mar 02 03:36:44 2016 +0530
> # Node ID 31cedec0974f06ba10c0e40f8a36710b7d2ff5a3
> # Parent c7f89ad87baef87f00c507545dfd4cc824bc3131
> casesmash.py- Fixed import warnings raise due to compatibility to Py3
Thanks for the patch! As noted in (1):
https://www.mercurial-scm.org/wiki/ContributingChanges
This should be:
"casesmash: fixed import warnings raised due to compatibility with py3"
which is probably better written as:
"casesmash: use absolute_import"
> diff -r c7f89ad87bae -r 31cedec0974f contrib/casesmash.py
> --- a/contrib/casesmash.py Mon Feb 29 17:52:17 2016 -0600
> +++ b/contrib/casesmash.py Wed Mar 02 03:36:44 2016 +0530
> @@ -1,5 +1,9 @@
> -import os, __builtin__
> -from mercurial import util
> +from __future__ import absolute_import
> +import os
> +import __builtin__
> +from mercurial import (
> +util,
> +)
>
> def lowerwrap(scope, funcname):
> f = getattr(scope, funcname)
> diff -r c7f89ad87bae -r 31cedec0974f tests/test-check-py3-compat.t
> --- a/tests/test-check-py3-compat.t Mon Feb 29 17:52:17 2016 -0600
> +++ b/tests/test-check-py3-compat.t Wed Mar 02 03:36:44 2016 +0530
> @@ -3,7 +3,6 @@
> $ cd "$TESTDIR"/..
>
> $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python
> contrib/check-py3-compat.py
> - contrib/casesmash.py not using absolute_import
> contrib/check-code.py not using absolute_import
> contrib/check-code.py requires print_function
> contrib/check-config.py not using absolute_import
I haven't personally tested this but it looks sane to me.
More information about the Mercurial-devel
mailing list