Revision 10ab34a46a95458d72da08f8005a173ef8d3391d authored by myron on 19 October 2022, 12:49:16 UTC, committed by Wenqi Li on 19 October 2022, 13:03:08 UTC
This adds a utility function str2list to convert a string to a list.
Useful with argparse commandline arguments:
```
        parser.add_argument("--blocks", default=[1,2,3], type=str2list)
        ...
        python mycode.py --blocks=1,2,2,4
```
Unit tests added.

It also includes a small fix for str2bool to accept input as bool (and
return it right away).

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ x Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x]Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: myron <amyronenko@nvidia.com>
1 parent 652511f
History
File Mode Size
ISSUE_TEMPLATE
workflows
codecov.yml -rw-r--r-- 656 bytes
pull_request_template.md -rw-r--r-- 733 bytes

back to top