[Calc] Allow using math.sin instead of math['sin']
parent
6b0541bf03
commit
3aea68ff52
7
calc.py
7
calc.py
|
@ -10,6 +10,9 @@ import operator as op
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
class SomeObject(object):
|
||||||
|
pass
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
"bin": bin, "abs": abs, "oct": oct, "int": int, "sum": sum,
|
"bin": bin, "abs": abs, "oct": oct, "int": int, "sum": sum,
|
||||||
"tuple": tuple, "divmod": divmod, "hash": hash, "hex": hex,
|
"tuple": tuple, "divmod": divmod, "hash": hash, "hex": hex,
|
||||||
|
@ -22,11 +25,11 @@ libs = [
|
||||||
]
|
]
|
||||||
|
|
||||||
for lib in libs:
|
for lib in libs:
|
||||||
env[lib] = {}
|
env[lib] = SomeObject()
|
||||||
for funcn in dir(globals()[lib]):
|
for funcn in dir(globals()[lib]):
|
||||||
if funcn.startswith("_"):
|
if funcn.startswith("_"):
|
||||||
continue
|
continue
|
||||||
env[lib][funcn] = getattr(globals()[lib], funcn)
|
setattr(env[lib], funcn, getattr(globals()[lib], funcn))
|
||||||
|
|
||||||
def c(phenny, input):
|
def c(phenny, input):
|
||||||
for x in phenny.bot.commands["high"].values():
|
for x in phenny.bot.commands["high"].values():
|
||||||
|
|
Loading…
Reference in New Issue