DouDou commited on
Commit
f83ae37
·
verified ·
1 Parent(s): c21b56f

Upload data2/instruction_generation/prompts/function_extract.txt with huggingface_hub

Browse files
data2/instruction_generation/prompts/function_extract.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a professional code analysis tool. Please analyze the following code file and extract file-level dependencies and all function information.
2
+
3
+ Project Context:
4
+ {project_context}
5
+
6
+ Code file path: {file_path}
7
+ Programming language: {language}
8
+
9
+ Below is the code file content:
10
+
11
+ ```{language}
12
+ {code_content}
13
+ ```
14
+
15
+ Requirements:
16
+ 1. Extract file-level dependencies: Find all import/include/use/require statements, list external packages, modules, and libraries (only external dependencies, excluding relative imports within the same project)
17
+ 2. Extract all functions:
18
+ - Function name
19
+ - Function start line number and end line number (1-indexed, inclusive)
20
+ - Complete function body (including function definition and body)
21
+ - Function documentation comment start and end line numbers (if any)
22
+ 3. For nested functions, also extract them (each independent function should be one record)
23
+ 4. If the code file is not function-structured (e.g., scripts, configuration files, etc.), the dependency list can be empty, and the functions list can also be empty
24
+
25
+ Please output the result according to the following JSON Schema (must use JSON, do not include any other text):
26
+
27
+ {{
28
+ "language": "Programming language (e.g., python, cpp, java, etc.)",
29
+ "file_path": "Relative file path",
30
+ "dependencies": ["dependency1", "dependency2", ...],
31
+ "functions": [
32
+ {{
33
+ "function_name": "function name",
34
+ "function_start_line": start_line_number,
35
+ "function_end_line": end_line_number,
36
+ "function_body": "complete function code body",
37
+ "doc_start_line": documentation start line number (if any, otherwise null),
38
+ "doc_end_line": documentation end line number (if any, otherwise null)
39
+ }},
40
+ ...
41
+ ]
42
+ }}
43
+
44
+ Note:
45
+ - Output only the JSON object, do not include any prefix or suffix text
46
+ - Line numbers must be accurate for subsequent code extraction
47
+ - function_body should be the complete function code (from def/function/... to the end of the function)
48
+ - If the file is too large to analyze completely, please note this in comments