sphinx/tests/roots/test-ext-autodoc/target/preserve_defaults.py
Takeshi KOMIYA 1ea11b1e48 Fix #759: autodoc: Add sphinx.ext.autodoc.preserve_defaults extension
Add a new extension `sphinx.ext.autodoc.preserve_defaults`.

It preserves the default argument values of function signatures in source code
and keep them not evaluated for readability.  This is an experimental
extension and it will be integrated into autodoc core in Sphinx-4.0.
2021-03-06 18:48:18 +09:00

20 lines
407 B
Python

from datetime import datetime
from typing import Any
CONSTANT = 'foo'
SENTINEL = object()
def foo(name: str = CONSTANT,
sentinal: Any = SENTINEL,
now: datetime = datetime.now()) -> None:
"""docstring"""
class Class:
"""docstring"""
def meth(self, name: str = CONSTANT, sentinal: Any = SENTINEL,
now: datetime = datetime.now()) -> None:
"""docstring"""