@@ -207,7 +207,7 @@ def _resolve_symlink(file_path):
207207def detect_filetype (
208208 filename : Optional [str ] = None ,
209209 content_type : Optional [str ] = None ,
210- file : Optional [IO ] = None ,
210+ file : Optional [IO [ bytes ] ] = None ,
211211 file_filename : Optional [str ] = None ,
212212 encoding : Optional [str ] = "utf-8" ,
213213) -> Optional [FileType ]:
@@ -370,7 +370,7 @@ def _detect_filetype_from_octet_stream(file: IO) -> FileType:
370370
371371def _read_file_start_for_type_check (
372372 filename : Optional [str ] = None ,
373- file : Optional [IO ] = None ,
373+ file : Optional [IO [ bytes ] ] = None ,
374374 encoding : Optional [str ] = "utf-8" ,
375375) -> str :
376376 """Reads the start of the file and returns the text content."""
@@ -396,7 +396,7 @@ def _read_file_start_for_type_check(
396396
397397def _is_text_file_a_json (
398398 filename : Optional [str ] = None ,
399- file : Optional [IO ] = None ,
399+ file : Optional [IO [ bytes ] ] = None ,
400400 encoding : Optional [str ] = "utf-8" ,
401401):
402402 """Detects if a file that has a text/plain MIME type is a JSON file."""
@@ -413,7 +413,7 @@ def _count_commas(text: str):
413413
414414def _is_text_file_a_csv (
415415 filename : Optional [str ] = None ,
416- file : Optional [IO ] = None ,
416+ file : Optional [IO [ bytes ] ] = None ,
417417 encoding : Optional [str ] = "utf-8" ,
418418):
419419 """Detects if a file that has a text/plain MIME type is a CSV file."""
0 commit comments