Filesystem metadata for the requested path, or a filesystem error if the stat failed.
| 18551 | # Experimental: this type is part of an experimental API and may change or be removed. |
| 18552 | @dataclass |
| 18553 | class SessionFSStatResult: |
| 18554 | """Filesystem metadata for the requested path, or a filesystem error if the stat failed.""" |
| 18555 | |
| 18556 | birthtime: datetime |
| 18557 | """ISO 8601 timestamp of creation""" |
| 18558 | |
| 18559 | is_directory: bool |
| 18560 | """Whether the path is a directory""" |
| 18561 | |
| 18562 | is_file: bool |
| 18563 | """Whether the path is a file""" |
| 18564 | |
| 18565 | mtime: datetime |
| 18566 | """ISO 8601 timestamp of last modification""" |
| 18567 | |
| 18568 | size: int |
| 18569 | """File size in bytes""" |
| 18570 | |
| 18571 | error: SessionFSError | None = None |
| 18572 | """Describes a filesystem error.""" |
| 18573 | |
| 18574 | @staticmethod |
| 18575 | def from_dict(obj: Any) -> 'SessionFSStatResult': |
| 18576 | assert isinstance(obj, dict) |
| 18577 | birthtime = from_datetime(obj.get("birthtime")) |
| 18578 | is_directory = from_bool(obj.get("isDirectory")) |
| 18579 | is_file = from_bool(obj.get("isFile")) |
| 18580 | mtime = from_datetime(obj.get("mtime")) |
| 18581 | size = from_int(obj.get("size")) |
| 18582 | error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) |
| 18583 | return SessionFSStatResult(birthtime, is_directory, is_file, mtime, size, error) |
| 18584 | |
| 18585 | def to_dict(self) -> dict: |
| 18586 | result: dict = {} |
| 18587 | result["birthtime"] = self.birthtime.isoformat() |
| 18588 | result["isDirectory"] = from_bool(self.is_directory) |
| 18589 | result["isFile"] = from_bool(self.is_file) |
| 18590 | result["mtime"] = self.mtime.isoformat() |
| 18591 | result["size"] = from_int(self.size) |
| 18592 | if self.error is not None: |
| 18593 | result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) |
| 18594 | return result |
| 18595 | |
| 18596 | # Experimental: this type is part of an experimental API and may change or be removed. |
| 18597 | @dataclass |