From 3aea68ff524eb17a479b7c5e23c74a89bb34ee59 Mon Sep 17 00:00:00 2001 From: Sfan5 Date: Fri, 24 Jan 2014 19:39:48 +0100 Subject: [PATCH] [Calc] Allow using math.sin instead of math['sin'] --- calc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/calc.py b/calc.py index 5e9e936..eb34201 100755 --- a/calc.py +++ b/calc.py @@ -10,6 +10,9 @@ import operator as op import math import random +class SomeObject(object): + pass + env = { "bin": bin, "abs": abs, "oct": oct, "int": int, "sum": sum, "tuple": tuple, "divmod": divmod, "hash": hash, "hex": hex, @@ -22,11 +25,11 @@ libs = [ ] for lib in libs: - env[lib] = {} + env[lib] = SomeObject() for funcn in dir(globals()[lib]): if funcn.startswith("_"): continue - env[lib][funcn] = getattr(globals()[lib], funcn) + setattr(env[lib], funcn, getattr(globals()[lib], funcn)) def c(phenny, input): for x in phenny.bot.commands["high"].values():