def _parse_singlefile(self, desired_type: Type[T], file_path: str, encoding: str, logger: Logger,<EOL>options: Dict[str, Dict[str, Any]]) -> T:
opts = get_options_for_id(options, self.get_id_for_options())<EOL>if self._streaming_mode:<EOL><INDENT>file_stream = None<EOL>try:<EOL><INDENT>file_stream = open(file_path, '<STR_LIT:r>', encoding=encoding)<EOL>if self.function_args is None:<EOL><INDENT>return self._parser_func(desired_type, file_stream, logger, **opts)<EOL><DEDENT>else:<EOL><INDENT>return self._parser_func(desired_type, file_stream, logger, **self.function_args, **opts)<EOL><DEDENT><DEDENT>except TypeError as e:<EOL><INDENT>raise CaughtTypeError.create(self._parser_func, e)<EOL><DEDENT>finally:<EOL><INDENT>if file_stream is not None:<EOL><INDENT>file_stream.close()<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if self.function_args is None:<EOL><INDENT>return self._parser_func(desired_type, file_path, encoding, logger, **opts)<EOL><DEDENT>else:<EOL><INDENT>return self._parser_func(desired_type, file_path, encoding, logger, **self.function_args, **opts)<EOL><DEDENT><DEDENT>
Relies on the inner parsing function to parse the file.
If _streaming_mode is True, the file will be opened and closed by this method. Otherwise the parsing function
will be responsible to open and close.

:param desired_type:
:param file_path:
:param encoding:
:param options:
:return: