Spaces:
Runtime error
Runtime error
refactor
Browse files- app.py +1 -6
- py_code_analyzer/code_imports_analyzer.py +2 -2
app.py
CHANGED
|
@@ -3,10 +3,5 @@ from py_code_analyzer.code_imports_analyzer import CodeImportsAnalyzer
|
|
| 3 |
from py_code_analyzer.imports_graph_visualizer import ImportsGraphVisualizer
|
| 4 |
|
| 5 |
python_files = CodeFetcher().get_python_files("cyyeh", "gradio", "gradio")
|
| 6 |
-
imports_graph = (
|
| 7 |
-
CodeImportsAnalyzer(python_files)
|
| 8 |
-
.analyze_imports()
|
| 9 |
-
.generate_imports_graph()
|
| 10 |
-
.imports_graph
|
| 11 |
-
)
|
| 12 |
ImportsGraphVisualizer().visualize(imports_graph)
|
|
|
|
| 3 |
from py_code_analyzer.imports_graph_visualizer import ImportsGraphVisualizer
|
| 4 |
|
| 5 |
python_files = CodeFetcher().get_python_files("cyyeh", "gradio", "gradio")
|
| 6 |
+
imports_graph = CodeImportsAnalyzer(python_files).analyze().generate_imports_graph()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
ImportsGraphVisualizer().visualize(imports_graph)
|
py_code_analyzer/code_imports_analyzer.py
CHANGED
|
@@ -33,7 +33,7 @@ class CodeImportsAnalyzer:
|
|
| 33 |
self.python_files = python_files
|
| 34 |
self._node_visitor = CodeImportsAnalyzer._NodeVisitor(self.imports)
|
| 35 |
|
| 36 |
-
def
|
| 37 |
for python_file in self.python_files:
|
| 38 |
program = requests.get(python_file["download_url"]).text
|
| 39 |
tree = ast.parse(program)
|
|
@@ -57,7 +57,7 @@ class CodeImportsAnalyzer:
|
|
| 57 |
else:
|
| 58 |
self.imports_graph.add_node(_nodes[0])
|
| 59 |
|
| 60 |
-
return self
|
| 61 |
|
| 62 |
def report(self):
|
| 63 |
pprint(self.imports)
|
|
|
|
| 33 |
self.python_files = python_files
|
| 34 |
self._node_visitor = CodeImportsAnalyzer._NodeVisitor(self.imports)
|
| 35 |
|
| 36 |
+
def analyze(self):
|
| 37 |
for python_file in self.python_files:
|
| 38 |
program = requests.get(python_file["download_url"]).text
|
| 39 |
tree = ast.parse(program)
|
|
|
|
| 57 |
else:
|
| 58 |
self.imports_graph.add_node(_nodes[0])
|
| 59 |
|
| 60 |
+
return self.imports_graph
|
| 61 |
|
| 62 |
def report(self):
|
| 63 |
pprint(self.imports)
|