Skip to content

Commit 4000eaf

Browse files
edit docstring and comments
1 parent d856505 commit 4000eaf

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pandas/core/computation/parsing.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ def create_valid_python_identifier(name: str) -> str:
3535
------
3636
SyntaxError
3737
If the returned name is not a Python valid identifier, raise an exception.
38-
This can happen if there is a hashtag in the name, as the tokenizer will
39-
than terminate and not find the backtick.
40-
But also for characters that fall out of the range of (U+0001..U+007F).
38+
This can happen if the name includes characters that fall out of the range of
39+
(U+0001..U+007F).
4140
"""
4241
if name.isidentifier() and not iskeyword(name):
4342
return name
@@ -60,7 +59,6 @@ def create_valid_python_identifier(name: str) -> str:
6059
# Including quotes works, but there are exceptions.
6160
"'": "_SINGLEQUOTE_",
6261
'"': "_DOUBLEQUOTE_",
63-
# Currently not possible. Terminates parser and won't find backtick.
6462
"#": "_HASH_",
6563
}
6664
)
@@ -239,11 +237,11 @@ def _split_by_backtick(s: str) -> list[tuple[bool, str]]:
239237
break
240238

241239
# Quote is unmatched (Bad syntax), or
242-
# Quote is matched, and the next quote is at the end of the string
240+
# Quote is matched, and the next quote is at the end of s
243241
if (next_quote_index == -1) or (next_quote_index + 1 == len(s)):
244242
substrings.append((False, substring + s[i:]))
245243
break
246-
# Quote is matched, and the next quote is in the middle of the string
244+
# Quote is matched, and the next quote is in the middle of s
247245
else:
248246
substring += s[i : next_quote_index + 1]
249247
i = next_quote_index + 1

0 commit comments

Comments
 (0)