@@ -39,8 +39,8 @@ def current_word(cursor_offset: int, line: str) -> Optional[LinePart]:
39
39
_match_all_dict_keys = r"""[^\]]*"""
40
40
41
41
# https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
42
- _match_single_quote_str_bytes = \
43
- r""" # bytes repr() begins with `b` character; bytes and str begin with `'`
42
+ _match_single_quote_str_bytes = r"""
43
+ # bytes repr() begins with `b` character; bytes and str begin with `'`
44
44
b?'
45
45
# after an even number of `\`, next `\` and subsequent char are interpreted
46
46
# as an escape sequence; this handles `\'` in the string repr()
@@ -57,8 +57,8 @@ def current_word(cursor_offset: int, line: str) -> Optional[LinePart]:
57
57
58
58
# bytes and str repr() only uses double quotes if the string contains 1 or more
59
59
# `'` character and exactly 0 `"` characters
60
- _match_double_quote_str_bytes = \
61
- r""" # bytes repr() begins with `b` character
60
+ _match_double_quote_str_bytes = r"""
61
+ # bytes repr() begins with `b` character
62
62
b?"
63
63
# string continues until a `"` character is reached
64
64
[^"]*
@@ -69,11 +69,11 @@ def current_word(cursor_offset: int, line: str) -> Optional[LinePart]:
69
69
_match_dict_before_key = r"""[\w_][\w0-9._]*\["""
70
70
71
71
_current_dict_key_re = LazyReCompile (
72
- f' { _match_dict_before_key } ((?:'
73
- f' { _match_single_quote_str_bytes } |'
74
- f' { _match_double_quote_str_bytes } |'
75
- f' { _match_all_dict_keys } |)*)' ,
76
- re .VERBOSE
72
+ f" { _match_dict_before_key } ((?:"
73
+ f" { _match_single_quote_str_bytes } |"
74
+ f" { _match_double_quote_str_bytes } |"
75
+ f" { _match_all_dict_keys } |)*)" ,
76
+ re .VERBOSE ,
77
77
)
78
78
79
79
@@ -89,11 +89,11 @@ def current_dict_key(cursor_offset: int, line: str) -> Optional[LinePart]:
89
89
_capture_dict_name = r"""([\w_][\w0-9._]*)\["""
90
90
91
91
_current_dict_re = LazyReCompile (
92
- f' { _capture_dict_name } ((?:'
93
- f' { _match_single_quote_str_bytes } |'
94
- f' { _match_double_quote_str_bytes } |'
95
- f' { _match_all_dict_keys } |)*)' ,
96
- re .VERBOSE
92
+ f" { _capture_dict_name } ((?:"
93
+ f" { _match_single_quote_str_bytes } |"
94
+ f" { _match_double_quote_str_bytes } |"
95
+ f" { _match_all_dict_keys } |)*)" ,
96
+ re .VERBOSE ,
97
97
)
98
98
99
99
0 commit comments