aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Inheritance <[email protected]>2021-01-25 10:46:04 +0545
committerGravatar Inheritance <[email protected]>2021-01-25 10:46:04 +0545
commita123417cb9fe2d9be86bab41c6a166e29833f6a3 (patch)
treefa83e9e330be541e5967dd972dfe2addeedaba42
parentFixed python_general const in server command (diff)
Removed self.interpreter from internal cog, and deleted the interpreter helper file
-rw-r--r--bot/exts/utils/internal.py1
-rw-r--r--bot/interpreter.py51
2 files changed, 0 insertions, 52 deletions
diff --git a/bot/exts/utils/internal.py b/bot/exts/utils/internal.py
index 3521c8fd4..cc0c8a574 100644
--- a/bot/exts/utils/internal.py
+++ b/bot/exts/utils/internal.py
@@ -30,7 +30,6 @@ class Internal(Cog):
self.ln = 0
self.stdout = StringIO()
- self.interpreter = Interpreter()
self.socket_since = datetime.utcnow()
self.socket_event_total = 0
diff --git a/bot/interpreter.py b/bot/interpreter.py
deleted file mode 100644
index b58f7a6b0..000000000
--- a/bot/interpreter.py
+++ /dev/null
@@ -1,51 +0,0 @@
-from code import InteractiveInterpreter
-from io import StringIO
-from typing import Any
-
-from discord.ext.commands import Context
-
-import bot
-
-CODE_TEMPLATE = """
-async def _func():
-{0}
-"""
-
-
-class Interpreter(InteractiveInterpreter):
- """
- Subclass InteractiveInterpreter to specify custom run functionality.
-
- Helper class for internal eval.
- """
-
- write_callable = None
-
- def __init__(self):
- locals_ = {"bot": bot.instance}
- super().__init__(locals_)
-
- async def run(self, code: str, ctx: Context, io: StringIO, *args, **kwargs) -> Any:
- """Execute the provided source code as the bot & return the output."""
- self.locals["_rvalue"] = []
- self.locals["ctx"] = ctx
- self.locals["print"] = lambda x: io.write(f"{x}\n")
-
- code_io = StringIO()
-
- for line in code.split("\n"):
- code_io.write(f" {line}\n")
-
- code = CODE_TEMPLATE.format(code_io.getvalue())
- del code_io
-
- self.runsource(code, *args, **kwargs)
- self.runsource("_rvalue = _func()", *args, **kwargs)
-
- rvalue = await self.locals["_rvalue"]
-
- del self.locals["_rvalue"]
- del self.locals["ctx"]
- del self.locals["print"]
-
- return rvalue