Insert `from __future__ import annotations`

This commit is contained in:
Adam Turner 2022-12-30 20:14:18 +00:00
parent 0b1efd7756
commit f4c8a0a68e
180 changed files with 366 additions and 6 deletions

View File

@ -1,3 +1,5 @@
from __future__ import annotations
from enum import IntEnum
from typing import Any, Optional

View File

@ -1,5 +1,7 @@
"""Document tree nodes that Sphinx defines on top of those in Docutils."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence
from docutils import nodes

View File

@ -3,6 +3,8 @@
Gracefully adapted from the TextPress system by Armin.
"""
from __future__ import annotations
import os
import pickle
import sys

View File

@ -1,5 +1,7 @@
"""Builder superclass for all builders."""
from __future__ import annotations
import codecs
import pickle
import time

View File

@ -1,5 +1,7 @@
"""Base class of epub2/epub3 builders."""
from __future__ import annotations
import html
import os
import re

View File

@ -1,5 +1,7 @@
"""Changelog builder."""
from __future__ import annotations
import html
from os import path
from typing import Any, Dict, List, Tuple, cast

View File

@ -1,5 +1,7 @@
"""Directory HTML builders."""
from __future__ import annotations
from os import path
from typing import Any, Dict, Optional

View File

@ -1,5 +1,7 @@
"""Do syntax checks, but no writing."""
from __future__ import annotations
from typing import Any, Dict, Optional, Set
from docutils.nodes import Node

View File

@ -3,6 +3,8 @@
Originally derived from epub.py.
"""
from __future__ import annotations
import html
from os import path
from typing import Any, Dict, List, NamedTuple, Set, Tuple

View File

@ -1,5 +1,7 @@
"""The MessageCatalogBuilder class."""
from __future__ import annotations
from codecs import open
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta, tzinfo

View File

@ -1,5 +1,7 @@
"""Several HTML builders."""
from __future__ import annotations
import html
import os
import posixpath

View File

@ -1,5 +1,7 @@
"""Transforms for HTML builder."""
from __future__ import annotations
import re
from typing import Any, Dict, List

View File

@ -1,5 +1,7 @@
"""LaTeX builder."""
from __future__ import annotations
import os
import warnings
from os import path

View File

@ -1,5 +1,7 @@
"""consntants for LaTeX builder."""
from __future__ import annotations
from typing import Any, Dict
PDFLATEX_DEFAULT_FONTPKG = r'''

View File

@ -1,5 +1,7 @@
"""Theming support for LaTeX builder."""
from __future__ import annotations
import configparser
from os import path
from typing import Dict, Optional

View File

@ -1,5 +1,7 @@
"""Transforms for LaTeX builder."""
from __future__ import annotations
from typing import Any, Dict, List, Optional, Set, Tuple, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""Utilities for LaTeX builder."""
from __future__ import annotations
from typing import Optional
from docutils.writers.latex2e import Babel

View File

@ -1,5 +1,7 @@
"""The CheckExternalLinksBuilder class."""
from __future__ import annotations
import json
import re
import socket

View File

@ -1,5 +1,7 @@
"""Manual pages builder."""
from __future__ import annotations
import warnings
from os import path
from typing import Any, Dict, List, Optional, Set, Tuple, Union

View File

@ -1,5 +1,7 @@
"""Single HTML builders."""
from __future__ import annotations
from os import path
from typing import Any, Dict, List, Optional, Tuple, Union

View File

@ -1,5 +1,7 @@
"""Texinfo builder."""
from __future__ import annotations
import os
import warnings
from os import path

View File

@ -1,5 +1,7 @@
"""Plain-text Sphinx builder."""
from __future__ import annotations
from os import path
from typing import Any, Dict, Iterator, Optional, Set, Tuple

View File

@ -1,5 +1,7 @@
"""Docutils-native XML and pseudo-XML builders."""
from __future__ import annotations
from os import path
from typing import Any, Dict, Iterator, Optional, Set, Type, Union

View File

@ -1,5 +1,7 @@
"""Build documentation from a provided source."""
from __future__ import annotations
import argparse
import bdb
import locale

View File

