Add type hint in extract_text_from_file
This commit is contained in:
parent
cb205069bc
commit
5b07a0a3d2
1 changed files with 2 additions and 1 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
from typing import BinaryIO
|
from typing import BinaryIO
|
||||||
from pypdf import PdfReader
|
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"""
|
"""Extract text from a file"""
|
||||||
if file_type.extension == "pdf":
|
if file_type.extension == "pdf":
|
||||||
reader = PdfReader(stream = file)
|
reader = PdfReader(stream = file)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue