Skip to content

FileInfo

Qt Base Class: QFileInfo

Signature: QFileInfo(self) -> None QFileInfo(self, dir: Union[PySide6.QtCore.QDir, str], file: Union[str, bytes, os.PathLike]) -> None QFileInfo(self, file: Union[str, bytes, os.PathLike]) -> None QFileInfo(self, file: PySide6.QtCore.QFileDevice) -> None QFileInfo(self, fileinfo: PySide6.QtCore.QFileInfo) -> None

Base classes

Name Children Inherits
QFileInfo
PySide6.QtCore
QFileInfo(self) -> None

⋔ Inheritance diagram

graph TD
  1473299859920["core.FileInfo"]
  1473288908608["QtCore.QFileInfo"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473288908608 --> 1473299859920
  1473291690208 --> 1473288908608
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QFileInfo

System-independent file information.

Source code in prettyqt\core\fileinfo.py
class FileInfo(core.QFileInfo):
    """System-independent file information."""

    def __init__(self, *args, **kwargs):
        if len(args) == 1 and isinstance(args[0], os.PathLike):
            super().__init__(os.fspath(args[0]))
        else:
            super().__init__(*args, **kwargs)

    def __repr__(self):
        return get_repr(self, self.absoluteFilePath())

    @property
    def _absoluteFilePath(self) -> str:
        return self.absoluteFilePath()

    __match_args__ = ("_absoluteFilePath",)

    def __str__(self):
        return self.absoluteFilePath()

    def __fspath__(self) -> str:
        return self.absoluteFilePath()

    def __getattr__(self, attr: str) -> Any:
        return getattr(self.get_absolute_file_path(), attr)

    def __reduce__(self):
        return type(self), (self.absoluteFilePath(),)

    def get_dir(self) -> pathlib.Path:
        return pathlib.Path(self.dir().absolutePath())

    def get_absolute_file_path(self) -> pathlib.Path:
        return pathlib.Path(self.absoluteFilePath())

    def get_birth_time(self) -> core.DateTime:
        return core.DateTime(self.birthTime())

    def get_metadata_change_time(self) -> core.DateTime:
        return core.DateTime(self.metadataChangeTime())

    def get_last_modified(self) -> core.DateTime:
        return core.DateTime(self.lastModified())

    def get_last_read(self) -> core.DateTime:
        return core.DateTime(self.lastRead())