mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
parent
a3d3fecf84
commit
d345d0f8c1
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -9,8 +9,6 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -25,7 +25,6 @@
|
||||
See the LICENSE file and the original docutils code for details.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,4 +1,3 @@
|
||||
from __future__ import absolute_import
|
||||
import enum
|
||||
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# TODO(stephenfin): Removing this breaks tests. Why?
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .submodule import func1, Class1 # NOQA
|
||||
|
@ -1,4 +1,2 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .mod1 import func1, Class1 # NOQA
|
||||
from .mod2 import func2, Class2 # NOQA
|
||||
|
@ -1,7 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
|
Loading…
Reference in New Issue
Block a user