chore: remove dead code from src/utils/imghdr_stub.py

Removed the `test()` and `testall()` functions and the `if __name__ == "__main__":` block which were used for manual testing and are not needed by the codebase.
This improves maintainability and readability by focusing the module on its core functionality.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-16 16:42:01 +00:00
1 parent 8436311fa3
commit cc42e7d6f0
1 file changed
-50
-50
View File
@@ -168,53 +168,3 @@ def test_exr(h, f):
tests.append(test_exr)
# --------------------
# Small test program
# --------------------
def test(): # pragma: no cover - only used for manual testing
import sys
recursive = 0
if sys.argv[1:] and sys.argv[1] == "-r":
del sys.argv[1:2]
recursive = 1
try:
if sys.argv[1:]:
testall(sys.argv[1:], recursive, 1)
else:
testall(["."], recursive, 1)
except KeyboardInterrupt:
sys.stderr.write("\n[Interrupted]\n")
sys.exit(1)
def testall(list, recursive, toplevel): # pragma: no cover - only for manual use
import sys
import os
for filename in list:
if os.path.isdir(filename):
print(filename + "/:", end=" ")
if recursive or toplevel:
print("recursing down:")
import glob
names = glob.glob(os.path.join(glob.escape(filename), "*"))
testall(names, recursive, 0)
else:
print("*** directory (use -r) ***")
else:
print(filename + ":", end=" ")
sys.stdout.flush()
try:
print(what(filename))
except OSError:
print("*** not found ***")
if __name__ == "__main__": # pragma: no cover - manual run
test()