1+ # MatrixOS Python Interface - File System (Vanilla Python API)
2+ # Pythonic file system operations with automatic sandboxing
3+
4+ from typing import List, Optional, Union
5+ from MatrixOS_FileMode import FileMode, SeekMode
6+
7+ # Vanilla Python-style file operations
8+ def open(file: str, mode: str = "r", buffering: int = -1, encoding: Optional[str] = None) -> "FileObject": ...
9+ def listdir(path: str = ".") -> List[str]: ...
10+ def mkdir(path: str, mode: int = 0o777) -> None: ...
11+ def makedirs(path: str, mode: int = 0o777, exist_ok: bool = False) -> None: ...
12+ def remove(path: str) -> None: ...
13+ def rmdir(path: str) -> None: ...
14+ def rename(src: str, dst: str) -> None: ...
15+ def getcwd() -> str: ...
16+ def chdir(path: str) -> None: ...
17+
18+ # Path operations
19+ class path:
20+ def exists(path: str) -> bool: ...
21+ def isfile(path: str) -> bool: ...
22+ def isdir(path: str) -> bool: ...
23+ def getsize(path: str) -> int: ...
24+ def join(*paths: str) -> str: ...
25+ def dirname(path: str) -> str: ...
26+ def basename(path: str) -> str: ...
27+ def splitext(path: str) -> tuple: ...
28+
29+ # File object class (similar to Python's built-in file object)
30+ class FileObject:
31+ def __init__(self, path: str, mode: str): ...
32+ def __del__(self): ...
33+ def __enter__(self) -> FileObject: ...
34+ def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
35+
36+ def read(self, size: int = -1) -> Union[str, bytes]: ...
37+ def readline(self, size: int = -1) -> Union[str, bytes]: ...
38+ def readlines(self, hint: int = -1) -> List[Union[str, bytes]]: ...
39+ def write(self, data: Union[str, bytes]) -> int: ...
40+ def writelines(self, lines: List[Union[str, bytes]]) -> None: ...
41+ def seek(self, offset: int, whence: int = 0) -> int: ...
42+ def tell() -> int: ...
43+ def flush() -> None: ...
44+ def close() -> None: ...
45+ def closed() -> bool: ...
46+ def readable() -> bool: ...
47+ def writable() -> bool: ...
48+ def seekable() -> bool: ...
0 commit comments