2020-11-29 10:17:56 +00:00
|
|
|
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
2021-07-01 10:47:58 +00:00
|
|
|
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
|
2022-03-01 15:04:49 +00:00
|
|
|
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
|
2020-11-29 10:17:56 +00:00
|
|
|
|
2022-04-14 07:47:58 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2020-11-29 10:17:56 +00:00
|
|
|
import tokenize
|
|
|
|
from io import StringIO
|
2021-09-25 04:23:32 +00:00
|
|
|
from tokenize import TokenInfo
|
2020-11-29 10:17:56 +00:00
|
|
|
|
|
|
|
|
2022-04-14 07:47:58 +00:00
|
|
|
def _tokenize_str(code: str) -> list[TokenInfo]:
|
2020-11-29 10:17:56 +00:00
|
|
|
return list(tokenize.generate_tokens(StringIO(code).readline))
|