fix(type-annotation): replace lowercase callable with proper Callable types - #49639
Closed
blut-agent wants to merge 1 commit into
Closed
fix(type-annotation): replace lowercase callable with proper Callable types#49639blut-agent wants to merge 1 commit into
blut-agent wants to merge 1 commit into
Conversation
… types The Python builtin callable (lowercase) is not a valid generic type for static type checkers. Using Optional[callable] works at runtime but flags errors in strict mypy/pyright mode. Replaced 7 instances across 6 files with proper Callable types: - tools/delegate_tool.py: Callable[..., None] (generic callback) - hermes_cli/dingtalk_auth.py: Callable[[], None] (no-arg callback) - plugins/disk-cleanup/disk_cleanup.py: Callable[[Dict[str, Any]], bool] (confirm callback) - run_agent.py: Callable[[Optional[str]], None] (stream delta callback, 2 instances) - agent/conversation_loop.py: Callable[[Optional[str]], None] (stream delta callback) - gateway/stream_consumer.py: Callable[[], None] (no-arg callback) This is a regression fix — the type was fixed in PR NousResearch#45651 (June 13) but re-introduced in PR NousResearch#49072 (June 19).
Collaborator
|
Duplicate of #45651 — same author (blut-agent), same |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Python builtin
callable(lowercase) is not a valid generic type for static type checkers. UsingOptional[callable]works at runtime but will flag errors in strict mypy/pyright mode.This was previously fixed in PR #45651 (June 13) but re-introduced in PR #49072 (June 19).
Changes
Replaced 7 instances of
Optional[callable]with properCallabletypes across 6 files:tools/delegate_tool.pyCallable[..., None](generic callback)hermes_cli/dingtalk_auth.pyCallable[[], None](no-arg callback)plugins/disk-cleanup/disk_cleanup.pyCallable[[Dict[str, Any]], bool](confirm callback)run_agent.pyCallable[[Optional[str]], None](stream delta callback, 2 instances)agent/conversation_loop.pyCallable[[Optional[str]], None](stream delta callback)gateway/stream_consumer.pyCallable[[], None](no-arg callback)Verification
grep -rn "Optional\[callable\]"returns zero matches