I used the outlines method to create information about python code.
main.py
॥๛॥
⋮...
█def init_settings():
⋮...
█def init_encryption() -> Fernet:
⋮...
█async def init_database(data_dir: str) -> None:
⋮...
█async def main_async():
⋮...
█def main():
⋮...
Looks like some methods are cut off like test_init_encryption_new_password:
॥๛॥
tests/unit/test_main.py
॥๛॥
⋮...
█class TestMain:
⋮...
█ def test_init_settings_when_file_not_exists(self, mock_copy, mock_path_exists):
⋮...
█ def test_init_settings_file_exists(self, mock_copy, mock_path_exists):
⋮...
█ def test_init_encryption_new_password(self, mock_get_fernet, mock_hash_password,
⋮...
█ def test_init_encryption_existing_password_correct(self, mock_get_fernet,
⋮...
█ def test_init_encryption_existing_password_incorrect(self, mock_exit,
⋮...
I would suggest a simpler syntax:
# src/utils.py
def add(a: int, b: int) -> int:
class Helper:
value: int
def __init__(self, value1: int) -> None:
def increment(self) -> None:
async def get_info(self) -> Dict[str, Any]:
# src/main.py
def main() -> None:
And ideally it could also read the doc-strings in python (Docstrings are a specific type of comment in Python used to document code). This can give the LLM important context (for example return object structures could be described in the comments etc). According to a quick research with Grok, Treesitter should be able to do this. Example for output:
# src/utils.py
def add(a: int, b: int) -> int:
class Helper: I'm the class comment in one line, even if I have multiple lines.
value: int
def __init__(self, value1: int) -> None: I'm describing the method
def increment(self) -> None: Another description for the method
async def get_info(self) -> Dict[str, Any]:
# src/main.py
def main() -> None:
I used the outlines method to create information about python code.
Looks like some methods are cut off like
test_init_encryption_new_password:I would suggest a simpler syntax:
And ideally it could also read the doc-strings in python (Docstrings are a specific type of comment in Python used to document code). This can give the LLM important context (for example return object structures could be described in the comments etc). According to a quick research with Grok, Treesitter should be able to do this. Example for output: