Skip to content

Python: drop a Returns section from a method that returns None - #10203

Open
Hyacinth-of-Security (lxcxjxhx) wants to merge 3 commits into
microsoft:mainfrom
lxcxjxhx:python/drop-none-returns
Open

Hyacinth-of-Security (lxcxjxhx) wants to merge 3 commits into
microsoft:mainfrom
lxcxjxhx:python/drop-none-returns

Conversation

@lxcxjxhx

Copy link
Copy Markdown
Contributor

RunnerImpl.restore_from_checkpoint is annotated -> None and returns nothing, but its docstring documents a return value:

    async def restore_from_checkpoint(
        self,
        checkpoint_id: CheckpointID,
        checkpoint_storage: CheckpointStorage | None = None,
    ) -> None:
        """Restore the runner from a checkpoint.

        Args:
            checkpoint_id: The ID of the checkpoint to restore from
            checkpoint_storage: Optional storage to load checkpoints from when the
                runner context itself is not configured with checkpointing.

        Returns:
            None on success.

        Raises:
            WorkflowCheckpointException on failure.
        """

Returns: None on success. carries nothing the -> None annotation and the Raises: section do not already say, and it is the same shape as #10168, which dropped a Returns: block from a method that returns None.

Change

Removes the three-line Returns: block; Args: and Raises: stay. One file, −3 lines, no code touched.

How it was found

A sweep over python/packages/core/agent_framework that parses each function with ast, checks whether the docstring has a Returns:/Return: section, and then looks for a return <value> in that function's own body — nested functions and classes are skipped so their returns do not count. Functions that are abstract stubs (only pass, ..., or raise NotImplementedError) are excluded, which is what removes the large majority of hits: 1993 documented functions scanned, 53 with a Returns: and no value return, and after excluding stubs and nested scopes, this is the only one left.

Worth noting how the filter behaved on the others, since it is the difference between a report and noise: _clients.py, _skills.py, _harness/_file_access.py and similar hits are all raise NotImplementedError protocol members whose annotated return value is documented for implementers, which is correct as written.

`restore_from_checkpoint` is annotated `-> None` and never returns a value, so the
`Returns: None on success.` block repeats the annotation. Same shape as microsoft#10168.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block this documentation-only cleanup of a redundant return-value description.

No open issues 🎉

What changed in this PR

This documentation-only change removes a redundant return-value description from the Python workflow runner, consistent with the cleanup in #10168.

Changes:

  • Removes Returns: None on success. from RunnerImpl.restore_from_checkpoint.
  • Preserves the Args: and Raises: sections; signatures and runtime behavior are unchanged.
File Description
python/​packages/​core/​agent_framework/​_workflows/​_runner.py Removes the redundant Returns: block from the checkpoint restoration docstring.

Review effort: Balanced

This branch was previously deployed

1 inactive deployment
github-app-auth — 890186fc Deployed Nov 10, 2026 by lxcxjxhx via add_label #27452
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants