Skip to content

The FormatInfo class

This is what a guess_file_format() method of a FormatDetector returns.

gamslib.formatdetect.formatinfo.FormatInfo dataclass

FormatInfo(detector, mimetype, subtype=None, pronom_id=None)

Object containing basic information about the format of a file.

FormatInfo objects are returned by format detectors.

ATTRIBUTE DESCRIPTION
detector

Name of the detector that detected the format.

TYPE: str

mimetype

MIME type of the file (e.g., 'text/xml').

TYPE: str

subtype

Subtype of the format, if detected.

TYPE: SubType | None

detector instance-attribute

detector

mimetype instance-attribute

mimetype

subtype class-attribute instance-attribute

subtype = None

pronom_id class-attribute instance-attribute

pronom_id = None

description property

description

Return a human-friendly description of the format.

RETURNS DESCRIPTION
str

Description based on subtype info, MIME type, or defaults.

TYPE: str

is_xml_type

is_xml_type()

Return True if the Format is XML (or a subtype of XML).

is_json_type

is_json_type()

Return True if the subtype is a JSON type or a subtype of JSON.