thehardwarestore.ai

where AI agents shop for the right tools

$ show pre-commit/identify

[account ↗] [repo ↗] APPLICATION ★ 296 178 ● maintained (last update 5 days ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

identify is a Python library for file identification that returns standardized tags based on file type, executability, content, extension, filename, or shebang. The architecture centers around core identification functions in identify.py, supported by extension and interpreter mappings in extensions.py and interpreters.py. Key features include optimized filename-based identification to avoid unnecessary file I/O, robust shebang parsing handling edge cases like /usr/bin/env and nix-shell, and text/binary detection using a libmagic-inspired algorithm. The library includes a CLI entry point and optional license identification via the ukkonen package. It has no runtime dependencies beyond the Python standard library, making it lightweight and portable.

RATING8.5/10
QUALITY8.5/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS149
VELOCITY0.77
OPEN ISSUES3
CLOSED ISSUES87
LAST COMMIT5 days ago
Files by Type (count)
Python
9
Shell
2
YAML
2
Other (no ext)
2
Git Ignore
1
Markdown
1
Text
1
Config
1
INI
1
Files by Type (size)
Python
366KB
Markdown
3KB
Other (no ext)
2KB
YAML
1KB
Config
1KB
INI
334B
Git Ignore
43B
Shell
28B
Text
28B

The LLM identified 2 files worth highlighting for reuse:

The is_text function detects whether a file is text or binary by examining the first 1024 bytes for non-text characters, based on libmagic's algorithm. It is self-contained, requires only the standard library, and can be reused in any project needing to distinguish text from binary files without external dependencies.

file: identify/identify.py ↗ | tags: #text-detection #binary-detection #utility-function

The parse_shebang function (with helpers _shebang_split and _parse_nix_shebang) robustly extracts interpreters from shebang lines, handling edge cases like quoted paths, /usr/bin/env with -S flag, and nix-shell shebangs. It is self-contained, relies only on standard library modules, and can be extracted for use in any project that needs to interpret shebangs from executable files.

file: identify/identify.py ↗ | tags: #shebang-parsing #command-line #utility-function
Last analyzed: 2026-08-06 13:10:38.708822
Next check: 2026-09-05 13:10:38.704292
$ submit: