awesome-fastapi-projects/fastapi_projects/packages.py
Marcelo Trylesinski 445ca2647a add
2021-05-09 03:05:11 +02:00

12 lines
315 B
Python

from typing import TextIO
def get_packages(file: TextIO):
try:
for line in file.readlines():
clean_line = line.strip()
if clean_line.startswith(("from ", "import ")):
yield clean_line.replace(".", " ").split()[1]
except UnicodeDecodeError:
yield ""