diff --git a/codergpt.explainer.html b/codergpt.explainer.html index 31a99d2..6780ed6 100644 --- a/codergpt.explainer.html +++ b/codergpt.explainer.html @@ -143,41 +143,53 @@

Submodules +

Module contents

+

Code explanation module.

-
-class codergpt.explainer.explainer.ExpressionEvaluator(source_code, function_name=None, class_name=None)
-

Bases: NodeVisitor

-

Evaluate the code expression and extract the source code of the specified function or class.

+
+class codergpt.explainer.CodeExplainer(chain)
+

Bases: object

+

Code Explainer class that extracts and explains code from a given file.

-
-visit_ClassDef(node)
-

Visit a ClassDef (class definition) node in the AST.

-

If the class name matches the target class name, it extracts the source segment.

+
+explain(path, function=None, classname=None)
+

Explain the contents of the code file by invoking the runnable chain.

Parameters:
-

node (ast.ClassDef) – The node representing a class definition in the AST.

+
    +
  • path (Union[str, Path]) – The path to the code file to be explained.

  • +
  • function (Optional[str]) – The name of the function to explain. Default is None.

  • +
  • classname (Optional[str]) – The name of the class to explain. Default is None.

  • +
-
-visit_FunctionDef(node)
-

Visit a FunctionDef (function definition) node in the AST.

-

If the function name matches the target function name, it extracts the source segment.

+
+get_function_code(filename, function_name=None, class_name=None)
+

Extract and return the source code of the specified function or class from a file.

Parameters:
-

node (ast.FunctionDef) – The node representing a function definition in the AST.

+
    +
  • filename (str) – The path to the file containing the code.

  • +
  • function_name (Optional[str]) – The name of the function to extract code for. Default is None.

  • +
  • class_name (Optional[str]) – The name of the class to extract code for. Default is None.

  • +
+
+
Return type:
+

Optional[str]

+
+
Returns:
+

The extracted source code of the specified function or class, if found.

- -
-

Module contents

-

Code explanation module.

diff --git a/codergpt.html b/codergpt.html index b23a296..4f7a0fa 100644 --- a/codergpt.html +++ b/codergpt.html @@ -112,14 +112,16 @@

SubpackagesCodeExplainer.get_function_code() -
  • ExpressionEvaluator +
  • +
  • Module contents
  • -
  • Module contents
  • codergpt.optimizer package