gh-127303: Add docs for token.EXACT_TOKEN_TYPES (#127304)

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Илья Любавский 2024-11-29 12:00:50 +03:00 committed by GitHub
parent b83be9c971
commit dd3a87d2a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 2 deletions

View file

@ -79,6 +79,13 @@ the :mod:`tokenize` module.
``type_comments=True``.
.. data:: EXACT_TOKEN_TYPES
A dictionary mapping the string representation of a token to its numeric code.
.. versionadded:: 3.8
.. versionchanged:: 3.5
Added :data:`!AWAIT` and :data:`!ASYNC` tokens.

3
Lib/token.py generated
View file

@ -1,7 +1,8 @@
"""Token constants."""
# Auto-generated by Tools/build/generate_token.py
__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF']
__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF',
'EXACT_TOKEN_TYPES']
ENDMARKER = 0
NAME = 1

View file

@ -1154,6 +1154,7 @@ Mark Lutz
Taras Lyapun
Jim Lynch
Mikael Lyngvig
Ilya Lyubavski
Jeff MacDonald
John Machin
Andrew I MacIntyre

View file

@ -0,0 +1 @@
Publicly expose :data:`~token.EXACT_TOKEN_TYPES` in :attr:`!token.__all__`.

View file

@ -226,7 +226,8 @@ token_py_template = f'''\
# {AUTO_GENERATED_BY_SCRIPT}
'''
token_py_template += '''
__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF']
__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF',
'EXACT_TOKEN_TYPES']
%s
N_TOKENS = %d