d0rj's picture
feat: Initial commit
1719436
raw
history blame
643 Bytes
from typing import Any
def build_default_namespace() -> dict[str, Any]:
"""Creates a dictionary with types from the typing module and built-in types."""
import typing
from numbers import Number
from fractions import Fraction
namespace = {
name: getattr(typing, name) for name in dir(typing) if not name.startswith("_")
}
namespace.update(
{
"int": int,
"str": str,
"float": float,
"bool": bool,
"dict": dict,
"list": list,
}
)
namespace.update({"Fraction": Fraction, "Number": Number})
return namespace