Skip to content

Commit daea4c6

Browse files
committed
use type annotations in API docs
1 parent 64cd194 commit daea4c6

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

caf/graph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class Action(Enum):
4242
EXECUTE = 1
4343
TRAVERSE = 2
4444

45+
def __repr__(self) -> str:
46+
return self.name
47+
4548

4649
class Step(NamedTuple):
4750
action: Action

caf/sessions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def add_side_effect_of(self, caller: Task[object], callee: Task[object]) -> None
222222
def create_task(
223223
self, corofunc: Corofunc[_T], *args: Any, **kwargs: Any
224224
) -> Task[_T]:
225-
"""Create new task.
225+
"""Create a new task.
226226
227227
:param corofunc: a coroutine function to be executed
228228
:param args: arguments to the coroutine

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import os
22
import sys
33
import datetime
4+
import warnings
45

56
import toml
67

78
sys.path.insert(0, os.path.abspath('..'))
89

10+
warnings.filterwarnings('ignore', r'formatargspec\(\) is now deprecated.')
11+
912
with open('../pyproject.toml') as f:
1013
metadata = toml.load(f)['tool']['poetry']
1114

@@ -19,6 +22,7 @@
1922
'sphinx.ext.todo',
2023
'sphinx.ext.viewcode',
2124
'sphinxcontrib.asyncio',
25+
'sphinx_autodoc_typehints',
2226
]
2327
source_suffix = '.rst'
2428
master_doc = 'index'

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,20 @@ toml = { version = "^0.9.6", optional = true }
3838
click = { version = "^7.0", optional = true }
3939
pytest-mock = { version = "^1.10", optional = true }
4040
sphinxcontrib-asyncio = { version = "^0.2.0", optional = true }
41+
sphinx-autodoc-typehints = { version = "^1.3", optional = true }
4142

4243
[tool.poetry.extras]
4344
cli = ["click", "toml"]
4445
graphviz = ["graphviz"]
4546
sci = ["numpy", "textx"]
4647
test = ["pytest", "pytest-mock"]
4748
cov = ["coverage"]
48-
doc = ["sphinx", "toml", "sphinxcontrib-asyncio"]
49+
doc = [
50+
"sphinx",
51+
"toml",
52+
"sphinxcontrib-asyncio",
53+
"sphinx-autodoc-typehints"
54+
]
4955

5056
[tool.poetry.dev-dependencies]
5157
mypy = "^0.641.0"

0 commit comments

Comments
 (0)