-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to disable tone coloring to EDICT2 plug-in #590
Conversation
Added colorize_tones option
pyglossary/plugins/edict2/conv.py
Outdated
if len(syllables) != len(tones): | ||
log.warning(f"unmatched tones: {syllables=}, {tones=}") | ||
|
||
if (len(syllables) != len(tones)) or (colorize_tones is False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(syllables) != len(tones) or not colorize_tones:
pyglossary/plugins/edict2/conv.py
Outdated
|
||
if (len(syllables) != len(tones)) or (colorize_tones is False): | ||
|
||
if (len(syllables) != len(tones)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra parenthesis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You check len(syllables) != len(tones)
twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second check is to log the "unmatched tones" warning, as the first condition catches this case and the option to disable tone coloring. I can eliminate the condition, but the warning will be logged also when only colorized_tones is False. I couldn't come up with a better solution.
You didn't add the changes in doc and plugin-meta. And run: ruff check. Ignore the Too many arguments error by adding |
Updated with new option of EDIC2 plugin
Updated with new option of EDICT2 plugin
Added comments to avoid warning PLR0913 from ruff
Are you using Windows? |
Please try |
Thank you for your help, it should be fine now. I'm on Linux, just don't usually use GitHub. |
This is the pull request for issue 589.
I have added the new boolean option colorize_tones, to turn off tone coloring when generating the converted dictionary. As before the plug-in generated colorized tones, I set the option to True by default.
I have run
ruff check
as requested, and got two warnings for the fileconv.py
: "too-many-arguments (PLR0913)", as with the new option some of the functions have six arguments instead of the five maximum arguments set by default in ruff.