From 767459d17e031e96d09e533a2a53df896b3a57e1 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Wed, 27 Sep 2023 22:10:55 +0800 Subject: feat(docstring): 添加PEP8规范的Docstring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/psi/execution.py | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/psi/execution.py') diff --git a/src/psi/execution.py b/src/psi/execution.py index 052f7ab..0abdf2c 100644 --- a/src/psi/execution.py +++ b/src/psi/execution.py @@ -4,14 +4,43 @@ from psi.interpreter import Interpreter __all__ = ['Execution'] class Execution: + """ + A class representing the execution of Psi code. + + Args: + input: The input code to be executed. + + Returns: + None + + Example: + ```python + execution = Execution("print('Hello, World!')") + execution.execute() + ``` + """ + def __init__(self, input): + """ + Initializes an Execution object. + + Args: + input: The input code to be executed. + + Returns: + None + """ self.input = input def execute(self): + """ + Executes the input code. + + Returns: + The result of the execution. + """ parser = Parser(self.input) ast = parser.parse() interpreter = Interpreter(ast) - result = interpreter.interpret() - - return result + return interpreter.interpret() -- cgit v1.2.3-70-g09d2