Quick heuristic: check if file appears to be binary.
(path: Path)
| 392 | |
| 393 | |
| 394 | def _is_binary(path: Path) -> bool: |
| 395 | """Quick heuristic: check if file appears to be binary.""" |
| 396 | try: |
| 397 | chunk = path.read_bytes()[:8192] |
| 398 | return b"\x00" in chunk |
| 399 | except (OSError, PermissionError): |
| 400 | return True |
| 401 | |
| 402 | |
| 403 | _GIT_TIMEOUT = int(os.environ.get("CRG_GIT_TIMEOUT", "30")) # seconds, configurable |
no outgoing calls