virtual_path.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. from pathlib import Path
  2. from dataclasses import dataclass
  3. from os import stat_result
  4. @dataclass
  5. class VirtualStats:
  6. st_mode: int
  7. st_ino: int
  8. st_dev: int
  9. st_nlink: int
  10. st_uid: int
  11. st_gid: int
  12. st_size: int
  13. st_atime: float
  14. st_mtime: float
  15. st_ctime: float
  16. @dataclass
  17. class VirtualPathEntry:
  18. is_dir: bool
  19. is_file: bool
  20. stat: stat_result
  21. class VirtualPath(Path):
  22. def cwd(self):
  23. pass
  24. def exists(self):
  25. pass
  26. def glob(self):
  27. pass
  28. def is_dir(self):
  29. pass
  30. def is_file(self):
  31. pass
  32. def iterdir(self):
  33. pass
  34. def lstat(self):
  35. return self.stat()
  36. def open(self):
  37. pass
  38. def stat(self):
  39. pass
  40. # ['__bytes__', '__class__', '__class_getitem__', '__delattr__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__',
  41. # '__fspath__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__',
  42. # '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rtruediv__', '__setattr__', '__sizeof__', '__slots__', '__str__',
  43. # '__subclasshook__', '__truediv__',
  44. # '_accessor', '_cached_cparts', '_cparts', '_drv', '_format_parsed_parts', '_from_parsed_parts', '_from_parts', '_hash', '_init',
  45. # '_make_child', '_make_child_relpath', '_opener', '_parse_args', '_parts', '_pparts', '_raw_open', '_root', '_str', 'absolute',
  46. # 'anchor', 'as_posix', 'as_uri', 'chmod', 'cwd', 'drive', 'exists', 'expanduser', 'glob', 'group', 'home', 'is_absolute',
  47. # 'is_block_device', 'is_char_device', 'is_dir', 'is_fifo', 'is_file', 'is_mount', 'is_relative_to', 'is_reserved', 'is_socket',
  48. # 'is_symlink', 'iterdir', 'joinpath', 'lchmod', 'link_to', 'lstat', 'match', 'mkdir', 'name', 'open', 'owner', 'parent', 'parents',
  49. # 'parts', 'read_bytes', 'read_text', 'readlink', 'relative_to', 'rename', 'replace', 'resolve', 'rglob', 'rmdir', 'root', 'samefile',
  50. # 'stat', 'stem', 'suffix', 'suffixes', 'symlink_to', 'touch', 'unlink', 'with_name', 'with_stem', 'with_suffix', 'write_bytes',
  51. # 'write_text']