CollectionList Class

class modelindex.models.CollectionList.CollectionList(collections: Optional[Union[List[Union[modelindex.models.Collection.Collection, Dict]], modelindex.models.Collection.Collection, Dict]] = None, _filepath: Optional[str] = None, _path_to_readme: Optional[str] = None)[source]

A list of Collection objects.

Parameters
  • collections (list,Collection,dict) – Either a list of Collection objects, a single Collection object or a dict representing a Collection

  • _filepath (str) – The file path to where the data was loaded from

  • _path_to_readme (str) – Path to README if it was loaded from there

__init__(collections: Optional[Union[List[Union[modelindex.models.Collection.Collection, Dict]], modelindex.models.Collection.Collection, Dict]] = None, _filepath: Optional[str] = None, _path_to_readme: Optional[str] = None)[source]
Parameters
  • collections (list,Collection,dict) – Either a list of Collection objects, a single Collection object or a dict representing a Collection

  • _filepath (str) – The file path to where the data was loaded from

  • _path_to_readme (str) – Path to README if it was loaded from there

property collections

Get the list of Collection objects

add(col: Union[modelindex.models.Collection.Collection, Dict], _filepath: Optional[str] = None)[source]

Add a Collection to the list.

Parameters
  • col (Collection, dict) – Either a Collection or a dict representing a collection

  • _filepath (str) – The path from which it was loaded

static from_file(filepath: Optional[str] = None, parent_filepath: Optional[str] = None)[source]

Load a Collection from a file.

Parameters
  • filepath (str) – File from which to load the collection

  • parent_filepath (str) – Parent filename (if file is imported from another file)