class documentation

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_update 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_folder Undocumented
Instance Variable listing_file Undocumented
Property name name of this list
Static Method _file Undocumented
Static Method _fullfile Undocumented
Static Method _name Undocumented
Method _makepathsabsolute Undocumented
Method _remove_double_entries keep the first of duplicated entries
Method _save_walk 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_walk Undocumented

Inherited from StrList:

Method __call__ alias to find
Method find return entries that match all substrs.
Method find_indices same as find but returns indices instead of names
Method print print the result of find(*substrs) with indices.
Property as_string return space separated string concatenation surrounded by spaces.
Property found StrList of elements found during the last call to find.
Instance Variable _names_found Undocumented
@classmethod
def register(cls, folder):

add folder path or url to list of archives.

Caveat: existing class instances won't be aware of new registrations.

@staticmethod
def lists():

Undocumented

def __init__(self, listing_name=None):

print available archive lists if no listing file is given

def remote_update(self, name=None):

join in the respective list from coco_url.rsplit('/')[0] + '/data-archives'.

Use save to save the joined entries.

def save(self):

save current list making changes permanent

def update(self):

update self from the listing file that may have changed

@property
name =

name of this list

@staticmethod
def _file(listing_name):

Undocumented

@staticmethod
def _fullfile(listing_name):

Undocumented

@staticmethod
def _name(listing_file):

Undocumented

def _makepathsabsolute(self):

Undocumented

def _remove_double_entries(self):

keep the first of duplicated entries

def _save_walk(self):

extend self by elements of _last_walk not in self and save

def _walk(self, folder=None):

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.

_last_walk =

Undocumented