Remove traces of Python 2 and 3.5 (#10560)

This commit is contained in:
Adam Turner 2022-06-16 21:37:46 +01:00 committed by GitHub
parent 6d23d7d153
commit 70f950cae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 33 deletions

View File

@ -136,7 +136,7 @@ separate sections, whereas NumPy uses underlines.
Google style:
.. code-block:: python3
.. code-block:: python
def func(arg1, arg2):
"""Summary line.
@ -155,7 +155,7 @@ Google style:
NumPy style:
.. code-block:: python3
.. code-block:: python
def func(arg1, arg2):
"""Summary line.

View File

@ -349,7 +349,7 @@ different style:
The name of a file or directory. Within the contents, you can use curly
braces to indicate a "variable" part, for example::
... is installed in :file:`/usr/lib/python2.{x}/site-packages` ...
... is installed in :file:`/usr/lib/python3.{x}/site-packages` ...
In the built documentation, the ``x`` will be displayed differently to
indicate that it is to be replaced by the Python minor version.

View File

@ -3,7 +3,7 @@
import importlib
import traceback
import warnings
from typing import Any, Callable, Dict, List, NamedTuple, Optional
from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Optional
from sphinx.ext.autodoc.mock import ismock, undecorate
from sphinx.pycode import ModuleAnalyzer, PycodeError
@ -11,10 +11,7 @@ from sphinx.util import logging
from sphinx.util.inspect import (getannotations, getmro, getslots, isclass, isenumclass,
safe_getattr)
if False:
# For type annotation
from typing import Type # NOQA
if TYPE_CHECKING:
from sphinx.ext.autodoc import ObjectMember
logger = logging.getLogger(__name__)

View File

@ -28,10 +28,6 @@ else:
MethodDescriptorType = type(str.join)
WrapperDescriptorType = type(dict.__dict__['fromkeys'])
if False:
# For type annotation
from typing import Type # NOQA
logger = logging.getLogger(__name__)
memory_address_re = re.compile(r' at 0x[0-9a-f]{8,16}(?=>)', re.IGNORECASE)

View File

@ -30,11 +30,6 @@ try:
except ImportError:
UnionType = None
if False:
# For type annotation
from typing import Type # NOQA # for python3.5.1
# builtin classes that have incorrect __module__
INVALID_BUILTIN_CLASSES = {
Struct: 'struct.Struct', # Before Python 3.9

View File

@ -111,6 +111,9 @@ def test_complex_assignment():
'f = g = None #: multiple assignment at once\n'
'(theta, phi) = (0, 0.5) #: unpack assignment via tuple\n'
'[x, y] = (5, 6) #: unpack assignment via list\n'
'h, *i, j = (1, 2, 3, 4) #: unpack assignment2\n'
'k, *self.attr = (5, 6, 7) #: unpack assignment3\n'
'l, *m[0] = (8, 9, 0) #: unpack assignment4\n'
)
parser = Parser(source)
parser.parse()
@ -124,22 +127,11 @@ def test_complex_assignment():
('', 'phi'): 'unpack assignment via tuple',
('', 'x'): 'unpack assignment via list',
('', 'y'): 'unpack assignment via list',
}
assert parser.definitions == {}
def test_complex_assignment_py3():
source = ('a, *b, c = (1, 2, 3, 4) #: unpack assignment\n'
'd, *self.attr = (5, 6, 7) #: unpack assignment2\n'
'e, *f[0] = (8, 9, 0) #: unpack assignment3\n'
)
parser = Parser(source)
parser.parse()
assert parser.comments == {('', 'a'): 'unpack assignment',
('', 'b'): 'unpack assignment',
('', 'c'): 'unpack assignment',
('', 'd'): 'unpack assignment2',
('', 'e'): 'unpack assignment3',
('', 'h'): 'unpack assignment2',
('', 'i'): 'unpack assignment2',
('', 'j'): 'unpack assignment2',
('', 'k'): 'unpack assignment3',
('', 'l'): 'unpack assignment4',
}
assert parser.definitions == {}