def _make_details_from_stat(cls, stat_result):
"""Make a *details* info dict from an `os.stat_result` object.
"""
details = {
'_write': ['accessed', 'modified'],
'accessed': stat_result.st_atime,
'modified': stat_result.st_mtime,
'size': stat_result.st_size,
'type': int(cls._get_type_from_stat(stat_result))
}
# On other Unix systems (such as FreeBSD), the following
# attributes may be available (but may be only filled out if
# root tries to use them):
details['created'] = getattr(stat_result, 'st_birthtime', None)
ctime_key = (
'created'
if _WINDOWS_PLATFORM
else 'metadata_changed'
)
details[ctime_key] = stat_result.st_ctime
return details
评论列表
文章目录