datalad.support.archives¶
Various handlers/functionality for different types of files (e.g. for archives)
-
class
datalad.support.archives.
ArchivesCache
(toppath=None, persistent=False)[source]¶ Bases:
object
Cache to maintain extracted archives
Parameters: -
path
¶
-
-
class
datalad.support.archives.
ExtractedArchive
(archive, path=None, persistent=False)[source]¶ Bases:
object
Container for the extracted archive
-
STAMP_SUFFIX
= '.stamp'¶
-
get_extracted_filename
(afile)[source]¶ Return full path to the afile within extracted archive
It does not actually extract any archive
-
get_extracted_files
()[source]¶ Generator to provide filenames which are available under extracted archive
-
get_leading_directory
(depth=None, consider=None, exclude=None)[source]¶ Return leading directory of the content within archive
Parameters: - depth (int or None, optional) – Maximal depth of leading directories to consider. If None - no upper limit
- consider (list of str, optional) – Regular expressions for file/directory names to be considered (before exclude). Applied to the entire relative path to the file as in the archive
- exclude (list of str, optional) – Regular expressions for file/directory names to be excluded from consideration. Applied to the entire relative path to the file as in the archive
Returns: If there is no single leading directory – None returned
Return type:
-
is_extracted
¶
-
path
¶ Given an archive – return full path to it within cache (extracted)
-
stamp_path
¶
-
-
datalad.support.archives.
compress_files
(files, archive, path=None, overwrite=True)[source]¶ Compress files into an archive file
Parameters: