Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions pandas/core/computation/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,6 @@ def clean_column_name(name: Hashable) -> Hashable:
-------
name : hashable
Returns the name after tokenizing and cleaning.

Notes
-----
For some cases, a name cannot be converted to a valid Python identifier.
In that case :func:`tokenize_string` raises a SyntaxError.
In that case, we just return the name unmodified.

If this name was used in the query string (this makes the query call impossible)
an error will be raised by :func:`tokenize_backtick_quoted_string` instead,
which is not caught and propagates to the user level.
"""
try:
# Escape backticks
Expand All @@ -145,40 +135,6 @@ def clean_column_name(name: Hashable) -> Hashable:
return name


def tokenize_backtick_quoted_string(
token_generator: Iterator[tokenize.TokenInfo], source: str, string_start: int
) -> tuple[int, str]:
"""
Creates a token from a backtick quoted string.

Moves the token_generator forwards till right after the next backtick.

Parameters
----------
token_generator : Iterator[tokenize.TokenInfo]
The generator that yields the tokens of the source string (Tuple[int, str]).
The generator is at the first token after the backtick (`)

source : str
The Python source code string.

string_start : int
This is the start of backtick quoted string inside the source string.

Returns
-------
tok: Tuple[int, str]
The token that represents the backtick quoted string.
The integer is equal to BACKTICK_QUOTED_STRING (100).
"""
for _, tokval, start, _, _ in token_generator:
if tokval == "`":
string_end = start[1]
break

return BACKTICK_QUOTED_STRING, source[string_start:string_end]


class ParseState(Enum):
DEFAULT = 0
IN_BACKTICK = 1
Expand Down
Loading