Skip to content

Commit

Permalink
add func dto
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhan-Faisal committed Jan 15, 2025
1 parent 185362c commit 02ce99c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/fml_doc_gen/fml_doc_gen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Callable
from fml_doc_gen import FunctionDTO


def generate_docstring_template(func: Callable, output_file: str, auto_generate: bool = False) -> str:
"""
Expand Down Expand Up @@ -39,7 +41,7 @@ def generate_docstring_template(func: Callable, output_file: str, auto_generate:
pass


def read_user_function(func: Callable) -> str:
def read_user_function(func: Callable) -> FunctionDTO:
"""
Reads the source code of the user-provided function and extracts its signature and existing docstring (if any).
Expand All @@ -65,7 +67,7 @@ def read_user_function(func: Callable) -> str:
pass


def generate_template(func_signature: str) -> str:
def generate_template(func_signature: FunctionDTO) -> str:
"""
Generates a docstring template with placeholders for parameters, return values, and a brief description
based on the provided function signature.
Expand Down
7 changes: 7 additions & 0 deletions src/fml_doc_gen/func_dto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from typing import List, Optional, Tuple

class FunctionDTO:
def __init__(self, name: str, output: Optional[str] = None, inputs: Optional[List[Tuple[str, str]]] = []):
self.name = name
self.output_type = output
self.inputs = [(name, input_type) for (name, input_type) in inputs]

0 comments on commit 02ce99c

Please sign in to comment.