Skip to content

Commit 160f5bc

Browse files
Merge pull request #28 from acezxn/python_tsanalyzer_bug_fix
Fixed faulty python function parameter parsing
2 parents a97be88 + 11d955c commit 160f5bc

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/llmtool/dfbscan/intra_dataflow_analyzer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from os import path
22
import json
33
import time
4-
from typing import List, Set, Optional, Dict
4+
from typing import List, Set, Optional, Dict, Any
55
from llmtool.LLM_utils import *
66
from llmtool.LLM_tool import *
77
from memory.syntactic.function import *
@@ -138,7 +138,7 @@ def _parse_response(
138138
r"Line:\s*([^;]+);"
139139
)
140140

141-
current_path = None
141+
current_path: dict[str, Any] | None = None
142142
for line in response.splitlines():
143143
line = line.strip().lstrip("-").strip()
144144
if not line:

src/tstool/analyzer/Python_TS_analyzer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ def get_parameters_in_single_function(
159159
parameter_name = ""
160160
for sub_node in parameter_node.children:
161161
for sub_sub_node in find_nodes_by_type(sub_node, "identifier"):
162+
if sub_sub_node.parent and sub_sub_node.parent.type == "type":
163+
# Disregard type annotations
164+
continue
165+
162166
parameter_name = file_content[
163167
sub_sub_node.start_byte : sub_sub_node.end_byte
164168
]

0 commit comments

Comments
 (0)