@ -7,6 +7,8 @@ This is in its own module so that importing it is fast. It should not
import the main Sphinx modules (like sphinx.applications, sphinx.builders).
"""
from __future__ import annotations
import os
import subprocess
import sys

View File

@ -1,5 +1,7 @@
"""Quickly setup documentation source to work with Sphinx."""
from __future__ import annotations
import argparse
import locale
import os

View File

@ -1,5 +1,7 @@
"""Build configuration file handling."""
from __future__ import annotations
import re
import traceback
import types

View File

@ -1,5 +1,7 @@
"""Sphinx deprecation classes and utilities."""
from __future__ import annotations
import sys
import warnings
from importlib import import_module

View File

@ -1,5 +1,7 @@
"""Handlers for additional ReST directives."""
from __future__ import annotations
import re
from typing import TYPE_CHECKING, Any, Dict, Generic, List, Optional, Tuple, TypeVar, cast

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import sys
import textwrap
from difflib import unified_diff

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import re
from typing import TYPE_CHECKING, Any, Dict, List, cast

View File

@ -1,3 +1,5 @@
from __future__ import annotations
import os
from os import path
from typing import TYPE_CHECKING, Any, Dict, List, cast

View File

@ -4,6 +4,8 @@ Domains are groupings of description directives
and roles describing e.g. constructs of one programming language.
"""
from __future__ import annotations
import copy
from abc import ABC, abstractmethod
from typing import (TYPE_CHECKING, Any, Callable, Dict, Iterable, List, NamedTuple, Optional,

View File

@ -1,5 +1,7 @@
"""The C language domain."""
from __future__ import annotations
import re
from typing import (Any, Callable, Dict, Generator, Iterator, List, Optional, Tuple, TypeVar,
Union, cast)

View File

@ -1,5 +1,7 @@
"""The changeset domain."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The citation domain."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The C++ language domain."""
from __future__ import annotations
import re
from typing import (Any, Callable, Dict, Generator, Iterator, List, Optional, Tuple, TypeVar,
Union)

View File

@ -1,5 +1,7 @@
"""The index domain."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Tuple
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The JavaScript domain."""
from __future__ import annotations
from typing import Any, Dict, Iterator, List, Optional, Tuple, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The math domain."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The Python domain."""
from __future__ import annotations
import ast
import builtins
import inspect

View File

@ -1,5 +1,7 @@
"""The reStructuredText domain."""
from __future__ import annotations
import re
from typing import Any, Dict, Iterator, List, Optional, Tuple, cast

View File

@ -1,5 +1,7 @@
"""The standard domain."""
from __future__ import annotations
import re
from copy import copy
from typing import (TYPE_CHECKING, Any, Callable, Dict, Final, Iterable, Iterator, List,

View File

@ -1,5 +1,7 @@
"""Global creation environment."""
from __future__ import annotations
import os
import pickle
from collections import defaultdict

View File

@ -1,5 +1,7 @@
"""Index entries adapters for sphinx.environment."""
from __future__ import annotations
import re
import unicodedata
from itertools import groupby

View File

@ -1,5 +1,7 @@
"""Toctree adapter for sphinx.environment."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The data collector components for sphinx.environment."""
from __future__ import annotations
from typing import TYPE_CHECKING, Dict, List, Optional, Set
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The image collector for sphinx.environment."""
from __future__ import annotations
import os
from glob import glob
from os import path

View File

@ -1,5 +1,7 @@
"""The dependencies collector components for sphinx.environment."""
from __future__ import annotations
import os
from os import path
from typing import Any, Dict, Set

View File

@ -1,5 +1,7 @@
"""The metadata collector components for sphinx.environment."""
from __future__ import annotations
from typing import Any, Dict, List, Set, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""The title collector components for sphinx.environment."""
from __future__ import annotations
from typing import Any, Dict, Set
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""Toctree collector for sphinx.environment."""
from __future__ import annotations
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, TypeVar, Union, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""Contains SphinxError and a few subclasses."""
from __future__ import annotations
from typing import Any, Optional

View File

@ -3,6 +3,8 @@
Gracefully adapted from the TextPress system by Armin.
"""
from __future__ import annotations
from collections import defaultdict
from operator import attrgetter
from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Tuple, Type

View File

@ -9,6 +9,8 @@ Copyright 2008 Société des arts technologiques (SAT),
https://sat.qc.ca/
"""
from __future__ import annotations
import argparse
import glob
import locale

View File

@ -5,6 +5,8 @@ the doctree, thus avoiding duplication between docstrings and documentation
for those who like elaborate docstrings.
"""
from __future__ import annotations
import re
from inspect import Parameter, Signature
from types import ModuleType

View File

@ -1,3 +1,5 @@
from __future__ import annotations
from typing import Any, Callable, Dict, List, Optional, Set, Type
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""Importer utilities for autodoc"""
from __future__ import annotations
import importlib
import traceback
import warnings

View File

@ -1,5 +1,7 @@
"""mock for autodoc"""
from __future__ import annotations
import contextlib
import os
import sys

View File

@ -4,6 +4,8 @@ Preserve the default argument values of function signatures in source code
and keep them not evaluated for readability.
"""
from __future__ import annotations
import ast
import inspect
from typing import Any, Dict, List, Optional

View File

@ -1,5 +1,7 @@
"""Update annotations info of living objects using type_comments."""
from __future__ import annotations
import ast
from inspect import Parameter, Signature, getsource
from typing import Any, Dict, List, Optional, cast

View File

@ -1,5 +1,7 @@
"""Generating content for autodoc using typehints"""
from __future__ import annotations
import re
from collections import OrderedDict
from typing import Any, Dict, Iterable, Set, cast

View File

@ -1,5 +1,7 @@
"""Allow reference sections by :ref: role using its title."""
from __future__ import annotations
from typing import Any, Dict, cast
from docutils import nodes

View File

@ -46,6 +46,8 @@ resolved to a Python object, and otherwise it becomes simple emphasis.
This can be used as the default role to make links 'smart'.
"""
from __future__ import annotations
import inspect
import os
import posixpath

View File

@ -12,6 +12,8 @@ Example Makefile rule::
sphinx-autogen -o source/generated source/*.rst
"""
from __future__ import annotations
import argparse
import inspect
import locale

View File

@ -4,6 +4,8 @@ Mostly written by Josip Dzolonga for the Google Highly Open Participation
contest.
"""
from __future__ import annotations
import glob
import inspect
import pickle

View File

@ -3,6 +3,8 @@
The extension automatically execute code snippets and checks their results.
"""
from __future__ import annotations
import doctest
import re
import sys

View File

@ -1,5 +1,7 @@
"""Measure durations of Sphinx processing."""
from __future__ import annotations
from datetime import datetime, timedelta
from itertools import islice
from operator import itemgetter

View File

@ -17,6 +17,8 @@ You can also give an explicit caption, e.g. :exmpl:`Foo <foo>`.
Both, the url string and the caption string must escape ``%`` as ``%%``.
"""
from __future__ import annotations
import re
from typing import Any, Dict, List, Tuple

View File

@ -1,5 +1,7 @@
"""To publish HTML docs at GitHub Pages, create .nojekyll file."""
from __future__ import annotations
import os
import urllib
from typing import Any, Dict

View File

@ -1,6 +1,8 @@
"""Allow graphviz-formatted graphs to be included inline in generated documents.
"""
from __future__ import annotations
import posixpath
import re
import subprocess

View File

@ -14,6 +14,8 @@ namespace of the project configuration (that is, all variables from
``conf.py`` are available.)
"""
from __future__ import annotations
from typing import Any, Dict, List
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""Image converter extension for Sphinx"""
from __future__ import annotations
import subprocess
import sys
from subprocess import CalledProcessError

View File

@ -1,5 +1,7 @@
"""Render math in HTML via dvipng or dvisvgm."""
from __future__ import annotations
import base64
import re
import shutil

View File

@ -28,6 +28,8 @@ The graph is inserted as a PNG+image map into HTML and a PDF in
LaTeX.
"""
from __future__ import annotations
import builtins
import inspect
import re

View File

@ -16,6 +16,8 @@ This works as follows:
without Internet access.
"""
from __future__ import annotations
import concurrent.futures
import functools
import posixpath

View File

@ -1,5 +1,7 @@
"""Add external links to module code in Python object descriptions."""
from __future__ import annotations
from typing import Any, Dict, Set
from docutils import nodes

View File

@ -5,6 +5,8 @@ This requires the MathJax JavaScript library on your webserver/computer.
.. _MathJax: https://www.mathjax.org/
"""
from __future__ import annotations
import json
from typing import Any, Dict, cast

View File

@ -1,5 +1,7 @@
"""Support for NumPy and Google style docstrings."""
from __future__ import annotations
from typing import Any, Dict, List
import sphinx

View File

@ -1,5 +1,7 @@
"""Classes for docstring parsing and formatting."""
from __future__ import annotations
import collections
import inspect
import re

View File

@ -1,5 +1,7 @@
"""A collection of helpful iterators."""
from __future__ import annotations
import collections
import warnings
from typing import Any, Iterable, Optional

View File

@ -5,6 +5,8 @@ The todolist directive collects all todos of your project and lists them along
with a backlink to the original location.
"""
from __future__ import annotations
from typing import Any, Dict, List, cast
from docutils import nodes

View File

@ -1,5 +1,7 @@
"""Add links to module code in Python object descriptions."""
from __future__ import annotations
import posixpath
import traceback
from os import path

View File

@ -1,5 +1,7 @@
"""Utilities for Sphinx extensions."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict
from packaging.version import InvalidVersion, Version

View File

@ -1,5 +1,7 @@
"""Highlight code blocks using Pygments."""
from __future__ import annotations
from functools import partial
from importlib import import_module
from typing import Any, Dict, Optional, Type, Union

View File

@ -1,4 +1,6 @@
"""Input/Output files"""
from __future__ import annotations
import codecs
import warnings
from typing import TYPE_CHECKING, Any, List, Type

View File

@ -1,5 +1,7 @@
"""Glue code for the jinja2 templating engine."""
from __future__ import annotations
import pathlib
from os import path
from pprint import pformat

View File

@ -1,5 +1,7 @@
"""A Base class for additional parsers."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, List, Type, Union
import docutils.parsers

View File

@ -1,5 +1,7 @@
"""Utility function and classes for Sphinx projects."""
from __future__ import annotations
import os
from glob import glob
from typing import Dict, Iterable, Optional, Set

View File

@ -1,5 +1,7 @@
"""Utilities parsing and analyzing Python code."""
from __future__ import annotations
import re
import tokenize
from collections import OrderedDict

View File

@ -1,5 +1,7 @@
"""Helpers for AST (Abstract Syntax Tree)."""
from __future__ import annotations
import ast
import warnings
from typing import Dict, List, Optional, Type, overload

View File

@ -1,5 +1,7 @@
"""Utilities parsing and analyzing Python code."""
from __future__ import annotations
import ast
import inspect
import itertools

View File

@ -1,5 +1,7 @@
"""Sphinx component registry."""
from __future__ import annotations
import traceback
import warnings
from importlib import import_module

View File

@ -1,5 +1,7 @@
"""Handlers for additional ReST roles."""
from __future__ import annotations
import re
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type

View File

@ -1,4 +1,6 @@
"""Create a full-text search index for offline search."""
from __future__ import annotations
import html
import json
import pickle

View File

@ -1,5 +1,7 @@
"""Danish search language: includes the JS Danish stemmer."""
from __future__ import annotations
from typing import Dict
import snowballstemmer

View File

@ -1,5 +1,7 @@
"""German search language: includes the JS German stemmer."""
from __future__ import annotations
from typing import Dict
import snowballstemmer

View File

@ -1,5 +1,7 @@
"""English search language: includes the JS porter stemmer."""
from __future__ import annotations
from typing import Dict
import snowballstemmer

View File

@ -1,5 +1,7 @@
"""Spanish search language: includes the JS Spanish stemmer."""
from __future__ import annotations
from typing import Dict
import snowballstemmer

View File

@ -1,5 +1,7 @@
"""Finnish search language: includes the JS Finnish stemmer."""
from __future__ import annotations
from typing import Dict
import snowballstemmer

Some files were not shown because too many files have changed in this diff Show More