MCPcopy Create free account
hub / github.com/danielpatrickhug/GitModel / parse_github_repo

Function parse_github_repo

src/ast_parsers/python_ast_parser.py:47–64  ·  view source on GitHub ↗
(local_dir)

Source from the content-addressed store, hash-verified

45
46
47def parse_github_repo(local_dir):
48 parsed_files = []
49 content_labels = {0: "imports", 1: "globals", 2: "classes", 3: "functions", 4: "main", 5: "file_name"}
50
51 for root, dirs, files in os.walk(local_dir):
52 for file_name in files:
53 if file_name.endswith(".py"):
54 file_path = os.path.join(root, file_name)
55 try:
56 parsed_contents = parse_python_file(file_path)
57 content = {content_labels[i]: v for i, v in enumerate(parsed_contents.values())}
58 content[content_labels[5]] = file_path
59 parsed_files.append(content)
60 except Exception as e:
61 print(e)
62 continue
63
64 return parsed_files

Callers 1

get_repo_contentsMethod · 0.90

Calls 1

parse_python_fileFunction · 0.85

Tested by

no test coverage detected