mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 02:39:20 +00:00
feat: add module stat
This commit is contained in:
parent
9025fe7e99
commit
50136ef6ae
3 changed files with 120 additions and 1 deletions
|
@ -8,6 +8,7 @@ The name of the operating system dependent module imported. The following names
|
|||
.name: Str
|
||||
|
||||
.chdir!: (path: PathLike, ) => NoneType
|
||||
.chmod!: (path: PathLike, mode: Nat) => NoneType
|
||||
.getcwd!: () => Str
|
||||
.getenv!: (key: Str, default: Str or NoneType := NoneType) => Str
|
||||
.listdir!: (path := PathLike,) => [Str; _]
|
||||
|
|
|
@ -1,7 +1,37 @@
|
|||
.PurePath: ClassType
|
||||
.PurePath.parts: [Str; _]
|
||||
.PurePath.
|
||||
parts: [Str; _]
|
||||
drive: Str
|
||||
root: Str
|
||||
anchor: Str
|
||||
parents: [.PurePath; _]
|
||||
parent: .PurePath
|
||||
name: Str
|
||||
suffix: Str
|
||||
suffixes: [Str; _]
|
||||
stem: Str
|
||||
__call__: (*segments: Str) -> .PurePath
|
||||
as_posix: (self: .PurePath) -> Str
|
||||
as_uri: (self: .PurePath) -> Str
|
||||
is_absolute: (self: .PurePath) -> Bool
|
||||
is_relative_to: (self: .PurePath, *other: .PurePath) -> Bool
|
||||
is_reserved: (self: .PurePath) -> Bool
|
||||
joinpath: (self: .PurePath, *other: .PurePath) -> .PurePath
|
||||
match: (self: .PurePath, pattern: Str) -> Bool
|
||||
relative_to: (self: .PurePath, *other: .PurePath) -> .PurePath
|
||||
with_name: (self: .PurePath, name: Str) -> .PurePath
|
||||
with_stem: (self: .PurePath, suffix: Str) -> .PurePath
|
||||
with_suffix: (self: .PurePath, suffix: Str) -> .PurePath
|
||||
.PurePosixPath: ClassType
|
||||
.PureWindowsPath: ClassType
|
||||
.Path: ClassType
|
||||
.Path <: .PurePath
|
||||
.Path.
|
||||
__call__: (*segments: Str) -> .Path
|
||||
cwd!: () => .Path
|
||||
home!: () => .Path
|
||||
samefile!: (self: .Path, other: .Path) => Bool
|
||||
open!: (self: .Path, mode := Str) => File!
|
||||
chmod!: (self: .Path, mode: Nat) => NoneType
|
||||
.PosixPath: ClassType
|
||||
.WindowsPath: ClassType
|
||||
|
|
88
crates/erg_compiler/lib/pystd/stat.d.er
Normal file
88
crates/erg_compiler/lib/pystd/stat.d.er
Normal file
|
@ -0,0 +1,88 @@
|
|||
.ST_MMODE: {0}
|
||||
.ST_INO: {1}
|
||||
.ST_DEV: {2}
|
||||
.ST_NLINK: {3}
|
||||
.ST_UID: {4}
|
||||
.ST_GID: {5}
|
||||
.ST_SIZE: {6}
|
||||
.ST_ATIME: {7}
|
||||
.ST_MTIME: {8}
|
||||
.ST_CTIME: {9}
|
||||
|
||||
.S_IMODE: (mode: Nat) -> Nat
|
||||
.S_IFMT: (mode: Nat) -> Nat
|
||||
|
||||
.S_IFDIR: {0o04000}
|
||||
.S_IFCHR: {0o02000}
|
||||
.S_IFBLK: {0o06000}
|
||||
.S_IFREG: {0o10000}
|
||||
.S_IFIFO: {0o01000}
|
||||
.S_IFLNK: {0o12000}
|
||||
.S_IFSOCK: {0o14000}
|
||||
.S_IFDOOR: {0}
|
||||
.S_IFPORT: {0}
|
||||
.S_IFWHT: {0}
|
||||
|
||||
.S_ISDIR: (mode: Nat) -> Bool
|
||||
.S_ISCHR: (mode: Nat) -> Bool
|
||||
.S_ISBLK: (mode: Nat) -> Bool
|
||||
.S_ISREG: (mode: Nat) -> Bool
|
||||
.S_ISFIFO: (mode: Nat) -> Bool
|
||||
.S_ISLNK: (mode: Nat) -> Bool
|
||||
.S_ISSOCK: (mode: Nat) -> Bool
|
||||
.S_ISDOOR: (mode: Nat) -> Bool
|
||||
.S_ISPORT: (mode: Nat) -> Bool
|
||||
.S_ISWHT: (mode: Nat) -> Bool
|
||||
|
||||
.S_ISUID: {0o4000}
|
||||
.S_ISGID: {0o2000}
|
||||
.S_ENFMT: {0o2000}
|
||||
.S_ISVTX: {0o1000}
|
||||
.S_IREAD: {0o0400}
|
||||
.S_IWRITE: {0o0200}
|
||||
.S_IEXEC: {0o0100}
|
||||
.S_IRWXU: {0o0700}
|
||||
.S_IRUSR: {0o0400}
|
||||
.S_IWUSR: {0o0200}
|
||||
.S_IXUSR: {0o0100}
|
||||
.S_IRWXG: {0o0070}
|
||||
.S_IRGRP: {0o0040}
|
||||
.S_IWGRP: {0o0020}
|
||||
.S_IXGRP: {0o0010}
|
||||
.S_IRWXO: {0o0007}
|
||||
.S_IROTH: {0o0004}
|
||||
.S_IWOTH: {0o0002}
|
||||
.S_IXOTH: {0o0001}
|
||||
|
||||
.UF_NODUMP: {0x00000001}
|
||||
.UF_IMMUTABLE: {0x00000002}
|
||||
.UF_APPEND: {0x00000004}
|
||||
.UF_OPAQUE: {0x00000008}
|
||||
.UF_NOUNLINK: {0x00000010}
|
||||
.UF_COMPRESSED: {0x00000020}
|
||||
.UF_HIDDEN: {0x00008000}
|
||||
.SF_ARCHIVED: {0x00010000}
|
||||
.SF_IMMUTABLE: {0x00020000}
|
||||
.SF_APPEND: {0x00040000}
|
||||
.SF_NOUNLINK: {0x00100000}
|
||||
.SF_SNAPSHOT: {0x00200000}
|
||||
|
||||
.filemode: (mode: Nat) -> Str
|
||||
|
||||
.FILE_ATTRIBUTE_ARCHIVE: {32}
|
||||
.FILE_ATTRIBUTE_COMPRESSED: {2048}
|
||||
.FILE_ATTRIBUTE_DEVICE: {64}
|
||||
.FILE_ATTRIBUTE_DIRECTORY: {16}
|
||||
.FILE_ATTRIBUTE_ENCRYPTED: {16384}
|
||||
.FILE_ATTRIBUTE_HIDDEN: {2}
|
||||
.FILE_ATTRIBUTE_INTEGRITY_STREAM: {32768}
|
||||
.FILE_ATTRIBUTE_NORMAL: {128}
|
||||
.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: {8192}
|
||||
.FILE_ATTRIBUTE_NO_SCRUB_DATA: {131072}
|
||||
.FILE_ATTRIBUTE_OFFLINE: {4096}
|
||||
.FILE_ATTRIBUTE_READONLY: {1}
|
||||
.FILE_ATTRIBUTE_REPARSE_POINT: {1024}
|
||||
.FILE_ATTRIBUTE_SPARSE_FILE: {512}
|
||||
.FILE_ATTRIBUTE_SYSTEM: {4}
|
||||
.FILE_ATTRIBUTE_TEMPORARY: {256}
|
||||
.FILE_ATTRIBUTE_VIRTUAL: {65536}
|
Loading…
Add table
Add a link
Reference in a new issue