Modernize type hints and dispatchers for Python 3.10+#451
Merged
thomaspatzke merged 7 commits intomainfrom Apr 6, 2026
Merged
Conversation
…ll source files Agent-Logs-Url: https://github.com/SigmaHQ/pySigma/sessions/a1b7f6ab-a5e7-4231-8851-52b5b2ecd426 Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
…lace isinstance tuple patterns with union syntax Agent-Logs-Url: https://github.com/SigmaHQ/pySigma/sessions/a1b7f6ab-a5e7-4231-8851-52b5b2ecd426 Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SigmaHQ/pySigma/sessions/a1b7f6ab-a5e7-4231-8851-52b5b2ecd426 Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SigmaHQ/pySigma/sessions/a1b7f6ab-a5e7-4231-8851-52b5b2ecd426 Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
… mangled comment in detection.py Agent-Logs-Url: https://github.com/SigmaHQ/pySigma/sessions/a1b7f6ab-a5e7-4231-8851-52b5b2ecd426 Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SigmaHQ/pySigma/sessions/a1b7f6ab-a5e7-4231-8851-52b5b2ecd426 Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
thomaspatzke
April 6, 2026 08:23
View session
thomaspatzke
approved these changes
Apr 6, 2026
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.
Since pySigma requires Python 3.10+, modernize the codebase to use contemporary syntax that was previously unavailable.
Type annotations → PEP 604 union syntax
Union[X, Y]→X | Y(~170 occurrences)Optional[X]→X | None(~156 occurrences)Dict,List,Set,Pattern→dict,list,set,re.PatternCondition dispatchers →
match/caseConverted the three isinstance dispatch chains in
conversion/base.py(convert_condition_field_eq_val,convert_condition_val,convert_condition) to structural pattern matching.Runtime type inspection compatibility
X | Yproducestypes.UnionTypeat runtime, nottyping.Union. Updated the two places that inspect types at runtime:modifiers.py:type_check()now handles bothUnionandUnionTypetransformations/base.py: Switched from__annotations__toget_type_hints()(required withfrom __future__ import annotations) and addedUnionTypehandling