ibridges.path.IrodsPath
- class ibridges.path.IrodsPath(session, *args)
A class analogous to the pathlib.Path for accessing iRods data.
The IrodsPath can be used in much the same way as a Path from the pathlib library. Not all methods and attributes are implemented, and some methods/attributes behave subtly different from the pathlib implementation. They mostly do with the expansion of the home directory. With the IrodsPath, the ‘~’ is used to denote the irods_home directory set in the Session object. So, for example the name of an irods path is always the name of the collection/subcollection, which is different from the pathlib behavior in some cases.
- __init__(session, *args)
Initialize IrodsPath object similar to the Path object.
It does take an extra argument in session.
- Parameters:
session – Session that is used for the ipath.
args – Specification of the path. For example: “x/z” or “x”, “z”.
- Raises:
TypeError: – If the provided session does not have an ‘irods_session’ attribute.
Examples
>>> IrodsPath(session, "~") # Get an iRods path of the irods_home collection. >>> IrodsPath(session, "/zone/home/some_collection") # Absolute path. >>> IrodsPath(session, "some_collection") # Relative path. >>> IrodsPath(session, "~/some_collection") # Same as above.
Methods
__init__(session, *args)Initialize IrodsPath object similar to the Path object.
absolute()Return the absolute path.
Check if the path points to an iRODS collection.
Create a collection and all parent collections that do not exist yet.
Check if the path points to an iRODS data object.
exists()Check if the path already exists on the iRODS server.
joinpath(*args)Concatenate another path to this one.
open([mode])Open a data object for reading or writing.
relative_to(other)Calculate the relative path compared to our path.
remove()Remove the data behind an iRODS path.
rename(new_name)Change the name or the path of a data object or collection.
walk([depth, include_base_collection])Walk on a collection.
Attributes
Checksum of the data object.
Instantiate an iRODS collection.
Instantiate an iRODS data object.
Metadata linked to the dataobject or collection.
Return the name of the data object or collection.
Return the parent directory of the current directory.
Collect the sizes of a data object or a collection.