Spaces:
Runtime error
Runtime error
rename functions
Browse files
py_code_analyzer/code_fetcher.py
CHANGED
|
@@ -4,7 +4,7 @@ how to get all python files in the given directory
|
|
| 4 |
import requests
|
| 5 |
|
| 6 |
|
| 7 |
-
def
|
| 8 |
import os
|
| 9 |
|
| 10 |
# to increase api rate limiting
|
|
@@ -33,7 +33,7 @@ class CodeFetcher:
|
|
| 33 |
"""https://docs.github.com/en/rest/git/trees#get-a-tree"""
|
| 34 |
# TODO: deal with truncated api results
|
| 35 |
|
| 36 |
-
api_url =
|
| 37 |
|
| 38 |
response = requests.get(
|
| 39 |
api_url, headers={"Accept": "application/vnd.github.v3+json"}
|
|
|
|
| 4 |
import requests
|
| 5 |
|
| 6 |
|
| 7 |
+
def construct_fetch_repo_content_api_url(owner, repo, tree_sha, recursive):
|
| 8 |
import os
|
| 9 |
|
| 10 |
# to increase api rate limiting
|
|
|
|
| 33 |
"""https://docs.github.com/en/rest/git/trees#get-a-tree"""
|
| 34 |
# TODO: deal with truncated api results
|
| 35 |
|
| 36 |
+
api_url = construct_fetch_repo_content_api_url(owner, repo, tree_sha, recursive)
|
| 37 |
|
| 38 |
response = requests.get(
|
| 39 |
api_url, headers={"Accept": "application/vnd.github.v3+json"}
|
py_code_analyzer/code_imports_analyzer.py
CHANGED
|
@@ -10,7 +10,7 @@ import pybase64
|
|
| 10 |
from .graph_analyzer import GraphAnalyzer
|
| 11 |
|
| 12 |
|
| 13 |
-
def
|
| 14 |
import os
|
| 15 |
|
| 16 |
# to increase api rate limiting
|
|
@@ -27,7 +27,7 @@ def construct_api_url(api_url):
|
|
| 27 |
|
| 28 |
async def get_program_text(session, python_file):
|
| 29 |
async with session.get(
|
| 30 |
-
|
| 31 |
headers={"Accept": "application/vnd.github.v3+json"},
|
| 32 |
) as response:
|
| 33 |
data = await response.json()
|
|
|
|
| 10 |
from .graph_analyzer import GraphAnalyzer
|
| 11 |
|
| 12 |
|
| 13 |
+
def construct_fetch_program_text_api_url(api_url):
|
| 14 |
import os
|
| 15 |
|
| 16 |
# to increase api rate limiting
|
|
|
|
| 27 |
|
| 28 |
async def get_program_text(session, python_file):
|
| 29 |
async with session.get(
|
| 30 |
+
construct_fetch_program_text_api_url(python_file["url"]),
|
| 31 |
headers={"Accept": "application/vnd.github.v3+json"},
|
| 32 |
) as response:
|
| 33 |
data = await response.json()
|