@@ -68,13 +68,14 @@ def get(
6868 self ,
6969 path : pathlib .Path | str ,
7070 default_filetype : str ,
71- force_filetype : str | None ,
71+ force_filetype : str | None = None ,
7272 ) -> 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 )
7477
7578 if filetype in self ._by_tag :
76- filetype = force_filetype or filetype
77-
7879 return self ._by_tag [filetype ]
7980
8081 if filetype in MISSING_SUPPORT_MESSAGES :
@@ -92,7 +93,7 @@ def parse_data_with_path(
9293 data : t .IO [bytes ] | bytes ,
9394 path : pathlib .Path | str ,
9495 default_filetype : str ,
95- force_filetype : str | None ,
96+ force_filetype : str | None = None ,
9697 ) -> t .Any :
9798 loadfunc = self .get (path , default_filetype , force_filetype )
9899 try :
@@ -106,7 +107,7 @@ def parse_file(
106107 self ,
107108 path : pathlib .Path | str ,
108109 default_filetype : str ,
109- force_filetype : str | None ,
110+ force_filetype : str | None = None ,
110111 ) -> t .Any :
111112 with open (path , "rb" ) as fp :
112113 return self .parse_data_with_path (fp , path , default_filetype , force_filetype )
0 commit comments