The SiegfriedDetector class¶
This is the suggested and default Detector Class.
Usage:
from gamslib.formatdetect.siegfrieddetector import Siegfriedetector as Detector
detector = Detector()
format = detector.guess_file_type('foo/bar.xml')
gamslib.formatdetect.SiegfriedDetector
¶
Bases: FormatDetector
Detector that uses the Pygfried library to detect file formats.
Uses Siegfried's prediction engine to identify file types and MIME types.
Initialize the SiegfriedDetector.
looks_like_xml
staticmethod
¶
Return True if the file looks like an XML file.
has_xml_declaration
staticmethod
¶
Return True if filepath contains an xml declaration.
guess_file_type
¶
Detect the format of a file using Pygfried and return a FormatInfo object.
| PARAMETER | DESCRIPTION |
|---|---|
filepath
|
Path to the file to be analyzed.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FormatInfo
|
An object containing the detected format information.
TYPE:
|