Patchwork D3264: futures: switch to absolute and relative imports

login
register
mail settings
Submitter phabricator
Date April 11, 2018, 11:43 p.m.
Message ID <differential-rev-PHID-DREV-c4dw56trlttnc45jincx-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30758/
State Superseded
Headers show

Comments

phabricator - April 11, 2018, 11:43 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This makes the package conform with our importing policy,
  silencing a number of warnings. It also makes the package usable
  when it isn't named "concurrent.futures."

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3264

AFFECTED FILES
  mercurial/thirdparty/concurrent/futures/__init__.py
  mercurial/thirdparty/concurrent/futures/_base.py
  mercurial/thirdparty/concurrent/futures/process.py
  mercurial/thirdparty/concurrent/futures/thread.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/thirdparty/concurrent/futures/thread.py b/mercurial/thirdparty/concurrent/futures/thread.py
--- a/mercurial/thirdparty/concurrent/futures/thread.py
+++ b/mercurial/thirdparty/concurrent/futures/thread.py
@@ -3,8 +3,10 @@ 
 
 """Implements ThreadPoolExecutor."""
 
+from __future__ import absolute_import
+
 import atexit
-from concurrent.futures import _base
+from . import _base
 import itertools
 import Queue as queue
 import threading
diff --git a/mercurial/thirdparty/concurrent/futures/process.py b/mercurial/thirdparty/concurrent/futures/process.py
--- a/mercurial/thirdparty/concurrent/futures/process.py
+++ b/mercurial/thirdparty/concurrent/futures/process.py
@@ -43,8 +43,10 @@ 
   _ResultItems in "Request Q"
 """
 
+from __future__ import absolute_import
+
 import atexit
-from concurrent.futures import _base
+from . import _base
 import Queue as queue
 import multiprocessing
 import threading
diff --git a/mercurial/thirdparty/concurrent/futures/_base.py b/mercurial/thirdparty/concurrent/futures/_base.py
--- a/mercurial/thirdparty/concurrent/futures/_base.py
+++ b/mercurial/thirdparty/concurrent/futures/_base.py
@@ -1,6 +1,8 @@ 
 # Copyright 2009 Brian Quinlan. All Rights Reserved.
 # Licensed to PSF under a Contributor Agreement.
 
+from __future__ import absolute_import
+
 import collections
 import logging
 import threading
diff --git a/mercurial/thirdparty/concurrent/futures/__init__.py b/mercurial/thirdparty/concurrent/futures/__init__.py
--- a/mercurial/thirdparty/concurrent/futures/__init__.py
+++ b/mercurial/thirdparty/concurrent/futures/__init__.py
@@ -3,21 +3,25 @@ 
 
 """Execute computations asynchronously using threads or processes."""
 
+from __future__ import absolute_import
+
 __author__ = 'Brian Quinlan (brian@sweetapp.com)'
 
-from concurrent.futures._base import (FIRST_COMPLETED,
-                                      FIRST_EXCEPTION,
-                                      ALL_COMPLETED,
-                                      CancelledError,
-                                      TimeoutError,
-                                      Future,
-                                      Executor,
-                                      wait,
-                                      as_completed)
-from concurrent.futures.thread import ThreadPoolExecutor
+from ._base import (
+    FIRST_COMPLETED,
+    FIRST_EXCEPTION,
+    ALL_COMPLETED,
+    CancelledError,
+    TimeoutError,
+    Future,
+    Executor,
+    wait,
+    as_completed,
+)
+from .thread import ThreadPoolExecutor
 
 try:
-    from concurrent.futures.process import ProcessPoolExecutor
+    from .process import ProcessPoolExecutor
 except ImportError:
     # some platforms don't have multiprocessing
     pass