refactor: convert isinstance chains to match/case (part 5)#36503
Merged
asukaminato0721 merged 1 commit intoMay 31, 2026
Merged
Conversation
Contributor
Pyrefly Type Coverage
|
Convert isinstance chains to Python 3.10+ match/case in trace providers: - aliyun_trace.py - arize_phoenix_trace.py - langfuse_trace.py - langsmith_trace.py - opik_trace.py - weave_trace.py Changes: - Replace if/isinstance chains with structural pattern matching - Add wildcard case _: for exhaustive matching - Restore logger.debug in weave_trace.py - Preserve existing logging and try/except blocks Refs: langgenius#35902
auto-merge was automatically disabled
May 31, 2026 02:49
Head branch was pushed to by a user without write access
4e7b01e to
9373421
Compare
asukaminato0721
approved these changes
May 31, 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.
Refs #35902
Continuing the isinstance → match/case refactoring series.
Changes
core/workflow/node_runtime.py
_map_tool_message: 8 isinstance checks → match/case forToolInvokeMessagesubtypes_map_invocation_exception: 4 isinstance checks → match/case for exception typesenterprise/telemetry/enterprise_trace.py
trace(): 10-way isinstance dispatch → match/case forBaseTraceInfosubtypesTrace providers (8 files)
trace(): 7-way isinstance dispatch → match/case in all trace providers: