1
0
Fork 0

Merging upstream version 2.2.11.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-12 21:48:52 +01:00
parent 24dc002c39
commit edee030b21
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
5 changed files with 29 additions and 13 deletions

View file

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0 rev: v4.0.1
hooks: hooks:
- id: check-docstring-first - id: check-docstring-first
- id: check-yaml - id: check-yaml
@ -15,17 +15,17 @@ repos:
hooks: hooks:
- id: setup-cfg-fmt - id: setup-cfg-fmt
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.9.1 rev: 3.9.2
hooks: hooks:
- id: flake8 - id: flake8
exclude: ^identify/vendor/licenses\.py$ exclude: ^identify/vendor/licenses\.py$
additional_dependencies: [flake8-typing-imports==1.10.1] additional_dependencies: [flake8-typing-imports==1.10.1]
- repo: https://github.com/pre-commit/mirrors-autopep8 - repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.6 rev: v1.5.7
hooks: hooks:
- id: autopep8 - id: autopep8
- repo: https://github.com/asottile/reorder_python_imports - repo: https://github.com/asottile/reorder_python_imports
rev: v2.4.0 rev: v2.5.0
hooks: hooks:
- id: reorder-python-imports - id: reorder-python-imports
args: [--py3-plus] args: [--py3-plus]
@ -35,11 +35,11 @@ repos:
- id: add-trailing-comma - id: add-trailing-comma
args: [--py36-plus] args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.12.0 rev: v2.20.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py36-plus] args: [--py36-plus]
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812 rev: v0.910
hooks: hooks:
- id: mypy - id: mypy

View file

@ -33,11 +33,11 @@ def main() -> int:
_, data, license_text = contents.split('---\n', 2) _, data, license_text = contents.split('---\n', 2)
spdx, = [ spdx, = (
line[len('spdx-id:'):].strip() line[len('spdx-id:'):].strip()
for line in data.splitlines() for line in data.splitlines()
if line.startswith('spdx-id:') if line.startswith('spdx-id:')
] )
licenses.append((spdx, license_text)) licenses.append((spdx, license_text))

View file

@ -6,9 +6,11 @@ EXTENSIONS = {
'avif': {'binary', 'image', 'avif'}, 'avif': {'binary', 'image', 'avif'},
'bash': {'text', 'shell', 'bash'}, 'bash': {'text', 'shell', 'bash'},
'bat': {'text', 'batch'}, 'bat': {'text', 'batch'},
'bats': {'text', 'shell', 'bash', 'bats'},
'bib': {'text', 'bib'}, 'bib': {'text', 'bib'},
'bmp': {'binary', 'image', 'bitmap'}, 'bmp': {'binary', 'image', 'bitmap'},
'bz2': {'binary', 'bzip2'}, 'bz2': {'binary', 'bzip2'},
'bzl': {'text', 'bazel'},
'c': {'text', 'c'}, 'c': {'text', 'c'},
'cc': {'text', 'c++'}, 'cc': {'text', 'c++'},
'cfg': {'text'}, 'cfg': {'text'},
@ -78,7 +80,8 @@ EXTENSIONS = {
'jade': {'text', 'jade'}, 'jade': {'text', 'jade'},
'jar': {'binary', 'zip', 'jar'}, 'jar': {'binary', 'zip', 'jar'},
'java': {'text', 'java'}, 'java': {'text', 'java'},
'jenkinsfile': {'text', 'groovy'}, 'jenkins': {'text', 'groovy', 'jenkins'},
'jenkinsfile': {'text', 'groovy', 'jenkins'},
'jinja': {'text', 'jinja'}, 'jinja': {'text', 'jinja'},
'jinja2': {'text', 'jinja'}, 'jinja2': {'text', 'jinja'},
'jpeg': {'binary', 'image', 'jpeg'}, 'jpeg': {'binary', 'image', 'jpeg'},
@ -180,11 +183,13 @@ EXTENSIONS = {
'tiff': {'binary', 'image', 'tiff'}, 'tiff': {'binary', 'image', 'tiff'},
'toml': {'text', 'toml'}, 'toml': {'text', 'toml'},
'ts': {'text', 'ts'}, 'ts': {'text', 'ts'},
'tsv': {'text', 'tsv'},
'tsx': {'text', 'tsx'}, 'tsx': {'text', 'tsx'},
'ttf': {'binary', 'ttf'}, 'ttf': {'binary', 'ttf'},
'twig': {'text', 'twig'}, 'twig': {'text', 'twig'},
'txsprofile': {'text', 'ini', 'txsprofile'}, 'txsprofile': {'text', 'ini', 'txsprofile'},
'txt': {'text', 'plain-text'}, 'txt': {'text', 'plain-text'},
'urdf': {'text', 'xml', 'urdf'},
'v': {'text', 'verilog'}, 'v': {'text', 'verilog'},
'vb': {'text', 'vb'}, 'vb': {'text', 'vb'},
'vbproj': {'text', 'xml', 'vbproj'}, 'vbproj': {'text', 'xml', 'vbproj'},
@ -216,8 +221,10 @@ EXTENSIONS = {
'yang': {'text', 'yang'}, 'yang': {'text', 'yang'},
'yin': {'text', 'xml', 'yin'}, 'yin': {'text', 'xml', 'yin'},
'yml': {'text', 'yaml'}, 'yml': {'text', 'yaml'},
'zcml': {'text', 'xml', 'zcml'},
'zig': {'text', 'zig'}, 'zig': {'text', 'zig'},
'zip': {'binary', 'zip'}, 'zip': {'binary', 'zip'},
'zpt': {'text', 'zpt'},
'zsh': {'text', 'shell', 'zsh'}, 'zsh': {'text', 'shell', 'zsh'},
} }
EXTENSIONS_NEED_BINARY_CHECK = { EXTENSIONS_NEED_BINARY_CHECK = {
@ -261,8 +268,8 @@ NAMES = {
'.zshrc': EXTENSIONS['zsh'], '.zshrc': EXTENSIONS['zsh'],
'.zshenv': EXTENSIONS['zsh'], '.zshenv': EXTENSIONS['zsh'],
'AUTHORS': EXTENSIONS['txt'], 'AUTHORS': EXTENSIONS['txt'],
'BUILD': {'text', 'bazel'}, 'BUILD': EXTENSIONS['bzl'],
'BUILD.bazel': {'text', 'bazel'}, 'BUILD.bazel': EXTENSIONS['bzl'],
'CMakeLists.txt': EXTENSIONS['cmake'], 'CMakeLists.txt': EXTENSIONS['cmake'],
'CHANGELOG': EXTENSIONS['txt'], 'CHANGELOG': EXTENSIONS['txt'],
'CONTRIBUTING': EXTENSIONS['txt'], 'CONTRIBUTING': EXTENSIONS['txt'],
@ -270,10 +277,12 @@ NAMES = {
'Dockerfile': {'text', 'dockerfile'}, 'Dockerfile': {'text', 'dockerfile'},
'Gemfile': EXTENSIONS['rb'], 'Gemfile': EXTENSIONS['rb'],
'Gemfile.lock': {'text'}, 'Gemfile.lock': {'text'},
'Jenkinsfile': {'text', 'groovy'}, 'GNUmakefile': EXTENSIONS['mk'],
'Jenkinsfile': EXTENSIONS['jenkins'],
'LICENSE': EXTENSIONS['txt'], 'LICENSE': EXTENSIONS['txt'],
'MAINTAINERS': EXTENSIONS['txt'], 'MAINTAINERS': EXTENSIONS['txt'],
'Makefile': EXTENSIONS['mk'], 'Makefile': EXTENSIONS['mk'],
'makefile': EXTENSIONS['mk'],
'NEWS': EXTENSIONS['txt'], 'NEWS': EXTENSIONS['txt'],
'NOTICE': EXTENSIONS['txt'], 'NOTICE': EXTENSIONS['txt'],
'PATENTS': EXTENSIONS['txt'], 'PATENTS': EXTENSIONS['txt'],
@ -284,4 +293,6 @@ NAMES = {
'README': EXTENSIONS['txt'], 'README': EXTENSIONS['txt'],
'Rakefile': EXTENSIONS['rb'], 'Rakefile': EXTENSIONS['rb'],
'setup.cfg': EXTENSIONS['ini'], 'setup.cfg': EXTENSIONS['ini'],
'WORKSPACE': EXTENSIONS['bzl'],
'wscript': EXTENSIONS['py'],
} }

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = identify name = identify
version = 2.2.4 version = 2.2.11
description = File identification library for Python description = File identification library for Python
long_description = file: README.md long_description = file: README.md
long_description_content_type = text/markdown long_description_content_type = text/markdown
@ -49,6 +49,8 @@ disallow_any_generics = true
disallow_incomplete_defs = true disallow_incomplete_defs = true
disallow_untyped_defs = true disallow_untyped_defs = true
no_implicit_optional = true no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
[mypy-testing.*] [mypy-testing.*]
disallow_untyped_defs = false disallow_untyped_defs = false

View file

@ -160,6 +160,9 @@ def test_tags_from_path_plist_text(tmpdir):
('mod/Dockerfile', {'text', 'dockerfile'}), ('mod/Dockerfile', {'text', 'dockerfile'}),
('Gemfile', {'text', 'ruby'}), ('Gemfile', {'text', 'ruby'}),
('Gemfile.lock', {'text'}), ('Gemfile.lock', {'text'}),
('Jenkinsfile', {'text', 'groovy', 'jenkins'}),
('build.jenkins', {'text', 'groovy', 'jenkins'}),
('build.jenkinsfile', {'text', 'groovy', 'jenkins'}),
# does not set binary / text # does not set binary / text
('f.plist', {'plist'}), ('f.plist', {'plist'}),