11import sys
22from logging import CRITICAL , DEBUG , ERROR , INFO , WARN , Logger
3- from typing import Dict , List , Optional
43
54import typer
65from logmuse import init_logger
2322
2423
2524def _configure_logging (
26- verbosity : Optional [ int ] ,
27- logging_level : Optional [ str ] ,
25+ verbosity : int | None ,
26+ logging_level : str | None ,
2827 dbg : bool ,
2928) -> str :
3029 """Mimic old verbosity / logging-level behavior."""
@@ -38,7 +37,7 @@ def _configure_logging(
3837 return level
3938
4039
41- def _parse_filter_args_str (input : Optional [ List [ str ]] ) -> Dict [str , str ]:
40+ def _parse_filter_args_str (input : list [ str ] | None ) -> dict [str , str ]:
4241 """
4342 Parse user input specification.
4443
@@ -57,7 +56,7 @@ def _parse_filter_args_str(input: Optional[List[str]]) -> Dict[str, str]:
5756
5857
5958def print_error_summary (
60- errors_by_type : Dict [str , List [ Dict [str , str ]]], _LOGGER : Logger
59+ errors_by_type : dict [str , list [ dict [str , str ]]], _LOGGER : Logger
6160):
6261 """Print a summary of errors, organized by error type"""
6362 n_error_types = len (errors_by_type )
@@ -80,14 +79,14 @@ def print_error_summary(
8079@app .callback ()
8180def common (
8281 ctx : typer .Context ,
83- verbosity : Optional [ int ] = typer .Option (
82+ verbosity : int | None = typer .Option (
8483 None ,
8584 "--verbosity" ,
8685 min = 0 ,
8786 max = len (LEVEL_BY_VERBOSITY ) - 1 ,
8887 help = f"Choose level of verbosity (default: { None } )" ,
8988 ),
90- logging_level : Optional [ str ] = typer .Option (
89+ logging_level : str | None = typer .Option (
9190 None ,
9291 "--logging-level" ,
9392 help = "logging level" ,
@@ -114,18 +113,18 @@ def common(
114113@app .command (name = CONVERT_CMD , help = SUBPARSER_MSGS [CONVERT_CMD ])
115114def convert (
116115 ctx : typer .Context ,
117- pep : Optional [ str ] = typer .Argument (
116+ pep : str | None = typer .Argument (
118117 None ,
119118 metavar = "PEP" ,
120119 help = "Path to a PEP configuration file in yaml format." ,
121120 ),
122- st_index : Optional [ str ] = typer .Option (
121+ st_index : str | None = typer .Option (
123122 None , "--st-index" , help = "Sample table index to use"
124123 ),
125- sst_index : Optional [ str ] = typer .Option (
124+ sst_index : str | None = typer .Option (
126125 None , "--sst-index" , help = "Subsample table index to use"
127126 ),
128- amendments : Optional [ List [ str ]] = typer .Option (
127+ amendments : list [ str ] | None = typer .Option (
129128 None ,
130129 "--amendments" ,
131130 help = "Names of the amendments to activate." ,
@@ -136,13 +135,13 @@ def convert(
136135 "--format" ,
137136 help = "Output format (name of filter; use -l to see available)." ,
138137 ),
139- sample_name : Optional [ List [ str ]] = typer .Option (
138+ sample_name : list [ str ] | None = typer .Option (
140139 None ,
141140 "-n" ,
142141 "--sample-name" ,
143142 help = "Name of the samples to inspect." ,
144143 ),
145- args : Optional [ List [ str ]] = typer .Option (
144+ args : list [ str ] | None = typer .Option (
146145 None ,
147146 "-a" ,
148147 "--args" ,
@@ -162,7 +161,7 @@ def convert(
162161 "--describe" ,
163162 help = "Show description for a given filter." ,
164163 ),
165- paths_ : Optional [ List [ str ]] = typer .Option (
164+ paths_ : list [ str ] | None = typer .Option (
166165 None ,
167166 "-p" ,
168167 "--paths" ,
@@ -226,28 +225,28 @@ def validate(
226225 metavar = "S" ,
227226 help = "Path to a PEP schema file in yaml format." ,
228227 ),
229- st_index : Optional [ str ] = typer .Option (
228+ st_index : str | None = typer .Option (
230229 None ,
231230 "--st-index" ,
232231 help = (
233232 f"Sample table index to use; samples are identified by "
234233 f"'{ SAMPLE_NAME_ATTR } ' by default."
235234 ),
236235 ),
237- sst_index : Optional [ str ] = typer .Option (
236+ sst_index : str | None = typer .Option (
238237 None ,
239238 "--sst-index" ,
240239 help = (
241240 f"Subsample table index to use; samples are identified by "
242241 f"'{ SAMPLE_NAME_ATTR } ' by default."
243242 ),
244243 ),
245- amendments : Optional [ List [ str ]] = typer .Option (
244+ amendments : list [ str ] | None = typer .Option (
246245 None ,
247246 "--amendments" ,
248247 help = "Names of the amendments to activate." ,
249248 ),
250- sample_name : Optional [ str ] = typer .Option (
249+ sample_name : str | None = typer .Option (
251250 None ,
252251 "-n" ,
253252 "--sample-name" ,
@@ -311,28 +310,28 @@ def inspect(
311310 metavar = "PEP" ,
312311 help = "Path to a PEP configuration file in yaml format." ,
313312 ),
314- st_index : Optional [ str ] = typer .Option (
313+ st_index : str | None = typer .Option (
315314 None ,
316315 "--st-index" ,
317316 help = (
318317 f"Sample table index to use; samples are identified by "
319318 f"'{ SAMPLE_NAME_ATTR } ' by default."
320319 ),
321320 ),
322- sst_index : Optional [ str ] = typer .Option (
321+ sst_index : str | None = typer .Option (
323322 None ,
324323 "--sst-index" ,
325324 help = (
326325 f"Subsample table index to use; samples are identified by "
327326 f"'{ SAMPLE_NAME_ATTR } ' by default."
328327 ),
329328 ),
330- amendments : Optional [ List [ str ]] = typer .Option (
329+ amendments : list [ str ] | None = typer .Option (
331330 None ,
332331 "--amendments" ,
333332 help = "Names of the amendments to activate." ,
334333 ),
335- sample_name : Optional [ List [ str ]] = typer .Option (
334+ sample_name : list [ str ] | None = typer .Option (
336335 None ,
337336 "-n" ,
338337 "--sample-name" ,
0 commit comments