mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Issue #10386: Added __all__ to token module; this simplifies importing
in tokenize module and prevents leaking of private names through import *.
This commit is contained in:
parent
bb27c128a5
commit
b9d10d08c4
3 changed files with 14 additions and 13 deletions
|
@ -33,9 +33,8 @@ from io import TextIOWrapper
|
|||
cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
|
||||
|
||||
import token
|
||||
__all__ = [x for x in dir(token) if not x.startswith("_")]
|
||||
__all__.extend(["COMMENT", "tokenize", "detect_encoding", "NL", "untokenize",
|
||||
"ENCODING", "TokenInfo"])
|
||||
__all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
|
||||
"NL", "untokenize", "ENCODING", "TokenInfo"]
|
||||
del token
|
||||
|
||||
COMMENT = N_TOKENS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue