Path 1: 20 calls (0.77)

'"double-quoted string"' (4) "'single-quoted string'" (4) '"another double-quoted string"' (2) '"yet another double-quoted string"' (2) '\'single-quot...

True (16) False (4)

1def _is_quote_delimiter_chosen_freely(string_token: str) -> bool:
2    """Was there a non-awkward option for the quote delimiter?
3
4    Args:
5        string_token: The quoted string whose delimiters are to be checked.
6
7    Returns:
8        Whether there was a choice in this token's quote character that would
9        not have involved backslash-escaping an interior quote character.  Long
10        strings are excepted from this analysis under the assumption that their
11        quote characters are set by policy.
12    """
13    quote_delimiter = _get_quote_delimiter(string_token)
14    unchosen_delimiter = '"' if quote_delimiter == "'" else "'"
15    return bool(
16        quote_delimiter
17        and not _is_long_string(string_token)
18        and unchosen_delimiter not in str_eval(string_token)
19    )
            

Path 2: 6 calls (0.23)

'"""Tests for inconsistent quoting strategy.\r\n\r\nIn this file, double quotes are the majority quote delimiter.\r\n"""' (2) "'''This is a multi-line...

False (6)

1def _is_quote_delimiter_chosen_freely(string_token: str) -> bool:
2    """Was there a non-awkward option for the quote delimiter?
3
4    Args:
5        string_token: The quoted string whose delimiters are to be checked.
6
7    Returns:
8        Whether there was a choice in this token's quote character that would
9        not have involved backslash-escaping an interior quote character.  Long
10        strings are excepted from this analysis under the assumption that their
11        quote characters are set by policy.
12    """
13    quote_delimiter = _get_quote_delimiter(string_token)
14    unchosen_delimiter = '"' if quote_delimiter == "'" else "'"
15    return bool(
16        quote_delimiter
17        and not _is_long_string(string_token)
18        and unchosen_delimiter not in str_eval(string_token)
19    )