Commit f61f42ca authored by Xavier Thompson's avatar Xavier Thompson

More elegant attribute access.

See merge request !1
parents a51d0e87 efac620b
...@@ -38,22 +38,22 @@ def compute_hashes(entry_path): ...@@ -38,22 +38,22 @@ def compute_hashes(entry_path):
def stat_result_to_dict(stat_result): def stat_result_to_dict(stat_result):
return { return {
"st_mode": stat_result.st_mode if hasattr(stat_result, "st_mode") else None, "st_mode": getattr(stat_result, "st_mode", None),
"st_ino": stat_result.st_ino if hasattr(stat_result, "st_ino") else None, "st_ino": getattr(stat_result, "st_ino", None),
"st_dev": stat_result.st_dev if hasattr(stat_result, "st_dev") else None, "st_dev": getattr(stat_result, "st_dev", None),
"st_nlink": stat_result.st_nlink if hasattr(stat_result, "st_nlink") else None, "st_nlink": getattr(stat_result, "st_nlink", None),
"st_uid": stat_result.st_uid if hasattr(stat_result, "st_uid") else None, "st_uid": getattr(stat_result, "st_uid", None),
"st_gid": stat_result.st_gid if hasattr(stat_result, "st_gid") else None, "st_gid": getattr(stat_result, "st_gid", None),
"st_size": stat_result.st_size if hasattr(stat_result, "st_size") else None, "st_size": getattr(stat_result, "st_size", None),
"st_atime": stat_result.st_atime if hasattr(stat_result, "st_atime") else None, "st_atime": getattr(stat_result, "st_atime", None),
"st_mtime": stat_result.st_mtime if hasattr(stat_result, "st_mtime") else None, "st_mtime": getattr(stat_result, "st_mtime", None),
"st_ctime": stat_result.st_ctime if hasattr(stat_result, "st_ctime") else None, "st_ctime": getattr(stat_result, "st_ctime", None),
"st_blocks": stat_result.st_blocks if hasattr(stat_result, "st_blocks") else None, "st_blocks": getattr(stat_result, "st_blocks", None),
"st_blksize": stat_result.st_blksize if hasattr(stat_result, "st_blksize") else None, "st_blksize": getattr(stat_result, "st_blksize", None),
"st_rdev": stat_result.st_rdev if hasattr(stat_result, "st_rdev") else None, "st_rdev": getattr(stat_result, "st_rdev", None),
"st_flags": stat_result.st_flags if hasattr(stat_result, "st_flags") else None, "st_flags": getattr(stat_result, "st_flags", None),
"st_gen": stat_result.st_gen if hasattr(stat_result, "st_gen") else None, "st_gen": getattr(stat_result, "st_gen", None),
"st_birthtime": stat_result.st_birthtime if hasattr(stat_result, "st_birthtime") else None, "st_birthtime": getattr(stat_result, "st_birthtime", None),
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment