You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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, theargparse
module is used to parse command-line arguments: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 theargparse.add_argument()
function.For instance,
-minrows
can be updated as: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
The text was updated successfully, but these errors were encountered: