stdlib/os: Provide namedtuple response for os.stat().

pull/719/head
Andrew Leech 2023-08-21 12:13:56 +09:30
rodzic 82501d721f
commit aac74a8b0a
1 zmienionych plików z 26 dodań i 0 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
# Include built-in os module.
import sys
__path = sys.path
try:
sys.path.clear()
@ -12,3 +13,28 @@ try:
from . import path
except ImportError:
pass
from collections import namedtuple
# https://docs.python.org/3/library/os.html#os.stat_result
stat_result = namedtuple(
"stat_result",
(
"st_mode",
"st_ino",
"st_dev",
"st_nlink",
"st_uid",
"st_gid",
"st_size",
"st_atime",
"st_mtime",
"st_ctime",
),
)
__os_stat = stat
def stat(path):
return stat_result(*__os_stat(path))