From 381da4974711c2b437144a2d648e06e2695b6eb2 Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Wed, 15 Apr 2026 21:37:22 -0400 Subject: [PATCH] fix: add python3 shebang to bin/glitch_patterns.py (#681) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bin/glitch_patterns.py: Added #!/usr/bin/env python3 as first line (was the only file from the issue list missing a shebang) Other files listed in #681 already have shebangs: bin/nostr-agent-demo.py ✓ bin/soul_eval_gate.py ✓ scripts/captcha_bypass_handler.py ✓ scripts/diagram_meaning_extractor.py ✓ scripts/visual_pr_reviewer.py ✓ tests/test_shebangs.py: 2 tests + 17 subtests Verifies all issue-listed files have shebangs Verifies all bin/*.py files have shebangs --- bin/glitch_patterns.py | 1 + tests/test_shebangs.py | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/test_shebangs.py diff --git a/bin/glitch_patterns.py b/bin/glitch_patterns.py index 5d699aad..b31045bd 100644 --- a/bin/glitch_patterns.py +++ b/bin/glitch_patterns.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """ Glitch pattern definitions for 3D world anomaly detection. diff --git a/tests/test_shebangs.py b/tests/test_shebangs.py new file mode 100644 index 00000000..583f4a34 --- /dev/null +++ b/tests/test_shebangs.py @@ -0,0 +1,53 @@ +""" +Tests for #681 — Python scripts have shebangs. +""" + +import os +import unittest +from pathlib import Path + +REPO_ROOT = Path(__file__).parent.parent + +# Files mentioned in issue #681 +ISSUE_FILES = [ + "bin/glitch_patterns.py", + "bin/nostr-agent-demo.py", + "bin/soul_eval_gate.py", + "scripts/captcha_bypass_handler.py", + "scripts/diagram_meaning_extractor.py", + "scripts/visual_pr_reviewer.py", +] + + +class TestShebangs(unittest.TestCase): + def test_all_issue_files_have_shebangs(self): + """All files listed in #681 have #!/usr/bin/env python3 shebang.""" + for relpath in ISSUE_FILES: + filepath = REPO_ROOT / relpath + with self.subTest(file=relpath): + self.assertTrue(filepath.exists(), f"{relpath} not found") + with open(filepath) as f: + first_line = f.readline().strip() + self.assertEqual( + first_line, "#!/usr/bin/env python3", + f"{relpath} missing shebang, first line: {first_line}" + ) + + def test_bin_scripts_have_shebangs(self): + """All .py files in bin/ have shebangs.""" + bin_dir = REPO_ROOT / "bin" + if not bin_dir.exists(): + self.skipTest("bin/ not found") + + for filepath in bin_dir.glob("*.py"): + with self.subTest(file=filepath.name): + with open(filepath) as f: + first_line = f.readline().strip() + self.assertTrue( + first_line.startswith("#!"), + f"bin/{filepath.name} missing shebang" + ) + + +if __name__ == "__main__": + unittest.main()