(self, state: _ParsingState)
| 325 | state.rargs = [] |
| 326 | |
| 327 | def _process_args_for_options(self, state: _ParsingState) -> None: |
| 328 | while state.rargs: |
| 329 | arg = state.rargs.pop(0) |
| 330 | arglen = len(arg) |
| 331 | # Double dashes always handled explicitly regardless of what |
| 332 | # prefixes are valid. |
| 333 | if arg == "--": |
| 334 | return |
| 335 | elif arg[:1] in self._opt_prefixes and arglen > 1: |
| 336 | self._process_opts(arg, state) |
| 337 | elif self.allow_interspersed_args: |
| 338 | state.largs.append(arg) |
| 339 | else: |
| 340 | state.rargs.insert(0, arg) |
| 341 | return |
| 342 | |
| 343 | # Say this is the original argument list: |
| 344 | # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)] |
| 345 | # ^ |
| 346 | # (we are about to process arg(i)). |
| 347 | # |
| 348 | # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of |
| 349 | # [arg0, ..., arg(i-1)] (any options and their arguments will have |
| 350 | # been removed from largs). |
| 351 | # |
| 352 | # The while loop will usually consume 1 or more arguments per pass. |
| 353 | # If it consumes 1 (eg. arg is an option that takes no arguments), |
| 354 | # then after _process_arg() is done the situation is: |
| 355 | # |
| 356 | # largs = subset of [arg0, ..., arg(i)] |
| 357 | # rargs = [arg(i+1), ..., arg(N-1)] |
| 358 | # |
| 359 | # If allow_interspersed_args is false, largs will always be |
| 360 | # *empty* -- still a subset of [arg0, ..., arg(i-1)], but |
| 361 | # not a very interesting subset! |
| 362 | |
| 363 | def _match_long_opt( |
| 364 | self, opt: str, explicit_value: str | None, state: _ParsingState |
no test coverage detected