feat: add links to table

This commit is contained in:
Marcelo Trylesinski 2020-07-10 01:41:21 +02:00
parent c0df8d6f92
commit c2d44ac780
2 changed files with 546 additions and 545 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ import json
from pytablewriter import MarkdownTableWriter from pytablewriter import MarkdownTableWriter
from stdlib_list import stdlib_list from stdlib_list import stdlib_list
NATIVE = ["fastapi", "starlette", "pydantic", "typing", "uvicorn"] NATIVE = ["fastapi", "starlette", "pydantic", "typing", "uvicorn", "app"]
def filter_list(dependencies: List[str]) -> List[str]: def filter_list(dependencies: List[str]) -> List[str]:
@ -18,13 +18,23 @@ def filter_list(dependencies: List[str]) -> List[str]:
] ]
def format_with_link(project: str) -> str:
links = open("unique_links.txt", "r")
for link in links.readlines():
if project in link:
return f"[{project}]({link})"
with open("results.json") as json_file: with open("results.json") as json_file:
data = json.load(json_file) data = json.load(json_file)
writer = MarkdownTableWriter() writer = MarkdownTableWriter()
writer.headers = ["Project", "Dependencies"] writer.headers = ["Project", "Dependencies"]
writer.value_matrix = [ writer.value_matrix = [
[project, filter_list(dependencies)] [format_with_link(project), filter_list(dependencies)]
for project, dependencies in data.items() for project, dependencies in data.items()
if len(filter_list(dependencies)) > 0 and len(filter_list(dependencies)) < 20 if (
len(filter_list(dependencies)) > 0
and len(filter_list(dependencies)) < 20
and project != ""
)
] ]
writer.write_table() writer.write_table()