Method: pylint.checkers.strings._is_long_string
Calls: 26, Exceptions: 0, Paths: 2Back
Path 1: 24 calls (0.92)
'"double-quoted string"' (4) "'single-quoted string'" (4) '"""Tests for inconsistent quoting strategy.\r\n\r\nIn this file, double quotes are the majo...
False (20) True (4)
1def _is_long_string(string_token: str) -> bool:
2 """Is this string token a "longstring" (is it triple-quoted)?
3
4 Long strings are triple-quoted as defined in
5 https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
6
7 This function only checks characters up through the open quotes. Because it's meant
8 to be applied only to tokens that represent string literals, it doesn't bother to
9 check for close-quotes (demonstrating that the literal is a well-formed string).
10
11 Args:
12 string_token: The string token to be parsed.
13
14 Returns:
15 A boolean representing whether this token matches a longstring
16 regex.
17 """
18 return bool(
19 SINGLE_QUOTED_REGEX.match(string_token)
20 or DOUBLE_QUOTED_REGEX.match(string_token)
21 )
Path 2: 2 calls (0.08)
"'''This is a multi-line docstring that should not raise a warning even though the\r\n delimiter it uses for quotes is not the delimiter used in th...
True (2)
1def _is_long_string(string_token: str) -> bool:
2 """Is this string token a "longstring" (is it triple-quoted)?
3
4 Long strings are triple-quoted as defined in
5 https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
6
7 This function only checks characters up through the open quotes. Because it's meant
8 to be applied only to tokens that represent string literals, it doesn't bother to
9 check for close-quotes (demonstrating that the literal is a well-formed string).
10
11 Args:
12 string_token: The string token to be parsed.
13
14 Returns:
15 A boolean representing whether this token matches a longstring
16 regex.
17 """
18 return bool(
19 SINGLE_QUOTED_REGEX.match(string_token)
20 or DOUBLE_QUOTED_REGEX.match(string_token)
21 )