guess_format_type#
- hexrec.base.guess_format_type(file_path)[source]#
Guesses the record format object type.
It calls
guess_format_name()
to return the registered object type withinFILE_TYPES
.- Parameters:
file_path (str) – File path to analyze.
- Returns:
str – Record object type registered within
FILE_TYPES
.- Raises:
ValueError – Cannot guess record file format.
See also
Examples
>>> from hexrec import guess_format_type >>> guess_format_type('simple.hex') <class 'hexrec.formats.ihex.IhexFile'> >>> guess_format_type('simple.srec') <class 'hexrec.formats.srec.SrecFile'> >>> guess_format_type('simple.s19') <class 'hexrec.formats.srec.SrecFile'> >>> guess_format_type('simple.mot') <class 'hexrec.formats.srec.SrecFile'> >>> guess_format_type('data.dat') <class 'hexrec.formats.raw.RawFile'>