Entry point of metadata providers is a class inheriting from soclib_desc.metadata_file.MetadataFile. This class will be instanciated once per found metadata file, and must return modules when asked for.
The API to implement to create a new metadata provider is “extensions” and “get_modules”:
See .sd file format for an example of such class.
A class attribute containing a list of handled extensions.
This parses and retrives all modules defined in the file.
Returns: | a list of modules defined in the handled file. |
---|
Here is complete API for this class, for reference. These methods are already implemented, no need to define them in metadata providers.
Create a new parser for the given file path.
Parameters: | path – path to a file |
---|
The full path of file.
Handling of contained data:
Calls the given callback for each module
Information about pertinence of data:
Returns whether the in-memory cache of this file is outdated. This is based of file modification time.
Returns: | Whether memory cache is stale |
---|
Loading of data:
This may rehash the cached file, if necessary (modification).
Unconditionnaly reloads a description.
Here are the class methods of soclib_desc.metadata_file.MetadataFile. They are able to find the correct subclass of soclib_desc.metadata_file.MetadataFile able to handle a given file.
Gets all the parser classes and append them to medata providers.
Parameters: | parsers – a list of strings containing names of Python subclasses of this one. |
---|
Try to find the metadata provider matching the given filename, if found, initialize it. If not found, raise a ValueError exception.
Parameters: | filename – file to handle |
---|---|
Returns: | a soclib_desc.metadata_file.MetadataFile subclass object |
Raises : | ValueError if file is unhandled |
Retrieves a regexp matching filenames of all currently handled files.
Returns: | a Python re object |
---|