Add type hint in extract_text_from_file

This commit is contained in:
Leon Luithlen 2024-11-04 17:24:46 +01:00
parent cb205069bc
commit 5b07a0a3d2

View file

@ -1,7 +1,8 @@
from typing import BinaryIO
from pypdf import PdfReader
import filetype
def extract_text_from_file(file: BinaryIO, file_type) -> str:
def extract_text_from_file(file: BinaryIO, file_type: filetype.Type) -> str:
"""Extract text from a file"""
if file_type.extension == "pdf":
reader = PdfReader(stream = file)