Return position of last unquoted character in list, or -1 if not found.
(text: str, chs: Optional[str])
| 157 | |
| 158 | |
| 159 | def _last_unquoted_char(text: str, chs: Optional[str]) -> int: |
| 160 | """Return position of last unquoted character in list, or -1 if not found.""" |
| 161 | i = len(text) - 1 |
| 162 | in_quotes = False |
| 163 | if chs is None: |
| 164 | chs = string.whitespace |
| 165 | while i > 0: |
| 166 | if text[i] == '"' and not _is_character_escaped(text, i): |
| 167 | in_quotes = not in_quotes |
| 168 | |
| 169 | if not in_quotes: |
| 170 | if text[i] in chs: |
| 171 | return i |
| 172 | i -= 1 |
| 173 | return -1 |
| 174 | |
| 175 | |
| 176 | def _split_quoted(text, separator, maxsplit=0): |
no test coverage detected