The MinimalDetector class¶
The Minimaldetector is a deprectated Implementation of the abstract FormatDetector class and should not be used anymore.
It will be removed in a later version.
gamslib.formatdetect.minimaldetector.MinimalDetector
¶
Bases: FormatDetector
Simple format detector using the Python mimetypes module.
This detector uses file extensions to determine the MIME type. It is not very reliable and should only be used if no other detector is available.
Initialize the MinimalDetector and register additional MIME types.
Notes
- Adds support for .jp2, .webp, .jsonld, .md, .xml, and .csv extensions.
guess_file_type
¶
Detect the format of a file using the mimetypes module.
| PARAMETER | DESCRIPTION |
|---|---|
filepath
|
Path to the file to analyze.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FormatInfo
|
Object containing detected format information.
TYPE:
|
Notes
- Uses DEFAULT_TYPE if MIME type cannot be determined.
- Integrates with xmltypes and jsontypes for subtype detection.
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.