1
0
Fork 0

Adding upstream version 2.6.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 05:39:09 +01:00
parent a520648c14
commit 6ecf5d143c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
5 changed files with 16 additions and 13 deletions

View file

@ -14,7 +14,7 @@ repos:
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
rev: v3.13.0
hooks:
- id: reorder-python-imports
args: [--py38-plus, --add-import, 'from __future__ import annotations']
@ -23,20 +23,20 @@ repos:
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/hhatto/autopep8
rev: v2.1.0
rev: v2.3.1
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.0
hooks:
- id: flake8
exclude: ^identify/vendor/licenses\.py$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.10.1
hooks:
- id: mypy

View file

@ -56,6 +56,7 @@ EXTENSIONS = {
'ear': {'binary', 'zip', 'jar'},
'edn': {'text', 'clojure', 'edn'},
'ejs': {'text', 'ejs'},
'ejson': {'text', 'json', 'ejson'},
'env': {'text', 'dotenv'},
'eot': {'binary', 'eot'},
'eps': {'binary', 'eps'},

View file

@ -191,14 +191,14 @@ def parse_shebang(bytesio: IO[bytes]) -> tuple[str, ...]:
return ()
cmd = tuple(_shebang_split(first_line.strip()))
if cmd and cmd[0] == '/usr/bin/env':
if cmd[1] == '-S':
cmd = cmd[2:]
else:
cmd = cmd[1:]
if cmd[:2] == ('/usr/bin/env', '-S'):
cmd = cmd[2:]
elif cmd[:1] == ('/usr/bin/env',):
cmd = cmd[1:]
if cmd == ('nix-shell',):
return _parse_nix_shebang(bytesio, cmd)
if cmd == ('nix-shell',):
return _parse_nix_shebang(bytesio, cmd)
return cmd

View file

@ -1,6 +1,6 @@
[metadata]
name = identify
version = 2.5.36
version = 2.6.0
description = File identification library for Python
long_description = file: README.md
long_description_content_type = text/markdown

View file

@ -325,6 +325,8 @@ def test_file_is_text_does_not_exist(tmpdir):
(b'#!\x00\x00\x00\x00', ()),
# shebang lines with multiple arguments
(b'#!/usr/bin/env -S python -u', ('python', '-u')),
(b'#!/usr/bin/env', ()),
(b'#!/usr/bin/env -S', ()),
),
)
def test_parse_shebang(s, expected):