From c4e1a6136e6210b902f9ca4f207e9419aa1b4b5e Mon Sep 17 00:00:00 2001 From: Daniel Fairhead Date: Thu, 31 Oct 2024 05:22:34 +0000 Subject: [PATCH] Add typing in so mypy can actually catch the incorrect BASIC_ALLOWED_ATTRS --- simpleeval.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simpleeval.py b/simpleeval.py index 46c3f76..fa3909e 100644 --- a/simpleeval.py +++ b/simpleeval.py @@ -107,6 +107,7 @@ import sys import warnings from random import random +from typing import Type, Dict, Set, Union ######################################## # Module wide 'globals' @@ -144,7 +145,7 @@ # Opt-in type safety experiment. Will be opt-out in 2.x -BASIC_ALLOWED_ATTRS = { +BASIC_ALLOWED_ATTRS: Dict[Union[Type, None], Set] = { int: { "as_integer_ratio", "bit_length",