class ListOfArchives(_td.StrList):
Known subclasses: cocopp.archiving.ArchivesKnown
, cocopp.archiving.ArchivesLocal
, cocopp.archiving._old_ArchivesOfficial
Constructor: ListOfArchives(listing_name)
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?
Class Method | register |
add folder path or url to list of archives. |
Static Method | lists |
Undocumented |
Method | __init__ |
print available archive lists if no listing file is given |
Method | remote |
join in the respective list from coco_url.rsplit('/')[0] + '/data-archives'. |
Method | save |
save current list making changes permanent |
Method | update |
update self from the listing file that may have changed |
Class Variable | search |
Undocumented |
Instance Variable | listing |
Undocumented |
Property | name |
name of this list |
Static Method | _file |
Undocumented |
Static Method | _fullfile |
Undocumented |
Static Method | _name |
Undocumented |
Method | _makepathsabsolute |
Undocumented |
Method | _remove |
keep the first of duplicated entries |
Method | _save |
extend self by elements of _last_walk not in self and save |
Method | _walk |
recursive search for COCO data archives in folder on disk. |
Instance Variable | _last |
Undocumented |
Inherited from StrList
:
Method | __call__ |
alias to find |
Method | find |
return entries that match all substrs . |
Method | find |
same as find but returns indices instead of names |
Method | print |
print the result of find(*substrs) with indices. |
Property | as |
return space separated string concatenation surrounded by spaces. |
Property | found |
StrList of elements found during the last call to find . |
Instance Variable | _names |
Undocumented |
add folder path or url to list of archives.
Caveat: existing class instances won't be aware of new registrations.
cocopp.toolsdivers.StrList.__init__
print available archive lists if no listing file is given
join in the respective list from coco_url.rsplit('/')[0] + '/data-archives'.
Use save
to save the joined entries.
cocopp.archiving.ArchivesKnown
, cocopp.archiving.ArchivesLocal
, cocopp.archiving._old_ArchivesOfficial
Undocumented
recursive search for COCO data archives in folder
on disk.
This may take (many?) seconds, for example if using folder='~'.
_last_walk
contains the returned result and _save_walk` makes the
result "permanent" to the current class instance / listing file.