◐ Shell
clean mode source ↗

gh-139003: Use frozenset for module level attributes in _pyrepl.utils by eendebakpt · Pull Request #139004 · python/cpython

Expand Up @@ -19,9 +19,9 @@ ANSI_ESCAPE_SEQUENCE = re.compile(r"\x1b\[[ -@]*[A-~]") ZERO_WIDTH_BRACKET = re.compile(r"\x01.*?\x02") ZERO_WIDTH_TRANS = str.maketrans({"\x01": "", "\x02": ""}) IDENTIFIERS_AFTER = {"def", "class"} KEYWORD_CONSTANTS = {"True", "False", "None"} BUILTINS = {str(name) for name in dir(builtins) if not name.startswith('_')} IDENTIFIERS_AFTER = frozenset({"def", "class"}) KEYWORD_CONSTANTS = frozenset({"True", "False", "None"}) BUILTINS = frozenset({str(name) for name in dir(builtins) if not name.startswith('_')})

def THEME(**kwargs): Expand Down Expand Up @@ -226,8 +226,8 @@ def gen_colors_from_token_stream( yield ColorSpan(span, "builtin")

keyword_first_sets_match = {"False", "None", "True", "await", "lambda", "not"} keyword_first_sets_case = {"False", "None", "True"} keyword_first_sets_match = frozenset({"False", "None", "True", "await", "lambda", "not"}) keyword_first_sets_case = frozenset({"False", "None", "True"})

def is_soft_keyword_used(*tokens: TI | None) -> bool: Expand Down