infer_file_format

glotaran.plugin_system.io_plugin_utils.infer_file_format(file_path: StrOrPath, *, needs_to_exist: bool = True, allow_folder=False) str[source]

Infer format of a file if it exists.

Parameters:
  • file_path (StrOrPath) – Path/str to the file.

  • needs_to_exist (bool) – Whether or not a file need to exists for an successful format inferring. While write functions don’t need the file to exists, load functions do.

  • allow_folder (bool) – Whether or not to allow the format to be folder. This is only used in save_result.

Returns:

File extension without the leading dot.

Return type:

str

Raises: