bot.exts.utilities.snekbox._eval#

Module Contents#

Classes#

EvalJob

Job to be evaluated by snekbox.

EvalResult

The result of an eval job.

Attributes#

bot.exts.utilities.snekbox._eval.log[source]#
bot.exts.utilities.snekbox._eval.SIGKILL = 9[source]#
class bot.exts.utilities.snekbox._eval.EvalJob[source]#

Job to be evaluated by snekbox.

args: list[str][source]#
files: list[bot.exts.utilities.snekbox._io.FileAttachment][source]#
name: str = 'eval'[source]#
version: bot.exts.utilities.snekbox._cog.SupportedPythonVersions = '3.11'[source]#
classmethod from_code(code: str, path: str = 'main.py') Self[source]#

Create an EvalJob from a code string.

as_version(version: bot.exts.utilities.snekbox._cog.SupportedPythonVersions) Self[source]#

Return a copy of the job with a different Python version.

to_dict() dict[str, list[str | dict[str, str]]][source]#

Convert the job to a dict.

class bot.exts.utilities.snekbox._eval.EvalResult[source]#

The result of an eval job.

property has_output: bool[source]#

True if the result has any output (stdout, files, or failed files).

property has_files: bool[source]#

True if the result has any files or failed files.

property status_emoji: str[source]#

Return an emoji corresponding to the status code or lack of output in result.

property error_message: str[source]#

Return an error message corresponding to the process’s return code.

property files_error_message: str[source]#

Return an error message corresponding to the failed files.

stdout: str[source]#
returncode: int | None[source]#
files: list[bot.exts.utilities.snekbox._io.FileAttachment][source]#
failed_files: list[str][source]#
get_failed_files_str(char_max: int = 85) str[source]#

Return a string containing the names of failed files, truncated char_max.

Will truncate on whole file names if less than 3 characters remaining.

get_message(job: EvalJob) str[source]#

Return a user-friendly message corresponding to the process’s return code.

classmethod from_dict(data: dict[str, str | int | list[dict[str, str]]]) Self[source]#

Create an EvalResult from a dict.