cocopp.archiving.ListOfArchives(_td.StrList)
class documentationcocopp.archiving
(View In Hierarchy)
Known subclasses: cocopp.archiving._ArchivesOfficial, cocopp.archiving.ArchivesKnown, cocopp.archiving.ArchivesLocal
List of URLs or path names to COCO data archives available to this user.
Elements can be added with append
and deleted with the respective
list
operations. After any of these operations, the current state can
be made "permanent" with save
.
Archives created with create
are automatically added to
ArchivesLocal
to find splattered archives more easily, archives
retrieved from a remote location with get
are added to
ArchivesKnown
.
Elements of the list are meant to be used directly as argument to get
.
>>> import cocopp.archiving as ar >>> ar.ListOfArchives.lists() # doctest:+ELLIPSIS {...
returns all available archive lists.
To reassign a given list:
>>> l = ar.ListOfArchives('test') >>> l[:] = ['p2', 'p1'] # re-assign a new value to the list >>> l.sort() # `list` builtin in-place sort method >>> l.save() # doctest:+SKIP
To save the list, a listing name needs to be given on instantiation. Two inherited classes are
>>> ar.ArchivesKnown() and ar.ArchivesLocal() # doctest:+ELLIPSIS [...
where the former contains downloaded "inofficial" archives. To add all locally created archives within the user home directory tree (CAVEAT: the search may take a while):
>>> al = ar.ArchivesLocal() # based on user home >>> al._walk() # doctest:+SKIP >>> al._save_walk() # add found paths (permanently) to the ArchivesLocal class
Details: duplicates are removed during save
. Path names are stored as
absolute path names (OS-dependent).
TODO: should we be able to generate a list on the fly? Figure out usecase with _walk?
TODO-decide: usecase, when to decide setting search_folder?
Method | __init__ | print available archive lists if no listing file is given |
Method | name | name of this list |
Static Method | lists | Undocumented |
Class Method | register | add folder path or url to list of archives. |
Method | save | save current list making changes permanent |
Method | remote_update | join in the respective list from http://coco.gforge.inria.fr/data-archives. |
Method | update | update self from the listing file that may have changed |
Static Method | _name | Undocumented |
Static Method | _file | Undocumented |
Static Method | _fullfile | Undocumented |
Method | _makepathsabsolute | Undocumented |
Method | _remove_double_entries | keep the first of duplicated entries |
Method | _walk | recursive search for COCO data archives in folder on disk. |
Method | _save_walk | extend self by elements of _last_walk not in self and save |
add folder path or url to list of archives.
Caveat: existing class instances won't be aware of new registrations.
join in the respective list from http://coco.gforge.inria.fr/data-archives.
Use save
to save the joined entries.