madam.vector
module¶
-
class
madam.vector.
SVGMetadataProcessor
[source]¶ Bases:
madam.core.MetadataProcessor
Represents a metadata processor that handles Scalable Vector Graphics (SVG) data.
It is assumed that the SVG XML uses UTF-8 encoding.
-
combine
(file, metadata)[source]¶ Returns a byte stream whose contents represent the specified file where the specified metadata was added.
Parameters: - metadata (dict) – Mapping of the metadata format to the metadata dict
- file (file-like object) – Container file
Returns: file-like object with combined content
Return type:
-
formats
¶ The metadata formats which are supported.
Returns: supported metadata formats Return type: set[str]
-
read
(file)[source]¶ Reads the file and returns the metadata.
The metadata that is returned is grouped by type. The keys are specified by
format
.Parameters: file (file-like object) – File-like object to be read Returns: Metadata contained in the file Return type: dict Raises: UnsupportedFormatError – if the data is corrupt or its format is not supported
-
strip
(file)[source]¶ Removes all metadata of the supported type from the specified file.
Parameters: file (file-like object) – file-like that should get stripped of the metadata Returns: file-like object without metadata Return type: io.BytesIO
-
-
class
madam.vector.
SVGProcessor
[source]¶ Bases:
madam.core.Processor
Represents a processor that handles Scalable Vector Graphics (SVG) data.
-
can_read
(file)[source]¶ Returns whether the specified MIME type is supported by this processor.
Parameters: file (file-like object) – file-like object to be tested Returns: whether the data format of the specified file is supported or not Return type: bool
-
read
(file)[source]¶ Returns an
Asset
object whose essence is identical to the contents of the specified file.Parameters: file (file-like object) – file-like object to be read Returns: Asset with essence Return type: Asset Raises: UnsupportedFormatError – if the specified data format is not supported
-