py3: Remove (most) __future__ imports

There were two used:

- print_function
- absolute_import

Both of these are mandatory in Python 3.0 onwards [1] and can therefore
be removed...mostly. Unfortunately, mypy is still running in Python 2.7
mode, meaning we need the 'print_function' future wherever we're calling
'print' with the 'file' argument. There's also a single
'absolute_import' future that must be retained as its removal breaks a
test for as-yet unknown reasons.  TODOs are added to resolve both issues
in the future.

[1] https://docs.python.org/3/library/__future__.html

Signed-off-by: Stephen Finucane <stephen@that.guru>
This commit is contained in:
Stephen Finucane 2018-10-05 18:02:56 +01:00
parent a3d3fecf84
commit d345d0f8c1
24 changed files with 1 additions and 30 deletions

View File

@ -12,8 +12,6 @@
# Keep this file executable as-is in Python 3!
# (Otherwise getting the version out of it from setup.py is impossible.)
from __future__ import absolute_import
import os
import warnings
from os import path

View File

@ -10,7 +10,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import gzip
import re

View File

@ -9,8 +9,6 @@
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
from codecs import open
from collections import defaultdict, OrderedDict
from datetime import datetime, tzinfo, timedelta

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import argparse
import locale

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import sys
import warnings

View File

@ -9,7 +9,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import doctest
import re

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import fnmatch
import os

View File

@ -9,8 +9,6 @@
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import sys
import warnings

View File

@ -9,7 +9,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
from typing import List, Tuple, cast

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import os
import re

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import os
import posixpath

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import base64
import imghdr

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import builtins
import enum

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import logging
import logging.handlers

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import re
from typing import Any, cast

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import os
import time

View File

@ -9,8 +9,6 @@
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import warnings
from contextlib import contextmanager
from urllib.parse import urlsplit

View File

@ -8,7 +8,6 @@
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import re
from contextlib import contextmanager

View File

@ -25,7 +25,6 @@
See the LICENSE file and the original docutils code for details.
"""
from __future__ import absolute_import, unicode_literals
import re

View File

@ -9,8 +9,6 @@
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
if False:
# For type annotation
from typing import Dict # NOQA

View File

@ -1,4 +1,3 @@
from __future__ import absolute_import
import enum

View File

@ -1,3 +1,4 @@
# TODO(stephenfin): Removing this breaks tests. Why?
from __future__ import absolute_import
from .submodule import func1, Class1 # NOQA

View File

@ -1,4 +1,2 @@
from __future__ import absolute_import
from .mod1 import func1, Class1 # NOQA
from .mod2 import func2, Class2 # NOQA

View File

@ -1,7 +1,5 @@
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import re