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
.github
docs
monai
tests
.clang-format -rw-r--r-- 2.5 KB
.deepsource.toml -rw-r--r-- 349 bytes
.dockerignore -rw-r--r-- 160 bytes
.gitattributes -rw-r--r-- 31 bytes
.gitignore -rw-r--r-- 1.8 KB
.pre-commit-config.yaml -rw-r--r-- 2.2 KB
.readthedocs.yml -rw-r--r-- 628 bytes
CHANGELOG.md -rw-r--r-- 32.9 KB
CITATION.cff -rw-r--r-- 670 bytes
CODE_OF_CONDUCT.md -rw-r--r-- 3.3 KB
CONTRIBUTING.md -rw-r--r-- 22.6 KB
Dockerfile -rw-r--r-- 2.4 KB
LICENSE -rw-r--r-- 11.1 KB
MANIFEST.in -rw-r--r-- 83 bytes
README.md -rw-r--r-- 4.0 KB
environment-dev.yml -rw-r--r-- 1.4 KB
pyproject.toml -rw-r--r-- 561 bytes
requirements-dev.txt -rw-r--r-- 970 bytes
requirements-min.txt -rw-r--r-- 118 bytes
requirements.txt -rw-r--r-- 23 bytes
runtests.sh -rwxr-xr-x 20.1 KB
setup.cfg -rw-r--r-- 5.3 KB
setup.py -rw-r--r-- 5.0 KB
versioneer.py -rw-r--r-- 68.1 KB

README.md

back to top