(s: str, posix: bool)
| 240 | an unbalanced quote) returns whatever was parsed so far instead of raising. |
| 241 | """ |
| 242 | def _tokenize(s: str, posix: bool) -> list[str]: |
| 243 | lex = shlex.shlex(s, posix=posix) |
| 244 | lex.whitespace_split = True |
| 245 | lex.commenters = '' |
| 246 | out = [] |
| 247 | while True: |
| 248 | try: |
| 249 | out.append(next(lex)) |
| 250 | except StopIteration: |
| 251 | break |
| 252 | except ValueError: |
| 253 | if strict: |
| 254 | raise |
| 255 | out.append(lex.token) |
| 256 | break |
| 257 | return out |
| 258 | |
| 259 | raw_tokens = _tokenize(commandline, posix=False) |
| 260 | clean_tokens = _tokenize(commandline, posix=True) |
no outgoing calls
no test coverage detected
searching dependent graphs…