[PATCH] py3: make files use absolute_import and print_function

Yuya Nishihara yuya at tcha.org
Mon Jul 4 13:41:12 UTC 2016


On Sun, 03 Jul 2016 22:40:56 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1467565104 -19800
> #      Sun Jul 03 22:28:24 2016 +0530
> # Node ID d1d00ebd815da57194b22cbd5f7c09b9653e6074
> # Parent  3bd36647b893509dbc6efa2b4d439d833cc6debc
> py3: make files use absolute_import and print_function

Looks good, queued per Martijn's review, thanks.

> --- a/tests/md5sum.py	Sat Jul 02 02:52:15 2016 +0530
> +++ b/tests/md5sum.py	Sun Jul 03 22:28:24 2016 +0530
> @@ -6,12 +6,17 @@
>  # of the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, which is
>  # GPL-compatible.
>  
> -import sys, os
> +from __future__ import absolute_import
> +
> +import os
> +import sys
>  
>  try:
> -    from hashlib import md5
> +    import hashlib
> +    md5 = hashlib.md5
>  except ImportError:
> -    from md5 import md5
> +    import md5
> +    md5 = md5.md5

You can eliminate this conditional import. hashlib should be available on
Python 2.5+.



More information about the Mercurial-devel mailing list