From af2b73458b2c6fd28d7da0516445502d28b2ba58 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 17 Jul 2021 09:32:04 +0200 Subject: Merging upstream version 2.2.11. Signed-off-by: Daniel Baumann --- .pre-commit-config.yaml | 12 ++++++------ bin/vendor-licenses | 4 ++-- identify/extensions.py | 19 +++++++++++++++---- setup.cfg | 4 +++- tests/identify_test.py | 3 +++ 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b007a1..696fc44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.0.1 hooks: - id: check-docstring-first - id: check-yaml @@ -15,17 +15,17 @@ repos: hooks: - id: setup-cfg-fmt - repo: https://github.com/PyCQA/flake8 - rev: 3.9.1 + rev: 3.9.2 hooks: - id: flake8 exclude: ^identify/vendor/licenses\.py$ additional_dependencies: [flake8-typing-imports==1.10.1] - repo: https://github.com/pre-commit/mirrors-autopep8 - rev: v1.5.6 + rev: v1.5.7 hooks: - id: autopep8 - repo: https://github.com/asottile/reorder_python_imports - rev: v2.4.0 + rev: v2.5.0 hooks: - id: reorder-python-imports args: [--py3-plus] @@ -35,11 +35,11 @@ repos: - id: add-trailing-comma args: [--py36-plus] - repo: https://github.com/asottile/pyupgrade - rev: v2.12.0 + rev: v2.20.0 hooks: - id: pyupgrade args: [--py36-plus] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v0.910 hooks: - id: mypy diff --git a/bin/vendor-licenses b/bin/vendor-licenses index 2dbde36..1303558 100755 --- a/bin/vendor-licenses +++ b/bin/vendor-licenses @@ -33,11 +33,11 @@ def main() -> int: _, data, license_text = contents.split('---\n', 2) - spdx, = [ + spdx, = ( line[len('spdx-id:'):].strip() for line in data.splitlines() if line.startswith('spdx-id:') - ] + ) licenses.append((spdx, license_text)) diff --git a/identify/extensions.py b/identify/extensions.py index 0018da3..a6b2039 100644 --- a/identify/extensions.py +++ b/identify/extensions.py @@ -6,9 +6,11 @@ EXTENSIONS = { 'avif': {'binary', 'image', 'avif'}, 'bash': {'text', 'shell', 'bash'}, 'bat': {'text', 'batch'}, + 'bats': {'text', 'shell', 'bash', 'bats'}, 'bib': {'text', 'bib'}, 'bmp': {'binary', 'image', 'bitmap'}, 'bz2': {'binary', 'bzip2'}, + 'bzl': {'text', 'bazel'}, 'c': {'text', 'c'}, 'cc': {'text', 'c++'}, 'cfg': {'text'}, @@ -78,7 +80,8 @@ EXTENSIONS = { 'jade': {'text', 'jade'}, 'jar': {'binary', 'zip', 'jar'}, 'java': {'text', 'java'}, - 'jenkinsfile': {'text', 'groovy'}, + 'jenkins': {'text', 'groovy', 'jenkins'}, + 'jenkinsfile': {'text', 'groovy', 'jenkins'}, 'jinja': {'text', 'jinja'}, 'jinja2': {'text', 'jinja'}, 'jpeg': {'binary', 'image', 'jpeg'}, @@ -180,11 +183,13 @@ EXTENSIONS = { 'tiff': {'binary', 'image', 'tiff'}, 'toml': {'text', 'toml'}, 'ts': {'text', 'ts'}, + 'tsv': {'text', 'tsv'}, 'tsx': {'text', 'tsx'}, 'ttf': {'binary', 'ttf'}, 'twig': {'text', 'twig'}, 'txsprofile': {'text', 'ini', 'txsprofile'}, 'txt': {'text', 'plain-text'}, + 'urdf': {'text', 'xml', 'urdf'}, 'v': {'text', 'verilog'}, 'vb': {'text', 'vb'}, 'vbproj': {'text', 'xml', 'vbproj'}, @@ -216,8 +221,10 @@ EXTENSIONS = { 'yang': {'text', 'yang'}, 'yin': {'text', 'xml', 'yin'}, 'yml': {'text', 'yaml'}, + 'zcml': {'text', 'xml', 'zcml'}, 'zig': {'text', 'zig'}, 'zip': {'binary', 'zip'}, + 'zpt': {'text', 'zpt'}, 'zsh': {'text', 'shell', 'zsh'}, } EXTENSIONS_NEED_BINARY_CHECK = { @@ -261,8 +268,8 @@ NAMES = { '.zshrc': EXTENSIONS['zsh'], '.zshenv': EXTENSIONS['zsh'], 'AUTHORS': EXTENSIONS['txt'], - 'BUILD': {'text', 'bazel'}, - 'BUILD.bazel': {'text', 'bazel'}, + 'BUILD': EXTENSIONS['bzl'], + 'BUILD.bazel': EXTENSIONS['bzl'], 'CMakeLists.txt': EXTENSIONS['cmake'], 'CHANGELOG': EXTENSIONS['txt'], 'CONTRIBUTING': EXTENSIONS['txt'], @@ -270,10 +277,12 @@ NAMES = { 'Dockerfile': {'text', 'dockerfile'}, 'Gemfile': EXTENSIONS['rb'], 'Gemfile.lock': {'text'}, - 'Jenkinsfile': {'text', 'groovy'}, + 'GNUmakefile': EXTENSIONS['mk'], + 'Jenkinsfile': EXTENSIONS['jenkins'], 'LICENSE': EXTENSIONS['txt'], 'MAINTAINERS': EXTENSIONS['txt'], 'Makefile': EXTENSIONS['mk'], + 'makefile': EXTENSIONS['mk'], 'NEWS': EXTENSIONS['txt'], 'NOTICE': EXTENSIONS['txt'], 'PATENTS': EXTENSIONS['txt'], @@ -284,4 +293,6 @@ NAMES = { 'README': EXTENSIONS['txt'], 'Rakefile': EXTENSIONS['rb'], 'setup.cfg': EXTENSIONS['ini'], + 'WORKSPACE': EXTENSIONS['bzl'], + 'wscript': EXTENSIONS['py'], } diff --git a/setup.cfg b/setup.cfg index 194b318..b8f49d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = identify -version = 2.2.4 +version = 2.2.11 description = File identification library for Python long_description = file: README.md long_description_content_type = text/markdown @@ -49,6 +49,8 @@ disallow_any_generics = true disallow_incomplete_defs = true disallow_untyped_defs = true no_implicit_optional = true +warn_redundant_casts = true +warn_unused_ignores = true [mypy-testing.*] disallow_untyped_defs = false diff --git a/tests/identify_test.py b/tests/identify_test.py index 1b5dde0..ec40cdf 100644 --- a/tests/identify_test.py +++ b/tests/identify_test.py @@ -160,6 +160,9 @@ def test_tags_from_path_plist_text(tmpdir): ('mod/Dockerfile', {'text', 'dockerfile'}), ('Gemfile', {'text', 'ruby'}), ('Gemfile.lock', {'text'}), + ('Jenkinsfile', {'text', 'groovy', 'jenkins'}), + ('build.jenkins', {'text', 'groovy', 'jenkins'}), + ('build.jenkinsfile', {'text', 'groovy', 'jenkins'}), # does not set binary / text ('f.plist', {'plist'}), -- cgit v1.2.3