fix: resolve Python 3 migration runtime errors and compatibility issues - #733
Conversation
This commit fixes critical bugs in the Python 3 modernization that were causing GitHub Actions workflow failures in the "Test McBopomofo" step. Fixes in score_validator.py: - Add missing 'phrases' parameter to 20+ seg_pick() calls (lines 155, 166, 168, 175, 198, 214, 229, 240, 242, 249, 273, 290, 306, 321, 332, 334, 341) - Add missing 'phrases' parameter to three_char_walk() calls (lines 216, 292, 308) - Fix incorrect walker function call: four_char_walk -> five_char_walk (line 275) - Optimize control flow by converting multiple if statements to elif chain in check_bpmf_output() function to prevent redundant execution Fixes in phrase_deriver.py: - Remove zip(strict=True) for Python 3.9+ compatibility (strict parameter requires Python 3.10+) - Length validation already performed before zip, so strict mode redundant All fixes verified with: - Syntax validation (py_compile) - Full data build (make all) - Data integrity checks (make check) - Score validator execution These changes resolve the TypeErrors that were preventing the workflow from completing successfully.
Summary of ChangesHello @tianjianjiang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses and resolves critical runtime errors and compatibility issues encountered during the Python 3 modernization, which were causing failures in GitHub Actions workflows. The changes primarily involve adjusting function call signatures to pass required arguments and updating Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses several runtime errors and compatibility issues that arose during a Python 3 migration. The fixes, which include adding missing function arguments, correcting wrong function calls, and ensuring Python 3.9 compatibility, are all accurate and crucial for resolving the workflow failures. The optimization in check_bpmf_output by switching to an if/elif chain is also a good improvement. I've added one suggestion to further refactor check_bpmf_output to reduce code duplication and improve its maintainability.
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
This commit fixes critical bugs in the Python 3 modernization that were causing GitHub Actions workflow failures in the "Test McBopomofo" step.
Fixes in score_validator.py:
Fixes in phrase_deriver.py:
All fixes verified with:
These changes resolve the TypeErrors that were preventing the workflow from completing successfully.
PR Type
Bug fix, Enhancement
Description
Pass phrases to seg_pick and walkers
Fix incorrect walker call in six_char path
Optimize validator with single length branch
Remove zip strict for Python 3.9+
Diagram Walkthrough
File Walkthrough
phrase_deriver.py
Replace strict zip for Python 3.9 compatibilitySource/Data/curation/builders/phrase_deriver.py
score_validator.py
Fix validator parameters and walker logicSource/Data/curation/validators/score_validator.py