Bases: str

A File path string representing the path to a file within a resource. :param value: the string path value :param file_url: the fully qualified url to the file on hydroshare.org :param checksum: the md5 checksum of the file

Source code in hsclient\hydroshare.py
class File(str):
    """
    A File path string representing the path to a file within a resource.
    :param value: the string path value
    :param file_url: the fully qualified url to the file on hydroshare.org
    :param checksum: the md5 checksum of the file
    """

    def __new__(cls, value, file_url, checksum):
        return super(File, cls).__new__(cls, value)

    def __init__(self, value, file_url, checksum):
        self._file_url = file_url
        self._checksum = checksum

    @property
    def path(self) -> str:
        """The path of the file"""
        return self

    @property
    def name(self) -> str:
        """The filename"""
        return basename(self)

    @property
    def extension(self) -> str:
        """The extension of the file"""
        return splitext(self.name)[1]

    @property
    def folder(self) -> str:
        """The folder the file is in"""
        return dirname(self)

    @property
    def checksum(self):
        """The md5 checksum of the file"""
        return self._checksum

    @property
    def url(self):
        """The url to the file on HydroShare"""
        return self._file_url

checksum property

The md5 checksum of the file

extension: str property

The extension of the file

folder: str property

The folder the file is in

name: str property

The filename

path: str property

The path of the file

url property

The url to the file on HydroShare