diff --git a/autoapi/directives.py b/autoapi/directives.py index ee5e3ec..121803b 100644 --- a/autoapi/directives.py +++ b/autoapi/directives.py @@ -41,7 +41,6 @@ class AutoapiSummary(Autosummary): class NestedParse(Directive): - """Nested parsing to remove the first heading of included rST This is used to handle the case where we like to remove user supplied diff --git a/autoapi/extension.py b/autoapi/extension.py index 8fa740a..a95e512 100644 --- a/autoapi/extension.py +++ b/autoapi/extension.py @@ -2,6 +2,7 @@ This extension allows you to automagically generate API documentation from your project. """ + import io import os import shutil diff --git a/autoapi/mappers/base.py b/autoapi/mappers/base.py index 47dae64..2d92cec 100644 --- a/autoapi/mappers/base.py +++ b/autoapi/mappers/base.py @@ -20,7 +20,6 @@ Path = namedtuple("Path", ["absolute", "relative"]) class PythonMapperBase: - """Base object for JSON -> Python object mapping. Subclasses of this object will handle their language specific JSON input, @@ -163,7 +162,6 @@ class PythonMapperBase: class SphinxMapperBase: - """Base class for mapping `PythonMapperBase` objects to Sphinx. Args: diff --git a/autoapi/mappers/python/mapper.py b/autoapi/mappers/python/mapper.py index 90db866..d7a9db9 100644 --- a/autoapi/mappers/python/mapper.py +++ b/autoapi/mappers/python/mapper.py @@ -216,7 +216,6 @@ def _link_objs(value): class PythonSphinxMapper(SphinxMapperBase): - """Auto API domain handler for Python Parses directly from Python files. diff --git a/docs/changes/+af2042c3.misc b/docs/changes/+af2042c3.misc new file mode 100644 index 0000000..aad730b --- /dev/null +++ b/docs/changes/+af2042c3.misc @@ -0,0 +1 @@ +Reformatted to latest stable black style. \ No newline at end of file diff --git a/tests/python/py3example/example/example.py b/tests/python/py3example/example/example.py index 816d72e..ebe26c0 100644 --- a/tests/python/py3example/example/example.py +++ b/tests/python/py3example/example/example.py @@ -51,26 +51,21 @@ mixed_list: List[Union[str, int]] = [1, "two", 3] "This is mixed" -def f2(not_yet_a: "A") -> int: - ... +def f2(not_yet_a: "A") -> int: ... -def f3(imported: B) -> B: - ... +def f3(imported: B) -> B: ... -class MyGeneric(Generic[T, U]): - ... +class MyGeneric(Generic[T, U]): ... @overload -def overloaded_func(a: float) -> float: - ... +def overloaded_func(a: float) -> float: ... @typing.overload -def overloaded_func(a: str) -> str: - ... +def overloaded_func(a: str) -> str: ... def overloaded_func(a: Union[float, str]) -> Union[float, str]: @@ -79,8 +74,7 @@ def overloaded_func(a: Union[float, str]) -> Union[float, str]: @overload -def undoc_overloaded_func(a: str) -> str: - ... +def undoc_overloaded_func(a: str) -> str: ... def undoc_overloaded_func(a: str) -> str: @@ -112,33 +106,28 @@ class A: return "method" @overload - def overloaded_method(self, a: float) -> float: - ... + def overloaded_method(self, a: float) -> float: ... @typing.overload - def overloaded_method(self, a: str) -> str: - ... + def overloaded_method(self, a: str) -> str: ... def overloaded_method(self, a: Union[float, str]) -> Union[float, str]: """Overloaded method""" return a * 2 @overload - def undoc_overloaded_method(self, a: float) -> float: - ... + def undoc_overloaded_method(self, a: float) -> float: ... def undoc_overloaded_method(self, a: float) -> float: return a * 2 @typing.overload @classmethod - def overloaded_class_method(cls, a: float) -> float: - ... + def overloaded_class_method(cls, a: float) -> float: ... @overload @classmethod - def overloaded_class_method(cls, a: str) -> str: - ... + def overloaded_class_method(cls, a: str) -> str: ... @classmethod def overloaded_class_method(cls, a: Union[float, str]) -> Union[float, str]: @@ -148,23 +137,18 @@ class A: class C: @overload - def __init__(self, a: int) -> None: - ... + def __init__(self, a: int) -> None: ... @typing.overload - def __init__(self, a: float) -> None: - ... + def __init__(self, a: float) -> None: ... - def __init__(self, a: str): - ... + def __init__(self, a: str): ... class D(C): - class Da: - ... + class Da: ... - class DB(Da): - ... + class DB(Da): ... ... @@ -184,5 +168,4 @@ async def async_function(wait: bool) -> int: global_a: A = A() -class SomeMetaclass(type): - ... +class SomeMetaclass(type): ... diff --git a/tests/python/pyiexample/example/example.pyi b/tests/python/pyiexample/example/example.pyi index d01e3e7..f0c7bb4 100644 --- a/tests/python/pyiexample/example/example.pyi +++ b/tests/python/pyiexample/example/example.pyi @@ -26,12 +26,15 @@ class Foo(object): def foo(): """The foo class method""" ... + def __init__(self, attr): """Constructor docstring""" ... + def method_okay(self, foo=None, bar=None): """This method should parse okay""" ... + def method_multiline(self, foo=None, bar=None, baz=None): """This is on multiple lines, but should parse okay too @@ -39,4 +42,5 @@ class Foo(object): definitions are covered in the way we're anticipating here """ ... + def method_without_docstring(self): ... diff --git a/tests/python/pypackageexample/example/__init__.py b/tests/python/pypackageexample/example/__init__.py index 1da5b3a..44c208d 100644 --- a/tests/python/pypackageexample/example/__init__.py +++ b/tests/python/pypackageexample/example/__init__.py @@ -1,4 +1,5 @@ """This is a docstring.""" + from . import foo