datalad_next.iter_collections.utils
Utilities and types for collection iterators
- class datalad_next.iter_collections.utils.FileSystemItem(type: 'FileSystemItemType', name: 'Any', size: 'int', mtime: 'float | None' = None, mode: 'int | None' = None, uid: 'int | None' = None, gid: 'int | None' = None, link_target: 'Any | None' = None, fp: 'IO | None' = None)[source]
Bases:
PathBasedItem
,TypedItem
- fp: IO | None = None
- classmethod from_path(path: Path, *, link_target: bool = True)[source]
Populate item properties from a single stat and readlink call
The given
path
must exist. Thelink_target
flag indicates whether to report the result ofreadlink
for a symlink-type path.
- gid: int | None = None
- link_target: Any | None = None
- mode: int | None = None
- mtime: float | None = None
- size: int
- type: FileSystemItemType
- uid: int | None = None
- class datalad_next.iter_collections.utils.FileSystemItemType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
Enumeration of file system path types
The associated
str
values are chosen to be appropriate for downstream use (e.g, as type labels in DataLad result records).- directory = 'directory'
- file = 'file'
- hardlink = 'hardlink'
- specialfile = 'specialfile'
- symlink = 'symlink'
- class datalad_next.iter_collections.utils.PathBasedItem(name: Any)[source]
Bases:
NamedItem
An item with a path as its
name
A dedicated property supports the conversion of the native name representation into a
PurePath
instance.Any argument understood by the
PurePath
constructor can be used asname
, such as a a filename, a relative path, or an absolute path -- in string form, as path segment sequence, or aPath
instance.It is recommended to use name/path values that are relative to the containing collection (directory, archive, repository, etc.).