Skip to content
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

Fix Data Type Parsing for Command-Line Arguments #269

Open
karatugo opened this issue Oct 23, 2023 · 0 comments
Open

Fix Data Type Parsing for Command-Line Arguments #269

karatugo opened this issue Oct 23, 2023 · 0 comments
Assignees

Comments

@karatugo
Copy link
Member

karatugo commented Oct 23, 2023

Description

There's an issue with the current command-line argument parsing in our script. Arguments which are expected to be integers (or other non-string data types) are being parsed as strings, which may lead to incorrect behavior downstream in our processing.

Affected Code

In our main() function, the argparse module is used to parse command-line arguments:

argparser.add_argument(
    "-minrows",
    help="The minimum required rows in a sumsats file for validation to pass",
    required=False,
    default=None,
)

For the -minrows argument, no explicit data type is specified, so it defaults to parsing the argument as a string.

Proposed Solution

Currently, there's a workaround using a conditional check (None if len(args.minrows) == 0 or args.minrows == "None" else args.minrows), but this is not an optimal or clear solution.

For arguments that are expected to be integers (or other specific data types), we should explicitly specify the type in the argparse.add_argument() function.

For instance, -minrows can be updated as:

argparser.add_argument(
    "-minrows",
    type=int,
    help="The minimum required rows in a sumsats file for validation to pass",
    required=False,
    default=None,
)

Additional Notes

It's essential to validate other arguments as well to ensure they're being parsed with the correct data type, especially if there are other arguments that might have similar issues.

This is linked to this issue

@karatugo karatugo self-assigned this Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant