Fix type annotations in triggers.py for mypy compliance#603
Merged
gnachman merged 1 commit intognachman:masterfrom Mar 2, 2026
Merged
Fix type annotations in triggers.py for mypy compliance#603gnachman merged 1 commit intognachman:masterfrom
gnachman merged 1 commit intognachman:masterfrom
Conversation
- decode_trigger: return Union[Trigger, EventTrigger] since EventTrigger is not a Trigger subclass - BellTrigger._param: fix return type None -> str - BounceTrigger: fix forward references from 'iterm2.Trigger.BounceTrigger.Action' to 'BounceTrigger.Action' - PasswordTrigger.user_name: return Optional[str] to match __init__ - CommandFinishedEventTrigger.deserialize: annotate exit_code_filter local as Union[ExitCodeFilter, int] - LongRunningCommandEventTrigger.__init__: annotate event_params as Dict[str, Any] to allow mixed value types
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
Fixes 8 mypy errors (6 distinct issues) in
triggers.py:decode_triggerreturn type ([return-value]): ReturnsEventTriggerwhich is not aTriggersubclass. Changed return type toUnion[Trigger, EventTrigger].BellTrigger._paramreturn type ([return-value]): Typed-> Nonebut returns"". Changed to-> str.BounceTrigger.Actionforward references ([name-defined], 3 locations):'iterm2.Trigger.BounceTrigger.Action'is not a valid name path. Changed to'BounceTrigger.Action'.PasswordTrigger.user_namereturn type ([return-value]):__init__acceptsuser_name: Optional[str]but property was typed-> str. Changed to-> Optional[str].CommandFinishedEventTrigger.deserializelocal variable ([assignment]):exit_code_filterstarts asExitCodeFilterbut can be assignedint. Added explicit type annotationUnion[ExitCodeFilter, int].LongRunningCommandEventTrigger.__init__dict type ([assignment]):event_paramsinferred asDict[str, float]from{"threshold": threshold}but later assignedstrvalue. Added explicit annotationDict[str, Any].