Skip to content

Commit 669d424

Browse files
author
Joel Collins
committed
Added missing docstrings
1 parent c5ed188 commit 669d424

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

labthings/server/spec/utilities.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,27 @@
99
from collections import Mapping
1010

1111

12-
def update_spec(obj, spec):
12+
def update_spec(obj, spec: dict):
13+
"""Add API spec data to an object
14+
15+
Args:
16+
obj: Python object
17+
spec (dict): Dictionary of API spec data to add
18+
"""
1319
obj.__apispec__ = obj.__dict__.get("__apispec__", {})
1420
rupdate(obj.__apispec__, spec)
1521
return obj.__apispec__ or {}
1622

1723

1824
def get_spec(obj):
25+
"""Get the __apispec__ dictionary created by LabThings decorators for a particular object
26+
27+
Args:
28+
obj: Python object
29+
30+
Returns:
31+
dict: API spec dictionary. Returns empty dictionary if no spec is found.
32+
"""
1933
obj.__apispec__ = obj.__dict__.get("__apispec__", {})
2034
return obj.__apispec__ or {}
2135

0 commit comments

Comments
 (0)