fix: parse xyz2gen --periodic values from the command line - #205
Open
galjos wants to merge 1 commit into
Open
Conversation
The --periodic option declared choices=[True, False, None] without a type converter, so argparse compared the raw command-line string against Python objects and rejected every value, including the ones its own error message suggested. The option could therefore never hold anything but its None default. A converter now maps the strings True, False and None (case-insensitive) to the corresponding Python values and reports a proper error for anything else.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #205 +/- ##
==========================================
+ Coverage 93.94% 94.01% +0.06%
==========================================
Files 177 177
Lines 9227 9233 +6
==========================================
+ Hits 8668 8680 +12
+ Misses 559 553 -6
🚀 New features to boost your workflow:
|
Contributor
|
PYLINT REPORT Your code has been rated at 9.78/10 Full reportRaw metrics
Duplication
Messages by category
% errors / warnings by module
Messages
|
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.
--periodicdeclared Python objects as choices without a converter, so argparse compared the raw string againstTrue,False, andNoneand rejected every input, including the ones its own error message suggested. A converter now maps the strings (case-insensitive) to the objects and rejects anything else with the same message shape.The added tests cover all six accepted spellings, the default, the rejection, and the written gen file with and without the lattice block.
Fixes #204.