mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Run Ruff on `tests/roots/`
This commit is contained in:
10
.ruff.toml
10
.ruff.toml
@@ -3,9 +3,10 @@ line-length = 88
|
||||
output-format = "full"
|
||||
|
||||
extend-exclude = [
|
||||
"tests/roots/*",
|
||||
"build/*",
|
||||
"doc/_build/*",
|
||||
"tests/roots/test-directive-code/target.py", # Tests break if formatted
|
||||
"tests/roots/test-pycode/cp_1251_coded.py", # Not UTF-8
|
||||
]
|
||||
|
||||
[format]
|
||||
@@ -338,8 +339,15 @@ select = [
|
||||
|
||||
# test roots are not packages
|
||||
"tests/js/roots/*" = ["I002", "INP001"]
|
||||
"tests/roots/*" = [
|
||||
"D403", # permit uncapitalised docstrings
|
||||
"F401", # names may be unused in test roots
|
||||
"I002", # we don't need the annotations future
|
||||
"INP001", # test roots are not packages
|
||||
]
|
||||
|
||||
# these tests need old ``typing`` generic aliases
|
||||
"tests/roots/test-ext-autodoc/target/genericalias.py" = ["UP006", "UP007", "UP035"]
|
||||
"tests/test_util/test_util_typing.py" = ["RUF036", "UP006", "UP007", "UP035"]
|
||||
"tests/test_util/typing_test_data.py" = ["FA100", "I002", "PYI030", "UP006", "UP007", "UP035"]
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ def visit_numbered_text(self, node):
|
||||
raise nodes.SkipNode
|
||||
|
||||
|
||||
def get_title(node):
|
||||
def get_title(node): # NoQA: FURB118
|
||||
return node['title']
|
||||
|
||||
|
||||
@@ -51,12 +51,14 @@ class NumberedText(Directive):
|
||||
|
||||
def setup(app):
|
||||
# my-figure
|
||||
app.add_enumerable_node(my_figure, 'figure',
|
||||
html=(visit_my_figure, depart_my_figure))
|
||||
app.add_enumerable_node(
|
||||
my_figure, 'figure', html=(visit_my_figure, depart_my_figure)
|
||||
)
|
||||
app.add_directive('my-figure', MyFigure)
|
||||
|
||||
# numbered_label
|
||||
app.add_enumerable_node(numbered_text, 'original', get_title,
|
||||
html=(visit_numbered_text, None))
|
||||
app.add_enumerable_node(
|
||||
numbered_text, 'original', get_title, html=(visit_numbered_text, None)
|
||||
)
|
||||
app.add_directive('numbered-text', NumberedText)
|
||||
app.config.numfig_format.setdefault('original', 'No.%s')
|
||||
|
||||
@@ -16,5 +16,5 @@ source_suffix = {
|
||||
'.test': 'restructuredtext',
|
||||
}
|
||||
source_parsers = {
|
||||
'.test': DummyTestParser
|
||||
'.test': DummyTestParser,
|
||||
}
|
||||
|
||||
0
tests/roots/test-apidoc-custom-templates/mypackage/mymodule.py
Executable file → Normal file
0
tests/roots/test-apidoc-custom-templates/mypackage/mymodule.py
Executable file → Normal file
@@ -1 +1 @@
|
||||
"Package C"
|
||||
"""Package C"""
|
||||
|
||||
@@ -1 +1 @@
|
||||
"Module d"
|
||||
"""Module d"""
|
||||
|
||||
@@ -1 +1 @@
|
||||
"Module f"
|
||||
"""Module f"""
|
||||
|
||||
@@ -1 +1 @@
|
||||
"Module y"
|
||||
"""Module y"""
|
||||
|
||||
@@ -1 +1 @@
|
||||
"foo"
|
||||
"""foo"""
|
||||
|
||||
@@ -5,9 +5,9 @@ from pathlib import Path
|
||||
import mod_resource
|
||||
import mod_something
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(f"Hello, world! -> something returns: {mod_something.something()}")
|
||||
if __name__ == '__main__':
|
||||
print(f'Hello, world! -> something returns: {mod_something.something()}')
|
||||
|
||||
res_path = Path(mod_resource.__file__).parent / 'resource.txt'
|
||||
text = res_path.read_text(encoding='utf-8')
|
||||
print(f"From mod_resource:resource.txt -> {text}")
|
||||
print(f'From mod_resource:resource.txt -> {text}')
|
||||
|
||||
@@ -1 +1 @@
|
||||
"Subpackage Something"
|
||||
"""Subpackage Something"""
|
||||
|
||||
@@ -1 +1 @@
|
||||
""" A package with trailing underscores """
|
||||
"""A package with trailing underscores"""
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
""" A module with a trailing underscore """
|
||||
"""A module with a trailing underscore"""
|
||||
|
||||
|
||||
class SomeClass_:
|
||||
""" A class with a trailing underscore """
|
||||
"""A class with a trailing underscore"""
|
||||
|
||||
|
||||
def some_function_(some_arg_):
|
||||
""" A function with a trailing underscore in name and argument """
|
||||
"""A function with a trailing underscore in name and argument"""
|
||||
|
||||
@@ -11,26 +11,26 @@
|
||||
|
||||
|
||||
def with_sentence():
|
||||
'''I have a sentence which
|
||||
"""I have a sentence which
|
||||
spans multiple lines. Then I have
|
||||
more stuff
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def no_sentence():
|
||||
'''this doesn't start with a
|
||||
"""this doesn't start with a
|
||||
capital. so it's not considered
|
||||
a sentence
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def empty_line():
|
||||
'''This is the real summary
|
||||
"""This is the real summary
|
||||
|
||||
However, it did't end with a period.
|
||||
'''
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ module_attr = 1
|
||||
|
||||
|
||||
class C:
|
||||
'''
|
||||
"""
|
||||
My C class
|
||||
|
||||
with class_attr attribute
|
||||
'''
|
||||
"""
|
||||
|
||||
#: This is a class attribute
|
||||
#:
|
||||
@@ -56,7 +56,7 @@ class C:
|
||||
#: This is an instance attribute
|
||||
#:
|
||||
#: value is a string
|
||||
self.instance_attr = "42"
|
||||
self.instance_attr = '42'
|
||||
|
||||
def _prop_attr_get(self):
|
||||
"""
|
||||
@@ -76,9 +76,9 @@ class C:
|
||||
"""
|
||||
|
||||
class C2:
|
||||
'''
|
||||
"""
|
||||
This is a nested inner class docstring
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
def func(arg_, *args, **kwargs):
|
||||
|
||||
@@ -4,12 +4,13 @@ module with trailing underscores everywhere
|
||||
|
||||
|
||||
class class_:
|
||||
""" Class """
|
||||
"""Class"""
|
||||
|
||||
def method_(_arg):
|
||||
""" Method """
|
||||
"""Method"""
|
||||
pass
|
||||
|
||||
|
||||
def function_(_arg):
|
||||
""" Function """
|
||||
"""Function"""
|
||||
pass
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
html_theme = 'basic'
|
||||
latex_documents = [
|
||||
('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report')
|
||||
(
|
||||
'index',
|
||||
'test.tex',
|
||||
'The basic Sphinx documentation for testing',
|
||||
'Sphinx',
|
||||
'report',
|
||||
)
|
||||
]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
source_suffix = {
|
||||
'.txt': 'restructuredtext'
|
||||
'.txt': 'restructuredtext',
|
||||
}
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
@@ -3,5 +3,4 @@ Literal Includes with Highlighted Lines
|
||||
|
||||
.. literalinclude:: target.py
|
||||
:language: python
|
||||
:emphasize-lines: 5-6, 13-15, 24-
|
||||
|
||||
:emphasize-lines: 6-7, 16-19, 29-
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
# Literally included file using Python highlighting
|
||||
|
||||
foo = "Including Unicode characters: üöä"
|
||||
foo = 'Including Unicode characters: üöä'
|
||||
|
||||
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
|
||||
class Bar:
|
||||
def baz():
|
||||
pass
|
||||
|
||||
|
||||
# comment after Bar class definition
|
||||
def bar(): pass
|
||||
|
||||
|
||||
def block_start_with_comment():
|
||||
# Comment
|
||||
return 1
|
||||
|
||||
|
||||
def block_start_with_blank():
|
||||
|
||||
return 1
|
||||
|
||||
@@ -1 +1 @@
|
||||
c_maximum_signature_line_length = len("str hello(str name)") - 1
|
||||
c_maximum_signature_line_length = len('str hello(str name)') - 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exclude_patterns = ['_build']
|
||||
extensions = [
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.intersphinx',
|
||||
]
|
||||
|
||||
@@ -1 +1 @@
|
||||
cpp_maximum_signature_line_length = len("str hello(str name)") - 1
|
||||
cpp_maximum_signature_line_length = len('str hello(str name)') - 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
exclude_patterns = ['_build']
|
||||
extensions = [
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.intersphinx',
|
||||
]
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
def setup(app):
|
||||
app.add_crossref_type(directivename="setting", rolename="setting")
|
||||
app.add_crossref_type(directivename='setting', rolename='setting')
|
||||
|
||||
@@ -3,4 +3,5 @@ from bug2437.autodoc_dummy_foo import Foo
|
||||
|
||||
class Bar:
|
||||
"""Dummy class Bar with alias."""
|
||||
|
||||
my_name = Foo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from dummy import *
|
||||
from dummy import * # NoQA: F403
|
||||
|
||||
|
||||
def test():
|
||||
"""Dummy function using dummy.*"""
|
||||
dummy_function()
|
||||
dummy_function() # NoQA: F405
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
class Foo:
|
||||
"""Dummy class Foo."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -6,7 +6,7 @@ sys.path.insert(0, str(Path.cwd().resolve()))
|
||||
extensions = ['sphinx.ext.autodoc']
|
||||
|
||||
autodoc_mock_imports = [
|
||||
'dummy'
|
||||
'dummy',
|
||||
]
|
||||
|
||||
nitpicky = True
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from gettext import NullTranslations
|
||||
from gettext import NullTranslations # NoQA: TC003
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@@ -22,11 +22,15 @@ class CustomEx(Exception):
|
||||
|
||||
|
||||
def _funky_classmethod(name, b, c, d, docstring=None):
|
||||
"""Generates a classmethod for a class from a template by filling out
|
||||
some arguments."""
|
||||
"""
|
||||
Generates a classmethod for a class from a template by filling out some arguments.
|
||||
"""
|
||||
|
||||
def template(cls, a, b, c, d=4, e=5, f=6):
|
||||
return a, b, c, d, e, f
|
||||
|
||||
from functools import partial
|
||||
|
||||
function = partial(template, b=b, c=c, d=d)
|
||||
function.__name__ = name
|
||||
function.__doc__ = docstring
|
||||
@@ -64,10 +68,11 @@ class Class:
|
||||
mdocattr = StringIO()
|
||||
"""should be documented as well - süß"""
|
||||
|
||||
roger = _funky_classmethod("roger", 2, 3, 4)
|
||||
roger = _funky_classmethod('roger', 2, 3, 4)
|
||||
|
||||
moore = _funky_classmethod("moore", 9, 8, 7,
|
||||
docstring="moore(a, e, f) -> happiness")
|
||||
moore = _funky_classmethod(
|
||||
'moore', 9, 8, 7, docstring='moore(a, e, f) -> happiness'
|
||||
)
|
||||
|
||||
def __init__(self, arg):
|
||||
self.inst_attr_inline = None #: an inline documented instance attr
|
||||
@@ -77,15 +82,15 @@ class Class:
|
||||
"""a documented instance attribute"""
|
||||
self._private_inst_attr = None #: a private instance attribute
|
||||
|
||||
def __special1__(self):
|
||||
def __special1__(self): # NoQA: PLW3201
|
||||
"""documented special method"""
|
||||
|
||||
def __special2__(self):
|
||||
def __special2__(self): # NoQA: PLW3201
|
||||
# undocumented special method
|
||||
pass
|
||||
|
||||
|
||||
class CustomDict(dict):
|
||||
class CustomDict(dict): # NoQA: FURB189
|
||||
"""Docstring."""
|
||||
|
||||
|
||||
@@ -116,21 +121,21 @@ class InnerChild(Outer.Inner):
|
||||
class DocstringSig:
|
||||
def __new__(cls, *new_args, **new_kwargs):
|
||||
"""__new__(cls, d, e=1) -> DocstringSig
|
||||
First line of docstring
|
||||
First line of docstring
|
||||
|
||||
rest of docstring
|
||||
"""
|
||||
|
||||
def __init__(self, *init_args, **init_kwargs):
|
||||
"""__init__(self, a, b=1) -> None
|
||||
First line of docstring
|
||||
First line of docstring
|
||||
|
||||
rest of docstring
|
||||
"""
|
||||
|
||||
def meth(self):
|
||||
"""meth(FOO, BAR=1) -> BAZ
|
||||
First line of docstring
|
||||
First line of docstring
|
||||
|
||||
rest of docstring
|
||||
"""
|
||||
@@ -157,7 +162,7 @@ First line of docstring
|
||||
return 456
|
||||
|
||||
|
||||
class StrRepr(str):
|
||||
class StrRepr(str): # NoQA: FURB189,SLOT000
|
||||
"""docstring"""
|
||||
|
||||
def __repr__(self):
|
||||
@@ -176,7 +181,7 @@ class InstAttCls:
|
||||
#: It can have multiple lines.
|
||||
ca1 = 'a'
|
||||
|
||||
ca2 = 'b' #: Doc comment for InstAttCls.ca2. One line only.
|
||||
ca2 = 'b' #: Doc comment for InstAttCls.ca2. One line only.
|
||||
|
||||
ca3 = 'c'
|
||||
"""Docstring for class attribute InstAttCls.ca3."""
|
||||
@@ -197,8 +202,8 @@ class CustomIter:
|
||||
def __iter__(self):
|
||||
"""Iterate squares of each value."""
|
||||
for i in self.values:
|
||||
yield i ** 2
|
||||
yield i**2
|
||||
|
||||
def snafucate(self):
|
||||
"""Makes this snafucated."""
|
||||
print("snafucated")
|
||||
print('snafucated')
|
||||
|
||||
@@ -4,5 +4,5 @@ if TYPE_CHECKING:
|
||||
from sphinx.application import Sphinx
|
||||
|
||||
|
||||
def function_to_be_imported(app: Optional["Sphinx"]) -> str:
|
||||
def function_to_be_imported(app: Optional['Sphinx']) -> str:
|
||||
"""docstring"""
|
||||
|
||||
@@ -24,7 +24,7 @@ def validate(value: str) -> str:
|
||||
ValidatedString = Annotated[str, FuncValidator(validate)]
|
||||
|
||||
|
||||
def hello(name: Annotated[str, "attribute"]) -> None:
|
||||
def hello(name: Annotated[str, 'attribute']) -> None:
|
||||
"""docstring"""
|
||||
pass
|
||||
|
||||
@@ -33,7 +33,7 @@ class AnnotatedAttributes:
|
||||
"""docstring"""
|
||||
|
||||
#: Docstring about the ``name`` attribute.
|
||||
name: Annotated[str, "attribute"]
|
||||
name: Annotated[str, 'attribute']
|
||||
|
||||
#: Docstring about the ``max_len`` attribute.
|
||||
max_len: list[Annotated[str, MaxLen(10, ['word_one', 'word_two'])]]
|
||||
|
||||
@@ -4,30 +4,35 @@ class A:
|
||||
|
||||
class B:
|
||||
"""A class having __init__(no docstring), no __new__"""
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class C:
|
||||
"""A class having __init__, no __new__"""
|
||||
|
||||
def __init__(self):
|
||||
"""__init__ docstring"""
|
||||
|
||||
|
||||
class D:
|
||||
"""A class having no __init__, __new__(no docstring)"""
|
||||
|
||||
def __new__(cls):
|
||||
pass
|
||||
|
||||
|
||||
class E:
|
||||
"""A class having no __init__, __new__"""
|
||||
|
||||
def __new__(cls):
|
||||
"""__new__ docstring"""
|
||||
|
||||
|
||||
class F:
|
||||
"""A class having both __init__ and __new__"""
|
||||
|
||||
def __init__(self):
|
||||
"""__init__ docstring"""
|
||||
|
||||
@@ -37,11 +42,13 @@ class F:
|
||||
|
||||
class G(C):
|
||||
"""A class inherits __init__ without docstring."""
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class H(E):
|
||||
"""A class inherits __new__ without docstring."""
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import io # NoQA: TC003
|
||||
from typing import Optional, overload
|
||||
|
||||
myint = int
|
||||
@@ -12,7 +12,7 @@ variable: myint
|
||||
variable2 = None # type: myint
|
||||
|
||||
#: docstring
|
||||
variable3: Optional[myint]
|
||||
variable3: Optional[myint] # NoQA: UP007
|
||||
|
||||
|
||||
def read(r: io.BytesIO) -> io.StringIO:
|
||||
@@ -25,13 +25,11 @@ def sum(x: myint, y: myint) -> myint:
|
||||
|
||||
|
||||
@overload
|
||||
def mult(x: myint, y: myint) -> myint:
|
||||
...
|
||||
def mult(x: myint, y: myint) -> myint: ...
|
||||
|
||||
|
||||
@overload
|
||||
def mult(x: float, y: float) -> float:
|
||||
...
|
||||
def mult(x: float, y: float) -> float: ...
|
||||
|
||||
|
||||
def mult(x, y):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from inspect import Parameter, Signature
|
||||
from typing import List, Union
|
||||
from typing import List, Union # NoQA: UP035
|
||||
|
||||
|
||||
class Foo:
|
||||
@@ -19,15 +19,20 @@ class Baz:
|
||||
|
||||
|
||||
class Qux:
|
||||
__signature__ = Signature(parameters=[Parameter('foo', Parameter.POSITIONAL_OR_KEYWORD),
|
||||
Parameter('bar', Parameter.POSITIONAL_OR_KEYWORD)])
|
||||
__signature__ = Signature(
|
||||
parameters=[
|
||||
Parameter('foo', Parameter.POSITIONAL_OR_KEYWORD),
|
||||
Parameter('bar', Parameter.POSITIONAL_OR_KEYWORD),
|
||||
]
|
||||
)
|
||||
|
||||
def __init__(self, x, y):
|
||||
pass
|
||||
|
||||
|
||||
class Quux(List[Union[int, float]]):
|
||||
class Quux(List[Union[int, float]]): # NoQA: UP006,UP007
|
||||
"""A subclass of List[Union[int, float]]"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ class AsyncClass:
|
||||
yield
|
||||
|
||||
|
||||
async def _other_coro_func():
|
||||
return "run"
|
||||
async def _other_coro_func(): # NoQA: RUF029
|
||||
return 'run'
|
||||
|
||||
|
||||
def myawait(f):
|
||||
@@ -31,6 +31,7 @@ def myawait(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
awaitable = f(*args, **kwargs)
|
||||
return asyncio.run(awaitable)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from functools import wraps
|
||||
|
||||
def deco1(func):
|
||||
"""docstring for deco1"""
|
||||
|
||||
@wraps(func)
|
||||
def wrapper():
|
||||
return func()
|
||||
@@ -12,11 +13,13 @@ def deco1(func):
|
||||
|
||||
def deco2(condition, message):
|
||||
"""docstring for deco2"""
|
||||
|
||||
def decorator(func):
|
||||
def wrapper():
|
||||
return func()
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class CustomDataDescriptor:
|
||||
|
||||
def meth(self):
|
||||
"""Function."""
|
||||
return "The Answer"
|
||||
return 'The Answer'
|
||||
|
||||
|
||||
class CustomDataDescriptorMeta(type):
|
||||
@@ -20,11 +20,12 @@ class CustomDataDescriptorMeta(type):
|
||||
|
||||
class CustomDataDescriptor2(CustomDataDescriptor):
|
||||
"""Descriptor class with custom metaclass docstring."""
|
||||
|
||||
__metaclass__ = CustomDataDescriptorMeta
|
||||
|
||||
|
||||
class Class:
|
||||
descr = CustomDataDescriptor("Descriptor instance docstring.")
|
||||
descr = CustomDataDescriptor('Descriptor instance docstring.')
|
||||
|
||||
@property
|
||||
def prop(self):
|
||||
|
||||
@@ -4,12 +4,14 @@ class A:
|
||||
|
||||
class B:
|
||||
"""B(foo, bar)"""
|
||||
|
||||
def __init__(self):
|
||||
"""B(foo, bar, baz)"""
|
||||
|
||||
|
||||
class C:
|
||||
"""C(foo, bar)"""
|
||||
|
||||
def __new__(cls):
|
||||
"""C(foo, bar, baz)"""
|
||||
|
||||
@@ -21,13 +23,13 @@ class D:
|
||||
|
||||
class E:
|
||||
def __init__(self):
|
||||
"""E(foo: int, bar: int, baz: int) -> None \\
|
||||
E(foo: str, bar: str, baz: str) -> None \\
|
||||
E(foo: float, bar: float, baz: float)"""
|
||||
r"""E(foo: int, bar: int, baz: int) -> None \
|
||||
E(foo: str, bar: str, baz: str) -> None \
|
||||
E(foo: float, bar: float, baz: float)""" # NoQA: D209
|
||||
|
||||
|
||||
class F:
|
||||
def __init__(self):
|
||||
"""F(foo: int, bar: int, baz: int) -> None
|
||||
F(foo: str, bar: str, baz: str) -> None
|
||||
F(foo: float, bar: float, baz: float)"""
|
||||
F(foo: float, bar: float, baz: float)""" # NoQA: D209
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
docsting of empty_all module.
|
||||
"""
|
||||
|
||||
__all__ = []
|
||||
|
||||
|
||||
|
||||
@@ -9,14 +9,16 @@ async def coroutinefunc():
|
||||
pass
|
||||
|
||||
|
||||
async def asyncgenerator():
|
||||
async def asyncgenerator(): # NoQA: RUF029
|
||||
yield
|
||||
|
||||
|
||||
partial_func = partial(func)
|
||||
partial_coroutinefunc = partial(coroutinefunc)
|
||||
|
||||
builtin_func = print
|
||||
partial_builtin_func = partial(print)
|
||||
|
||||
def slice_arg_func(arg: 'float64[:, :]'):
|
||||
|
||||
def slice_arg_func(arg: 'float64[:, :]'): # NoQA: F821
|
||||
pass
|
||||
|
||||
@@ -9,5 +9,6 @@ T = TypeVar('T')
|
||||
# __init__ signature.
|
||||
class A(Generic[T]):
|
||||
"""docstring for A"""
|
||||
|
||||
def __init__(self, a, b=None):
|
||||
pass
|
||||
|
||||
@@ -12,5 +12,6 @@ class Class:
|
||||
#: A list of int
|
||||
T = List[int]
|
||||
|
||||
|
||||
#: A list of Class
|
||||
L = List[Class]
|
||||
|
||||
@@ -10,7 +10,7 @@ class Base:
|
||||
"""Inherited class method."""
|
||||
|
||||
@staticmethod
|
||||
def inheritedstaticmeth(cls):
|
||||
def inheritedstaticmeth(cls): # NoQA: PLW0211
|
||||
"""Inherited static method."""
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@ class Derived(Base):
|
||||
pass
|
||||
|
||||
|
||||
class MyList(list):
|
||||
class MyList(list): # NoQA: FURB189
|
||||
def meth(self):
|
||||
"""docstring"""
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
"""
|
||||
Test case for #11387 corner case involving inherited
|
||||
members with type annotations on python 3.9 and earlier
|
||||
Test case for #11387 corner case involving inherited
|
||||
members with type annotations on python 3.9 and earlier
|
||||
"""
|
||||
|
||||
|
||||
class HasTypeAnnotatedMember:
|
||||
inherit_me: int
|
||||
"""Inherited"""
|
||||
|
||||
|
||||
class NoTypeAnnotation(HasTypeAnnotatedMember):
|
||||
a = 1
|
||||
"""Local"""
|
||||
|
||||
|
||||
class NoTypeAnnotation2(HasTypeAnnotatedMember):
|
||||
a = 1
|
||||
"""Local"""
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@ from .foo import bar
|
||||
|
||||
class foo:
|
||||
"""docstring of target.name_conflict::foo."""
|
||||
|
||||
pass
|
||||
|
||||
@@ -2,7 +2,7 @@ import missing_module
|
||||
import missing_package1.missing_module1
|
||||
from missing_module import missing_name
|
||||
from missing_package2 import missing_module2
|
||||
from missing_package3.missing_module3 import missing_name
|
||||
from missing_package3.missing_module3 import missing_name # NoQA: F811
|
||||
|
||||
import sphinx.missing_module4
|
||||
from sphinx.missing_module4 import missing_name2
|
||||
@@ -11,7 +11,7 @@ from sphinx.missing_module4 import missing_name2
|
||||
@missing_name(int)
|
||||
def decorated_function():
|
||||
"""decorated_function docstring"""
|
||||
return None
|
||||
return None # NoQA: RET501
|
||||
|
||||
|
||||
def func(arg: missing_module.Class):
|
||||
@@ -28,11 +28,12 @@ class TestAutodoc:
|
||||
@missing_name
|
||||
def decorated_method(self):
|
||||
"""TestAutodoc::decorated_method docstring"""
|
||||
return None
|
||||
return None # NoQA: RET501
|
||||
|
||||
|
||||
class Inherited(missing_module.Class):
|
||||
"""docstring"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -4,18 +4,15 @@ from typing import Any, overload
|
||||
|
||||
|
||||
@overload
|
||||
def sum(x: int, y: int = 0) -> int:
|
||||
...
|
||||
def sum(x: int, y: int = 0) -> int: ...
|
||||
|
||||
|
||||
@overload
|
||||
def sum(x: float, y: float = 0.0) -> float:
|
||||
...
|
||||
def sum(x: float, y: float = 0.0) -> float: ...
|
||||
|
||||
|
||||
@overload
|
||||
def sum(x: str, y: str = ...) -> str:
|
||||
...
|
||||
def sum(x: str, y: str = ...) -> str: ...
|
||||
|
||||
|
||||
def sum(x, y=None):
|
||||
@@ -27,16 +24,13 @@ class Math:
|
||||
"""docstring"""
|
||||
|
||||
@overload
|
||||
def sum(self, x: int, y: int = 0) -> int:
|
||||
...
|
||||
def sum(self, x: int, y: int = 0) -> int: ...
|
||||
|
||||
@overload
|
||||
def sum(self, x: float, y: float = 0.0) -> float:
|
||||
...
|
||||
def sum(self, x: float, y: float = 0.0) -> float: ...
|
||||
|
||||
@overload
|
||||
def sum(self, x: str, y: str = ...) -> str:
|
||||
...
|
||||
def sum(self, x: str, y: str = ...) -> str: ...
|
||||
|
||||
def sum(self, x, y=None):
|
||||
"""docstring"""
|
||||
@@ -47,12 +41,10 @@ class Foo:
|
||||
"""docstring"""
|
||||
|
||||
@overload
|
||||
def __new__(cls, x: int, y: int) -> Foo:
|
||||
...
|
||||
def __new__(cls, x: int, y: int) -> Foo: ...
|
||||
|
||||
@overload
|
||||
def __new__(cls, x: str, y: str) -> Foo:
|
||||
...
|
||||
def __new__(cls, x: str, y: str) -> Foo: ...
|
||||
|
||||
def __new__(cls, x, y):
|
||||
pass
|
||||
@@ -62,12 +54,10 @@ class Bar:
|
||||
"""docstring"""
|
||||
|
||||
@overload
|
||||
def __init__(cls, x: int, y: int) -> None:
|
||||
...
|
||||
def __init__(cls, x: int, y: int) -> None: ...
|
||||
|
||||
@overload
|
||||
def __init__(cls, x: str, y: str) -> None:
|
||||
...
|
||||
def __init__(cls, x: str, y: str) -> None: ...
|
||||
|
||||
def __init__(cls, x, y):
|
||||
pass
|
||||
@@ -75,12 +65,10 @@ class Bar:
|
||||
|
||||
class Meta(type):
|
||||
@overload
|
||||
def __call__(cls, x: int, y: int) -> Any:
|
||||
...
|
||||
def __call__(cls, x: int, y: int) -> Any: ...
|
||||
|
||||
@overload
|
||||
def __call__(cls, x: str, y: str) -> Any:
|
||||
...
|
||||
def __call__(cls, x: str, y: str) -> Any: ...
|
||||
|
||||
def __call__(cls, x, y):
|
||||
pass
|
||||
|
||||
@@ -8,5 +8,5 @@ def func1(a, b, c):
|
||||
|
||||
func2 = partial(func1, 1)
|
||||
func3 = partial(func2, 2)
|
||||
func3.__doc__ = "docstring of func3"
|
||||
func3.__doc__ = 'docstring of func3'
|
||||
func4 = partial(func3, 3)
|
||||
|
||||
@@ -7,32 +7,48 @@ CONSTANT = 'foo'
|
||||
SENTINEL = object()
|
||||
|
||||
|
||||
def foo(name: str = CONSTANT,
|
||||
sentinel: Any = SENTINEL,
|
||||
now: datetime = datetime.now(),
|
||||
color: int = 0xFFFFFF,
|
||||
*,
|
||||
kwarg1,
|
||||
kwarg2 = 0xFFFFFF) -> None:
|
||||
def foo(
|
||||
name: str = CONSTANT,
|
||||
sentinel: Any = SENTINEL,
|
||||
now: datetime = datetime.now(), # NoQA: B008,DTZ005
|
||||
color: int = 0xFFFFFF,
|
||||
*,
|
||||
kwarg1,
|
||||
kwarg2=0xFFFFFF,
|
||||
) -> None:
|
||||
"""docstring"""
|
||||
|
||||
|
||||
class Class:
|
||||
"""docstring"""
|
||||
|
||||
def meth(self, name: str = CONSTANT, sentinel: Any = SENTINEL,
|
||||
now: datetime = datetime.now(), color: int = 0xFFFFFF,
|
||||
*, kwarg1, kwarg2 = 0xFFFFFF) -> None:
|
||||
def meth(
|
||||
self,
|
||||
name: str = CONSTANT,
|
||||
sentinel: Any = SENTINEL,
|
||||
now: datetime = datetime.now(), # NoQA: B008,DTZ005
|
||||
color: int = 0xFFFFFF,
|
||||
*,
|
||||
kwarg1,
|
||||
kwarg2=0xFFFFFF,
|
||||
) -> None:
|
||||
"""docstring"""
|
||||
|
||||
@classmethod
|
||||
def clsmeth(cls, name: str = CONSTANT, sentinel: Any = SENTINEL,
|
||||
now: datetime = datetime.now(), color: int = 0xFFFFFF,
|
||||
*, kwarg1, kwarg2 = 0xFFFFFF) -> None:
|
||||
def clsmeth(
|
||||
cls,
|
||||
name: str = CONSTANT,
|
||||
sentinel: Any = SENTINEL,
|
||||
now: datetime = datetime.now(), # NoQA: B008,DTZ005
|
||||
color: int = 0xFFFFFF,
|
||||
*,
|
||||
kwarg1,
|
||||
kwarg2=0xFFFFFF,
|
||||
) -> None:
|
||||
"""docstring"""
|
||||
|
||||
|
||||
get_sentinel = lambda custom=SENTINEL: custom
|
||||
get_sentinel = lambda custom=SENTINEL: custom # NoQA: E731
|
||||
"""docstring"""
|
||||
|
||||
|
||||
@@ -44,17 +60,19 @@ class MultiLine:
|
||||
# only prop3 will not fail because it's on a single line whereas the others
|
||||
# will fail to parse.
|
||||
|
||||
# fmt: off
|
||||
prop1 = property(
|
||||
lambda self: 1, doc="docstring")
|
||||
lambda self: 1, doc='docstring')
|
||||
|
||||
prop2 = property(
|
||||
lambda self: 2, doc="docstring"
|
||||
lambda self: 2, doc='docstring'
|
||||
)
|
||||
|
||||
prop3 = property(lambda self: 3, doc="docstring")
|
||||
prop3 = property(lambda self: 3, doc='docstring')
|
||||
|
||||
prop4 = (property
|
||||
(lambda self: 4, doc="docstring"))
|
||||
(lambda self: 4, doc='docstring'))
|
||||
|
||||
prop5 = property\
|
||||
(lambda self: 5, doc="docstring")
|
||||
(lambda self: 5, doc='docstring') # NoQA: E211
|
||||
# fmt: on
|
||||
|
||||
@@ -9,7 +9,7 @@ SENTINEL = object()
|
||||
|
||||
|
||||
#: docstring
|
||||
ze_lambda = lambda z=SENTINEL: None
|
||||
ze_lambda = lambda z=SENTINEL: None # NoQA: E731
|
||||
|
||||
|
||||
def foo(x, y, z=SENTINEL):
|
||||
@@ -19,6 +19,7 @@ def foo(x, y, z=SENTINEL):
|
||||
@dataclass
|
||||
class DataClass:
|
||||
"""docstring"""
|
||||
|
||||
a: int
|
||||
b: object = SENTINEL
|
||||
c: list[int] = field(default_factory=lambda: [1, 2, 3])
|
||||
@@ -27,6 +28,7 @@ class DataClass:
|
||||
@dataclass(init=False)
|
||||
class DataClassNoInit:
|
||||
"""docstring"""
|
||||
|
||||
a: int
|
||||
b: object = SENTINEL
|
||||
c: list[int] = field(default_factory=lambda: [1, 2, 3])
|
||||
@@ -34,6 +36,7 @@ class DataClassNoInit:
|
||||
|
||||
class MyTypedDict(TypedDict):
|
||||
"""docstring"""
|
||||
|
||||
a: int
|
||||
b: object
|
||||
c: list[int]
|
||||
@@ -41,10 +44,11 @@ class MyTypedDict(TypedDict):
|
||||
|
||||
class MyNamedTuple1(NamedTuple):
|
||||
"""docstring"""
|
||||
|
||||
a: int
|
||||
b: object = object()
|
||||
c: list[int] = [1, 2, 3]
|
||||
|
||||
|
||||
class MyNamedTuple2(namedtuple('Base', ('a', 'b'), defaults=(0, SENTINEL))):
|
||||
class MyNamedTuple2(namedtuple('Base', ('a', 'b'), defaults=(0, SENTINEL))): # NoQA: PYI024,SLOT002
|
||||
"""docstring"""
|
||||
|
||||
@@ -4,6 +4,7 @@ def private_function(name):
|
||||
:meta private:
|
||||
"""
|
||||
|
||||
|
||||
def _public_function(name):
|
||||
"""public_function is a docstring().
|
||||
|
||||
|
||||
@@ -33,4 +33,3 @@ def _func_dict(arg: dict, kwarg=None):
|
||||
"""A function for dict."""
|
||||
# This function tests for specifying type through annotations
|
||||
pass
|
||||
|
||||
|
||||
@@ -7,9 +7,11 @@ class Foo:
|
||||
class Bar:
|
||||
"""docstring"""
|
||||
|
||||
__slots__ = {'attr1': 'docstring of attr1',
|
||||
'attr2': 'docstring of attr2',
|
||||
'attr3': None}
|
||||
__slots__ = {
|
||||
'attr1': 'docstring of attr1',
|
||||
'attr2': 'docstring of attr2',
|
||||
'attr3': None,
|
||||
}
|
||||
__annotations__ = {'attr1': int}
|
||||
|
||||
def __init__(self):
|
||||
@@ -19,4 +21,4 @@ class Bar:
|
||||
class Baz:
|
||||
"""docstring"""
|
||||
|
||||
__slots__ = 'attr'
|
||||
__slots__ = 'attr' # NoQA: PLC0205
|
||||
|
||||
@@ -8,8 +8,9 @@ attr3 = '' # type: str
|
||||
|
||||
class _Descriptor:
|
||||
def __init__(self, name):
|
||||
self.__doc__ = f"This is {name}"
|
||||
def __get__(self):
|
||||
self.__doc__ = f'This is {name}'
|
||||
|
||||
def __get__(self): # NoQA: PLE0302
|
||||
pass
|
||||
|
||||
|
||||
@@ -18,12 +19,14 @@ class Class:
|
||||
attr2: int
|
||||
attr3 = 0 # type: int
|
||||
|
||||
descr4: int = _Descriptor("descr4")
|
||||
descr4: int = _Descriptor('descr4')
|
||||
|
||||
def __init__(self):
|
||||
# fmt: off
|
||||
self.attr4: int = 0 #: attr4
|
||||
self.attr5: int #: attr5
|
||||
self.attr6 = 0 # type: int
|
||||
# fmt: on
|
||||
"""attr6"""
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pathlib
|
||||
from typing import Any, Tuple, TypeVar, Union
|
||||
from typing import Any, Tuple, TypeVar, Union # NoQA: UP035
|
||||
|
||||
CONST1: int
|
||||
#: docstring
|
||||
CONST2: int = 1
|
||||
#: docstring
|
||||
CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c")
|
||||
CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath('/a/b/c')
|
||||
#: docstring
|
||||
T = TypeVar("T", bound=pathlib.PurePosixPath)
|
||||
T = TypeVar('T', bound=pathlib.PurePosixPath)
|
||||
|
||||
|
||||
def incr(a: int, b: int = 1) -> int:
|
||||
return a + b
|
||||
|
||||
|
||||
def decr(a, b = 1):
|
||||
def decr(a, b=1):
|
||||
# type: (int, int) -> int
|
||||
return a - b
|
||||
|
||||
@@ -24,7 +24,7 @@ def decr(a, b = 1):
|
||||
class Math:
|
||||
CONST1: int
|
||||
CONST2: int = 1
|
||||
CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c")
|
||||
CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath('/a/b/c')
|
||||
|
||||
def __init__(self, s: str, o: Any = None) -> None:
|
||||
pass
|
||||
@@ -32,7 +32,7 @@ class Math:
|
||||
def incr(self, a: int, b: int = 1) -> int:
|
||||
return a + b
|
||||
|
||||
def decr(self, a, b = 1):
|
||||
def decr(self, a, b=1):
|
||||
# type: (int, int) -> int
|
||||
return a - b
|
||||
|
||||
@@ -40,10 +40,11 @@ class Math:
|
||||
# type: () -> None
|
||||
pass
|
||||
|
||||
def horse(self,
|
||||
a, # type: str
|
||||
b, # type: int
|
||||
):
|
||||
def horse(
|
||||
self,
|
||||
a, # type: str
|
||||
b, # type: int
|
||||
):
|
||||
# type: (...) -> None
|
||||
return
|
||||
|
||||
@@ -53,7 +54,7 @@ class Math:
|
||||
|
||||
@property
|
||||
def path(self) -> pathlib.PurePosixPath:
|
||||
return pathlib.PurePosixPath("/a/b/c")
|
||||
return pathlib.PurePosixPath('/a/b/c')
|
||||
|
||||
|
||||
def tuple_args(x: tuple[int, int | str]) -> tuple[int, int]:
|
||||
@@ -61,7 +62,7 @@ def tuple_args(x: tuple[int, int | str]) -> tuple[int, int]:
|
||||
|
||||
|
||||
class NewAnnotation:
|
||||
def __new__(cls, i: int) -> NewAnnotation:
|
||||
def __new__(cls, i: int) -> NewAnnotation: # NoQA: PYI034
|
||||
pass
|
||||
|
||||
|
||||
@@ -85,12 +86,13 @@ def complex_func(arg1, arg2, arg3=None, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def missing_attr(c,
|
||||
a, # type: str
|
||||
b=None # type: Optional[str]
|
||||
):
|
||||
def missing_attr(
|
||||
c,
|
||||
a, # type: str
|
||||
b=None, # type: Optional[str]
|
||||
):
|
||||
# type: (...) -> str
|
||||
return a + (b or "")
|
||||
return a + (b or '')
|
||||
|
||||
|
||||
class _ClassWithDocumentedInit:
|
||||
|
||||
@@ -4,29 +4,29 @@ from datetime import date
|
||||
from typing import NewType, TypeVar
|
||||
|
||||
#: T1
|
||||
T1 = TypeVar("T1")
|
||||
T1 = TypeVar('T1')
|
||||
|
||||
T2 = TypeVar("T2") # A TypeVar not having doc comment
|
||||
T2 = TypeVar('T2') # A TypeVar not having doc comment
|
||||
|
||||
#: T3
|
||||
T3 = TypeVar("T3", int, str)
|
||||
T3 = TypeVar('T3', int, str)
|
||||
|
||||
#: T4
|
||||
T4 = TypeVar("T4", covariant=True)
|
||||
T4 = TypeVar('T4', covariant=True) # NoQA: PLC0105
|
||||
|
||||
#: T5
|
||||
T5 = TypeVar("T5", contravariant=True)
|
||||
T5 = TypeVar('T5', contravariant=True) # NoQA: PLC0105
|
||||
|
||||
#: T6
|
||||
T6 = NewType("T6", date)
|
||||
T6 = NewType('T6', date)
|
||||
|
||||
#: T7
|
||||
T7 = TypeVar("T7", bound=int)
|
||||
T7 = TypeVar('T7', bound=int)
|
||||
|
||||
|
||||
class Class:
|
||||
#: T1
|
||||
T1 = TypeVar("T1")
|
||||
T1 = TypeVar('T1')
|
||||
|
||||
#: T6
|
||||
T6 = NewType("T6", date)
|
||||
T6 = NewType('T6', date)
|
||||
|
||||
@@ -2,16 +2,16 @@ from __future__ import annotations
|
||||
|
||||
from contextlib import contextmanager
|
||||
from functools import lru_cache
|
||||
from typing import Generator
|
||||
from typing import Generator # NoQA: UP035
|
||||
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
@lru_cache(maxsize=None) # NoQA: UP033
|
||||
def slow_function(message, timeout):
|
||||
"""This function is slow."""
|
||||
print(message)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def feeling_good(x: int, y: int) -> Generator:
|
||||
def feeling_good(x: int, y: int) -> Generator: # NoQA: UP006
|
||||
"""You'll feel better in this context!"""
|
||||
yield
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Union
|
||||
|
||||
|
||||
class Foo:
|
||||
class Bar:
|
||||
class Bar: # NoQA: D106
|
||||
pass
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -6,6 +6,6 @@ sys.path.insert(0, str(Path.cwd().resolve()))
|
||||
extensions = ['sphinx.ext.autosummary']
|
||||
autosummary_generate = True
|
||||
autosummary_filename_map = {
|
||||
"autosummary_dummy_module": "module_mangled",
|
||||
"autosummary_dummy_module.bar": "bar"
|
||||
'autosummary_dummy_module': 'module_mangled',
|
||||
'autosummary_dummy_module.bar': 'bar',
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import spam # Required for test.
|
||||
|
||||
class Ham:
|
||||
"""``spam.eggs.Ham`` class docstring."""
|
||||
|
||||
a = 1
|
||||
b = 2
|
||||
c = 3
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Bar:
|
||||
"""Bar class"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@ import unknown
|
||||
|
||||
class Foo(unknown.Class):
|
||||
"""Foo class"""
|
||||
|
||||
pass
|
||||
|
||||
@@ -10,4 +10,4 @@ def public_baz():
|
||||
"""Public Baz function"""
|
||||
|
||||
|
||||
__all__ = ["PublicBar", "public_foo", "public_baz", "extra_dummy_module"]
|
||||
__all__ = ['PublicBar', 'public_foo', 'public_baz', 'extra_dummy_module'] # NoQA: F822
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from os import *
|
||||
from os import * # NoQA: F403
|
||||
|
||||
|
||||
class Foo:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from os import *
|
||||
from os import * # NoQA: F403
|
||||
|
||||
|
||||
class Foo:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from os import *
|
||||
from os import * # NoQA: F403
|
||||
|
||||
|
||||
class Foo:
|
||||
|
||||
@@ -13,6 +13,7 @@ def skip_member(app, what, name, obj, skip, options):
|
||||
return True
|
||||
elif name == '_privatemeth':
|
||||
return False
|
||||
return None
|
||||
|
||||
|
||||
def setup(app):
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
class Class:
|
||||
pass
|
||||
pass
|
||||
|
||||
@@ -2,12 +2,11 @@ from autosummary_dummy_module import Foo
|
||||
|
||||
|
||||
class InheritedAttrClass(Foo):
|
||||
|
||||
def __init__(self):
|
||||
#: other docstring
|
||||
self.subclassattr = "subclassattr"
|
||||
self.subclassattr = 'subclassattr'
|
||||
|
||||
super().__init__()
|
||||
|
||||
|
||||
__all__ = ["InheritedAttrClass"]
|
||||
__all__ = ['InheritedAttrClass']
|
||||
|
||||
@@ -4,13 +4,13 @@ from typing import Union
|
||||
from autosummary_class_module import Class
|
||||
|
||||
__all__ = [
|
||||
"CONSTANT1",
|
||||
"Exc",
|
||||
"Foo",
|
||||
"_Baz",
|
||||
"bar",
|
||||
"qux",
|
||||
"path",
|
||||
'CONSTANT1',
|
||||
'Exc',
|
||||
'Foo',
|
||||
'_Baz',
|
||||
'bar',
|
||||
'qux',
|
||||
'path',
|
||||
]
|
||||
|
||||
#: module variable
|
||||
@@ -23,7 +23,7 @@ class Foo:
|
||||
CONSTANT3 = None
|
||||
CONSTANT4 = None
|
||||
|
||||
class Bar:
|
||||
class Bar: # NoQA: D106
|
||||
pass
|
||||
|
||||
def __init__(self):
|
||||
@@ -42,7 +42,7 @@ class _Baz:
|
||||
pass
|
||||
|
||||
|
||||
def bar(x: Union[int, str], y: int = 1) -> None:
|
||||
def bar(x: Union[int, str], y: int = 1) -> None: # NoQA: UP007
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""This module is intentionally not documented."""
|
||||
|
||||
|
||||
class Missing:
|
||||
"""An undocumented class."""
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@ extensions = ['sphinx.ext.doctest']
|
||||
project = 'test project for the doctest :skipif: directive'
|
||||
root_doc = 'skipif'
|
||||
source_suffix = {
|
||||
'.txt': 'restructuredtext'
|
||||
'.txt': 'restructuredtext',
|
||||
}
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
doctest_global_setup = '''
|
||||
doctest_global_setup = """
|
||||
from tests.test_extensions.test_ext_doctest import record
|
||||
|
||||
record('doctest_global_setup', 'body', True)
|
||||
'''
|
||||
"""
|
||||
|
||||
doctest_global_cleanup = '''
|
||||
doctest_global_cleanup = """
|
||||
record('doctest_global_cleanup', 'body', True)
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -3,6 +3,6 @@ extensions = ['sphinx.ext.doctest']
|
||||
project = 'test project for doctest'
|
||||
root_doc = 'doctest'
|
||||
source_suffix = {
|
||||
'.txt': 'restructuredtext'
|
||||
'.txt': 'restructuredtext',
|
||||
}
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
extensions = ['sphinx.ext.graphviz']
|
||||
exclude_patterns = ['_build']
|
||||
html_static_path = ["_static"]
|
||||
html_static_path = ['_static']
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
"""
|
||||
Does foo.svg --> foo.pdf with no change to the file.
|
||||
"""
|
||||
"""Does foo.svg --> foo.pdf with no change to the file."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -18,5 +18,5 @@ class DocMainLevel(Foo):
|
||||
pass
|
||||
|
||||
|
||||
class Alice(object):
|
||||
class Alice(object): # NoQA: UP004
|
||||
pass
|
||||
|
||||
@@ -4,7 +4,7 @@ from docutils.parsers.rst import Directive
|
||||
extensions = ['sphinx.ext.mathjax']
|
||||
|
||||
|
||||
def my_math_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||
def my_math_role(role, rawtext, text, lineno, inliner, options={}, content=[]): # NoQA: B006
|
||||
text = 'E = mc^2'
|
||||
return [nodes.math(text, text)], []
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ sys.path.insert(0, str(Path.cwd().resolve()))
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.intersphinx'
|
||||
'sphinx.ext.intersphinx',
|
||||
]
|
||||
|
||||
# Python inventory is manually created in the test
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Bar:
|
||||
"""The bar."""
|
||||
|
||||
def list(self) -> None:
|
||||
"""A list method."""
|
||||
|
||||
@@ -7,4 +8,3 @@ class Bar:
|
||||
def int() -> float:
|
||||
"""An int method."""
|
||||
return 1.0
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Foo:
|
||||
"""The foo."""
|
||||
|
||||
def do(
|
||||
self,
|
||||
*,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""
|
||||
submodule
|
||||
"""
|
||||
raise RuntimeError('This module should not get imported')
|
||||
|
||||
raise RuntimeError('This module should not get imported') # NoQA: EM101
|
||||
|
||||
|
||||
def decorator(f):
|
||||
@@ -27,5 +28,6 @@ class Class3:
|
||||
"""
|
||||
this is Class3
|
||||
"""
|
||||
|
||||
class_attr = 42
|
||||
"""this is the class attribute class_attr"""
|
||||
|
||||
@@ -7,17 +7,17 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
|
||||
if 'test_linkcode' in tags:
|
||||
if 'test_linkcode' in tags: # NoQA: F821 (tags is injected into conf.py)
|
||||
extensions.remove('sphinx.ext.viewcode')
|
||||
extensions.append('sphinx.ext.linkcode')
|
||||
|
||||
def linkcode_resolve(domain, info):
|
||||
if domain == 'py':
|
||||
fn = info['module'].replace('.', '/')
|
||||
return "https://foobar/source/%s.py" % fn
|
||||
elif domain == "js":
|
||||
return "https://foobar/js/" + info['fullname']
|
||||
elif domain in ("c", "cpp"):
|
||||
return f"https://foobar/{domain}/{''.join(info['names'])}"
|
||||
return 'https://foobar/source/%s.py' % fn
|
||||
elif domain == 'js':
|
||||
return 'https://foobar/js/' + info['fullname']
|
||||
elif domain in {'c', 'cpp'}:
|
||||
return f'https://foobar/{domain}/{"".join(info["names"])}'
|
||||
else:
|
||||
raise AssertionError()
|
||||
raise AssertionError
|
||||
|
||||
@@ -26,5 +26,6 @@ class Class3:
|
||||
"""
|
||||
this is Class3
|
||||
"""
|
||||
|
||||
class_attr = 42
|
||||
"""this is the class attribute class_attr"""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
def setup(app):
|
||||
return {
|
||||
'parallel_read_safe': True
|
||||
'parallel_read_safe': True,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
def setup(app):
|
||||
return {
|
||||
'parallel_read_safe': False
|
||||
'parallel_read_safe': False,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
def setup(app):
|
||||
return {
|
||||
'parallel_write_safe': False
|
||||
'parallel_write_safe': False,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
highlight_options = {
|
||||
'default': {'default_option': True},
|
||||
'python': {'python_option': True}
|
||||
'python': {'python_option': True},
|
||||
}
|
||||
|
||||
@@ -3,10 +3,18 @@ version = '1.4.4'
|
||||
|
||||
html_static_path = ['static', 'subdir']
|
||||
html_extra_path = ['extra', 'subdir']
|
||||
html_css_files = ['css/style.css',
|
||||
('https://example.com/custom.css',
|
||||
{'title': 'title', 'media': 'print', 'priority': 400})]
|
||||
html_js_files = ['js/custom.js',
|
||||
('https://example.com/script.js',
|
||||
{'async': 'async', 'priority': 400})]
|
||||
html_css_files = [
|
||||
'css/style.css',
|
||||
(
|
||||
'https://example.com/custom.css',
|
||||
{'title': 'title', 'media': 'print', 'priority': 400},
|
||||
),
|
||||
]
|
||||
html_js_files = [
|
||||
'js/custom.js',
|
||||
(
|
||||
'https://example.com/script.js',
|
||||
{'async': 'async', 'priority': 400},
|
||||
),
|
||||
]
|
||||
exclude_patterns = ['**/_build', '**/.htpasswd']
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
rst_epilog = '''
|
||||
rst_epilog = """
|
||||
.. |picture| image:: pic.png
|
||||
:height: 1cm
|
||||
:scale: 200%
|
||||
:align: middle
|
||||
:alt: alternative_text
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
rst_epilog = '''
|
||||
rst_epilog = """
|
||||
.. |picture| image:: pic.png
|
||||
:width: 15pt
|
||||
:height: 15pt
|
||||
:alt: alternative_text
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -8,7 +8,7 @@ r"""
|
||||
/ \ / \
|
||||
E D F
|
||||
|
||||
"""
|
||||
""" # NoQA: D208
|
||||
|
||||
|
||||
class A:
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"""Test with nested classes.
|
||||
"""
|
||||
"""Test with nested classes."""
|
||||
|
||||
|
||||
class A:
|
||||
class B:
|
||||
class B: # NoQA: D106
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
project = 'Sphinx intl <Tests>'
|
||||
source_suffix = {
|
||||
'.txt': 'restructuredtext'
|
||||
'.txt': 'restructuredtext',
|
||||
}
|
||||
keep_warnings = True
|
||||
templates_path = ['_templates']
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
latex_elements = {
|
||||
'preamble': r'''
|
||||
'preamble': r"""
|
||||
\makeatletter
|
||||
\def\dividetwolengths#1#2{\the\dimexpr
|
||||
\numexpr65536*\dimexpr#1\relax/\dimexpr#2\relax sp}%
|
||||
@@ -43,5 +43,5 @@ latex_elements = {
|
||||
}
|
||||
\def\sphinxincludegraphics#1#{\tempincludegraphics#1}
|
||||
\makeatother
|
||||
''',
|
||||
""",
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
"""docstring"""
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
"""docstring"""
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
"""docstring"""
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
"""docstring"""
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
extensions = ['sphinx.ext.imgmath'] # for math_numfig
|
||||
|
||||
latex_documents = [
|
||||
('indexmanual', 'SphinxManual.tex', 'Test numfig manual',
|
||||
'Sphinx', 'manual'),
|
||||
('indexhowto', 'SphinxHowTo.tex', 'Test numfig howto',
|
||||
'Sphinx', 'howto'),
|
||||
('indexmanual', 'SphinxManual.tex', 'Test numfig manual', 'Sphinx', 'manual'),
|
||||
('indexhowto', 'SphinxHowTo.tex', 'Test numfig howto', 'Sphinx', 'howto'),
|
||||
]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user