tools: Remove hashes from metadata.
- Hashes aren't strictly metadata. - Which types of hashes are popular? - Hashes are expensive to calculate.
This commit is contained in:
parent
be489b0628
commit
d62010a1e0
2 changed files with 1 additions and 9 deletions
|
|
@ -187,7 +187,7 @@ def _pretty_bytes(bytes):
|
||||||
return f"{conversion} {units[unit_index]}"
|
return f"{conversion} {units[unit_index]}"
|
||||||
|
|
||||||
|
|
||||||
@deps(deps={"file", "coreutils"}, executables={"file", "sha1sum", "md5sum"})
|
@deps(deps={"file", "coreutils"}, executables={"file"})
|
||||||
def metadata(path):
|
def metadata(path):
|
||||||
|
|
||||||
def detail(value, unit):
|
def detail(value, unit):
|
||||||
|
|
@ -213,10 +213,6 @@ def metadata(path):
|
||||||
stdout, *rest = _do_command(
|
stdout, *rest = _do_command(
|
||||||
["file", "--dereference", "--brief", "--uncompress", path])
|
["file", "--dereference", "--brief", "--uncompress", path])
|
||||||
file_type = stdout
|
file_type = stdout
|
||||||
stdout, *rest = _do_command(["md5sum", path])
|
|
||||||
md5sum = stdout.split()[0]
|
|
||||||
stdout, *rest = _do_command(["sha1sum", path])
|
|
||||||
sha1sum = stdout.split()[0]
|
|
||||||
permissions_value = [permissions,
|
permissions_value = [permissions,
|
||||||
detail(_permissions_in_octal(permissions), None)]
|
detail(_permissions_in_octal(permissions), None)]
|
||||||
text = []
|
text = []
|
||||||
|
|
@ -226,7 +222,6 @@ def metadata(path):
|
||||||
("access time", access), None,
|
("access time", access), None,
|
||||||
("owner", owner), ("group", group), None,
|
("owner", owner), ("group", group), None,
|
||||||
("hardlinks", hardlinks), ("symlink", is_symlink), None,
|
("hardlinks", hardlinks), ("symlink", is_symlink), None,
|
||||||
("md5", md5sum), ("sha1", sha1sum), None,
|
|
||||||
("mime type", mime_type.strip()),
|
("mime type", mime_type.strip()),
|
||||||
("file type", file_type.strip())]:
|
("file type", file_type.strip())]:
|
||||||
if line is None:
|
if line is None:
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,5 @@
|
||||||
(B[m[38;2;0;135;189m[48;2;0;0;0mhardlinks:(B[m[38;2;255;255;255m[48;2;0;0;0m 2
|
(B[m[38;2;0;135;189m[48;2;0;0;0mhardlinks:(B[m[38;2;255;255;255m[48;2;0;0;0m 2
|
||||||
(B[m[38;2;0;135;189m[48;2;0;0;0msymlink:(B[m[38;2;255;255;255m[48;2;0;0;0m no
|
(B[m[38;2;0;135;189m[48;2;0;0;0msymlink:(B[m[38;2;255;255;255m[48;2;0;0;0m no
|
||||||
|
|
||||||
(B[m[38;2;0;135;189m[48;2;0;0;0mmd5:(B[m[38;2;255;255;255m[48;2;0;0;0m 28ca2e417cb64ea4e555efe3203642de
|
|
||||||
(B[m[38;2;0;135;189m[48;2;0;0;0msha1:(B[m[38;2;255;255;255m[48;2;0;0;0m 8b8c0214f3f0a0d79032d1b44550064964a33a26
|
|
||||||
|
|
||||||
(B[m[38;2;0;135;189m[48;2;0;0;0mmime type:(B[m[38;2;255;255;255m[48;2;0;0;0m text/x-python; charset=us-ascii
|
(B[m[38;2;0;135;189m[48;2;0;0;0mmime type:(B[m[38;2;255;255;255m[48;2;0;0;0m text/x-python; charset=us-ascii
|
||||||
(B[m[38;2;0;135;189m[48;2;0;0;0mfile type:(B[m[38;2;255;255;255m[48;2;0;0;0m Python script, ASCII text executable (B[m
|
(B[m[38;2;0;135;189m[48;2;0;0;0mfile type:(B[m[38;2;255;255;255m[48;2;0;0;0m Python script, ASCII text executable (B[m
|
||||||
Loading…
Add table
Add a link
Reference in a new issue