Skip to content

Commit 5848b41

Browse files
authored
add relative_deadline docstring (#3241)
1 parent ff4ef57 commit 5848b41

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

docs/source/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ def autodoc_process_signature(
171171
# currently undocumented things
172172
logger = getLogger("trio")
173173
UNDOCUMENTED = {
174-
"trio.CancelScope.relative_deadline",
175174
"trio.MemorySendChannel",
176175
"trio.MemoryReceiveChannel",
177176
"trio.MemoryChannelStatistics",
@@ -201,7 +200,9 @@ def autodoc_process_docstring(
201200
logger.warning(f"{name} has no docstring")
202201
else:
203202
if name in UNDOCUMENTED:
204-
logger.warning("outdated list of undocumented things")
203+
logger.warning(
204+
f"outdated list of undocumented things in docs/source/conf.py: {name!r} has a docstring"
205+
)
205206

206207

207208
def setup(app: Sphinx) -> None:

src/trio/_core/_run.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,18 @@ def deadline(self, new_deadline: float) -> None:
802802

803803
@property
804804
def relative_deadline(self) -> float:
805+
"""Read-write, :class:`float`. The number of seconds remaining until this
806+
scope's deadline, relative to the current time.
807+
808+
Defaults to :data:`math.inf` ("no deadline"). Must be non-negative.
809+
810+
When modified
811+
Before entering: sets the deadline relative to when the scope enters.
812+
After entering: sets a new deadline relative to the current time.
813+
814+
Raises:
815+
RuntimeError: if trying to read or modify an unentered scope with an absolute deadline, i.e. when :attr:`is_relative` is ``False``.
816+
"""
805817
if self._has_been_entered:
806818
return self._deadline - current_time()
807819
elif self._deadline != inf:

0 commit comments

Comments
 (0)