mirror of
https://github.com/Kludex/awesome-fastapi-projects.git
synced 2025-01-31 05:33:42 +00:00
12 lines
315 B
Python
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 ""
|