22from __future__ import annotations
33
44from argparse import ArgumentParser
5-
6- from rich_argparse import RichHelpFormatter
5+ from argparse import HelpFormatter
76
87from ._version import __version__
98
109DOC_URL = "https://cohort-creator.readthedocs.io/en/latest/"
1110FAQ_URL = f"{ DOC_URL } faq.html"
1211
1312
14- def base_parser () -> ArgumentParser :
13+ def base_parser (formatter_class : type [ HelpFormatter ] = HelpFormatter ) -> ArgumentParser :
1514 parser = ArgumentParser (
1615 prog = "cohort_creator" ,
1716 description = "Creates a cohort by grabbing specific subjects from opennneuro datasets." ,
1817 epilog = f"""
1918 For a more readable version of this help section,
2019 see the `online doc <{ DOC_URL } >`_.
2120 """ ,
22- formatter_class = RichHelpFormatter ,
21+ formatter_class = formatter_class ,
2322 )
2423 parser .add_argument (
2524 "-v" ,
@@ -128,8 +127,8 @@ def add_specialized_args(parser: ArgumentParser) -> ArgumentParser:
128127 return parser
129128
130129
131- def global_parser () -> ArgumentParser :
132- parser = base_parser ()
130+ def global_parser (formatter_class : type [ HelpFormatter ] = HelpFormatter ) -> ArgumentParser :
131+ parser = base_parser (formatter_class = formatter_class )
133132 subparsers = parser .add_subparsers (
134133 dest = "command" ,
135134 help = "Choose a subcommand" ,
@@ -138,63 +137,19 @@ def global_parser() -> ArgumentParser:
138137
139138 install_parser = subparsers .add_parser (
140139 "install" ,
141- help = """
142- Install several openneuro datasets.
143-
144- Example:
145-
146- .. code-block:: bash
147-
148- cohort_creator install \\
149- --dataset_listing inputs/dataset-results.tsv \\
150- --participant_listing inputs/participant-results.tsv \\
151- --output_dir outputs \\
152- --dataset_types raw mriqc fmriprep \\
153- --verbosity 3
154-
155- If no ``--participant_listing`` is provided,
156- a ``participants.tsv`` file will be generated
157- in ``output_dir/code`` that contains all participants
158- for all datasets in ``dataset_listing``.
159-
160- Datasets listing can be passed directly as a list of datasets:
161-
162- .. code-block:: bash
163-
164- cohort_creator install \\
165- --dataset_listing ds000001 ds000002 \\
166- --output_dir outputs \\
167- --dataset_types raw mriqc fmriprep \\
168- --verbosity 3
169- """ ,
140+ help = "Install several openneuro datasets." ,
170141 formatter_class = parser .formatter_class ,
171142 )
172143 install_parser = add_common_arguments (install_parser )
173144 install_parser .add_argument (
174145 "--generate_participant_listing" ,
175146 action = "store_true" ,
176- help = "Skips rerunning mriqc on the subset of participants ." ,
147+ help = "Generate a participant_listing.tsv in the output_dir ." ,
177148 )
178149
179150 get_parser = subparsers .add_parser (
180151 "get" ,
181- help = """
182- Get specified data for a cohort of subjects.
183-
184- Example:
185-
186- .. code-block:: bash
187-
188- cohort_creator get \\
189- --dataset_listing inputs/dataset-results.tsv \\
190- --participant_listing inputs/participant-results.tsv \\
191- --output_dir outputs \\
192- --dataset_types raw mriqc fmriprep \\
193- --datatype anat func \\
194- --space T1w MNI152NLin2009cAsym \\
195- --jobs 6 \\
196- --verbosity 3
197- """ ,
152+ help = "Get specified data for a cohort of subjects." ,
198153 formatter_class = parser .formatter_class ,
199154 )
200155 get_parser = add_common_arguments (get_parser )
@@ -212,22 +167,7 @@ def global_parser() -> ArgumentParser:
212167
213168 copy_parser = subparsers .add_parser (
214169 "copy" ,
215- help = """
216- Copy cohort of subjects into separate directory.
217-
218- Example:
219-
220- .. code-block:: bash
221-
222- cohort_creator copy \\
223- --dataset_listing inputs/dataset-results.tsv \\
224- --participant_listing inputs/participant-results.tsv \\
225- --output_dir outputs \\
226- --dataset_types raw mriqc fmriprep \\
227- --datatype anat func \\
228- --space T1w MNI152NLin2009cAsym \\
229- --verbosity 3
230- """ ,
170+ help = "Copy cohort of subjects into separate directory." ,
231171 formatter_class = parser .formatter_class ,
232172 )
233173 copy_parser = add_common_arguments (copy_parser )
@@ -240,22 +180,7 @@ def global_parser() -> ArgumentParser:
240180
241181 all_parser = subparsers .add_parser (
242182 "all" ,
243- help = """
244- Install, get, and copy cohort of subjects.
245-
246- Example:
247-
248- .. code-block:: bash
249-
250- cohort_creator all \\
251- --dataset_listing inputs/dataset-results.tsv \\
252- --participant_listing inputs/participant-results.tsv \\
253- --output_dir outputs \\
254- --dataset_types raw mriqc fmriprep \\
255- --datatype anat func \\
256- --space T1w MNI152NLin2009cAsym \\
257- --verbosity 3
258- """ ,
183+ help = "Install, get, and copy cohort of subjects." ,
259184 formatter_class = parser .formatter_class ,
260185 )
261186 all_parser = add_common_arguments (all_parser )
0 commit comments