@@ -68,13 +68,14 @@ def get(
68
68
self ,
69
69
path : pathlib .Path | str ,
70
70
default_filetype : str ,
71
- force_filetype : str | None ,
71
+ force_filetype : str | None = None ,
72
72
) -> t .Callable [[t .IO [bytes ]], t .Any ]:
73
- filetype = path_to_type (path , default_type = default_filetype )
73
+ if force_filetype :
74
+ filetype = force_filetype
75
+ else :
76
+ filetype = path_to_type (path , default_type = default_filetype )
74
77
75
78
if filetype in self ._by_tag :
76
- filetype = force_filetype or filetype
77
-
78
79
return self ._by_tag [filetype ]
79
80
80
81
if filetype in MISSING_SUPPORT_MESSAGES :
@@ -92,7 +93,7 @@ def parse_data_with_path(
92
93
data : t .IO [bytes ] | bytes ,
93
94
path : pathlib .Path | str ,
94
95
default_filetype : str ,
95
- force_filetype : str | None ,
96
+ force_filetype : str | None = None ,
96
97
) -> t .Any :
97
98
loadfunc = self .get (path , default_filetype , force_filetype )
98
99
try :
@@ -106,7 +107,7 @@ def parse_file(
106
107
self ,
107
108
path : pathlib .Path | str ,
108
109
default_filetype : str ,
109
- force_filetype : str | None ,
110
+ force_filetype : str | None = None ,
110
111
) -> t .Any :
111
112
with open (path , "rb" ) as fp :
112
113
return self .parse_data_with_path (fp , path , default_filetype , force_filetype )
0 commit comments