Spaces:
Runtime error
Runtime error
Update process_python_code
Browse files- process_python_code +0 -28
process_python_code
CHANGED
|
@@ -275,31 +275,3 @@ def handle_first_level_func(function_node, documents, source_code, imports_dict)
|
|
| 275 |
#chunkPythonFiles(source_code, file_path)
|
| 276 |
|
| 277 |
|
| 278 |
-
import os
|
| 279 |
-
|
| 280 |
-
def process_folder(folder_path):
|
| 281 |
-
# Initialize a counter for the number of Python files
|
| 282 |
-
python_file_count = 0
|
| 283 |
-
docsT = []
|
| 284 |
-
# Walk through all subdirectories and files in the folder
|
| 285 |
-
for root, _, files in os.walk(folder_path):
|
| 286 |
-
for file_name in files:
|
| 287 |
-
# Create the full file path
|
| 288 |
-
file_path = os.path.join(root, file_name)
|
| 289 |
-
#print(file_path)
|
| 290 |
-
|
| 291 |
-
# Ensure it's a Python file
|
| 292 |
-
if file_name.endswith(".py"):
|
| 293 |
-
python_file_count += 1 # Increment the counter
|
| 294 |
-
with open(file_path, "r", encoding="utf-8") as file:
|
| 295 |
-
source_code = file.read()
|
| 296 |
-
print(file_name)
|
| 297 |
-
|
| 298 |
-
# Call your function
|
| 299 |
-
docs = chunkPythonFiles(source_code, file_path)
|
| 300 |
-
|
| 301 |
-
print("HWHWHWWHWHWHWH!:" ,len(docs))
|
| 302 |
-
docsT.extend(docs)
|
| 303 |
-
# Print the total number of Python files processed
|
| 304 |
-
print(f"Total Python files processed: {python_file_count}")
|
| 305 |
-
print(f"Total docs files processed: {len(docsT)}")
|
|
|
|
| 275 |
#chunkPythonFiles(source_code, file_path)
|
| 276 |
|
| 277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|