tokenize_str.py 360 B

1234567891011
  1. # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  2. # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
  3. import tokenize
  4. from io import StringIO
  5. from tokenize import TokenInfo
  6. from typing import List
  7. def _tokenize_str(code: str) -> List[TokenInfo]:
  8. return list(tokenize.generate_tokens(StringIO(code).readline))