src/pylib/Lib/os_impl/posix_like/stat

Source   Edit  

Types

stat_result = ref object
  data*: Stat                ## inner, used by `getattr` of `stat_result`
  
Source   Edit  

Procs

func `[]`(self: stat_result; i: int): BiggestInt {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
func st_atime(self`gensym0: stat_result): float {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
func st_atime_ns(self`gensym0: stat_result): BiggestInt {....raises: [], tags: [],
    forbids: [].}
Admonition: since Python 3.3
Source   Edit  
func st_ctime(self`gensym2: stat_result): float {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
func st_ctime_ns(self`gensym2: stat_result): BiggestInt {....raises: [], tags: [],
    forbids: [].}
Admonition: since Python 3.3
Source   Edit  
func st_mtime(self`gensym1: stat_result): float {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
func st_mtime_ns(self`gensym1: stat_result): BiggestInt {....raises: [], tags: [],
    forbids: [].}
Admonition: since Python 3.3
Source   Edit  
proc stat(path: int): stat_result {....raises: [OSError], tags: [], forbids: [].}
Source   Edit  
proc stat[T](path: PathLike[T]): stat_result
Warning: Under Windows, it's just a wrapper over _wstat, so this differs from Python's os.stat either in prototype (the follow_symlinks param is not supported) and some items of result. For details, see https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions

Example:

let s = stat(".")
when defined(windows):
  # _stat's result: st_gid, st_uid is always zero.
  template zero(x) = assert x.int == 0
  zero s.st_gid
  zero s.st_uid
Source   Edit  

Templates

template `.`(self: stat_result; attr): untyped
as Python's __getattr__ Source   Edit  
template statAttr(path: PathLike | int; attr: untyped): untyped
stat(path).attr Source   Edit