[PATCH 3 of 8 v3] perf: use absolute_import

Augie Fackler raf at durin42.com
Mon Mar 14 14:11:24 EDT 2016


On Mon, Mar 14, 2016 at 09:45:36AM -0500, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1457813658 -19800
> #      Sun Mar 13 01:44:18 2016 +0530
> # Node ID 4ff7ff1ffccd2ff4286235775033bf859ff7b1b3
> # Parent  1973c5b13db4b73f83c4d801004ad2676a5487e5
> perf: use absolute_import
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -1,12 +1,26 @@
>  # perf.py - performance test routines
>  '''helper extension to measure performance'''
>
> -from mercurial import cmdutil, scmutil, util, commands, obsolete
> -from mercurial import repoview, branchmap, merge, copies, error, revlog
> -from mercurial import mdiff
> -import time, os, sys
> +from __future__ import absolute_import
> +import functools
> +import os
>  import random
> -import functools
> +import sys
> +import time
> +from mercurial import (
> +branchmap,

If you look around, you'll notice that we generally indent the items
inside the imported tuple. Take a look at hgext/shelve.py for a
randomly-chosen example.

> +cmdutil,
> +commands,
> +copies,
> +error,
> +mdiff,
> +merge,
> +obsolete,
> +repoview,
> +revlog,
> +scmutil,
> +util,
> +)
>
>  formatteropts = commands.formatteropts
>  revlogopts = commands.debugrevlogopts
> diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
> --- a/tests/test-check-py3-compat.t
> +++ b/tests/test-check-py3-compat.t
> @@ -5,7 +5,6 @@
>    $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
>    contrib/import-checker.py not using absolute_import
>    contrib/import-checker.py requires print_function
> -  contrib/perf.py not using absolute_import
>    contrib/python-hook-examples.py not using absolute_import
>    contrib/revsetbenchmarks.py not using absolute_import
>    contrib/revsetbenchmarks.py requires print_function
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list