third_party.pylibs.pylint.src/pylint/testutils/tokenize_str.py

12 lines
360 B
Python
Raw Normal View History

2020-11-29 10:17:56 +00:00
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
2020-11-29 10:17:56 +00:00
import tokenize
from io import StringIO
from tokenize import TokenInfo
from typing import List
2020-11-29 10:17:56 +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))