diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-20 22:23:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-20 22:23:04 +0000 |
commit | da7561b1d44bce2db12d63129cd466bbff4f5a80 (patch) | |
tree | de741261fe84c3ad804f32ef9a2893266c216c5b | |
parent | Adding upstream version 2.1.2. (diff) | |
download | identify-da7561b1d44bce2db12d63129cd466bbff4f5a80.tar.xz identify-da7561b1d44bce2db12d63129cd466bbff4f5a80.zip |
Adding upstream version 2.2.0.upstream/2.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r-- | .pre-commit-config.yaml | 6 | ||||
-rw-r--r-- | identify/extensions.py | 2 | ||||
-rw-r--r-- | identify/identify.py | 4 | ||||
-rw-r--r-- | setup.cfg | 14 | ||||
-rw-r--r-- | tests/identify_test.py | 2 |
5 files changed, 16 insertions, 12 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1dc351..bb59eb7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,17 +11,17 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/asottile/setup-cfg-fmt - rev: v1.16.0 + rev: v1.17.0 hooks: - id: setup-cfg-fmt - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.0 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.4 + rev: v1.5.5 hooks: - id: autopep8 - repo: https://github.com/asottile/reorder_python_imports diff --git a/identify/extensions.py b/identify/extensions.py index 48864fc..d5a1627 100644 --- a/identify/extensions.py +++ b/identify/extensions.py @@ -226,6 +226,7 @@ NAMES = { '.bash_aliases': EXTENSIONS['bash'], '.bash_profile': EXTENSIONS['bash'], '.bashrc': EXTENSIONS['bash'], + '.bazelrc': {'text', 'bazelrc'}, '.bowerrc': EXTENSIONS['json'] | {'bowerrc'}, '.browserslistrc': {'text', 'browserslistrc'}, '.clang-format': EXTENSIONS['yaml'], @@ -261,6 +262,7 @@ NAMES = { 'COPYING': EXTENSIONS['txt'], 'Dockerfile': {'text', 'dockerfile'}, 'Gemfile': EXTENSIONS['rb'], + 'Gemfile.lock': {'text'}, 'Jenkinsfile': {'text', 'groovy'}, 'LICENSE': EXTENSIONS['txt'], 'MAINTAINERS': EXTENSIONS['txt'], diff --git a/identify/identify.py b/identify/identify.py index 52d2c2d..59bc6ba 100644 --- a/identify/identify.py +++ b/identify/identify.py @@ -240,7 +240,7 @@ def license_id(filename: str) -> Optional[str]: 3. check exact text match with existing licenses 4. failing that use edit distance """ - import editdistance # `pip install identify[license]` + import editdistance_s # `pip install identify[license]` with open(filename, encoding='UTF-8') as f: contents = f.read() @@ -260,7 +260,7 @@ def license_id(filename: str) -> Optional[str]: if norm and abs(len(norm) - len(norm_license)) / len(norm) > .05: continue - edit_dist = editdistance.eval(norm, norm_license) + edit_dist = editdistance_s.distance(norm, norm_license) if edit_dist < min_edit_dist: min_edit_dist = edit_dist min_edit_dist_spdx = spdx @@ -1,6 +1,6 @@ [metadata] name = identify -version = 2.1.2 +version = 2.2.0 description = File identification library for Python long_description = file: README.md long_description_content_type = text/markdown @@ -24,18 +24,18 @@ classifiers = packages = find: python_requires = >=3.6.1 +[options.packages.find] +exclude = + tests* + testing* + [options.entry_points] console_scripts = identify-cli=identify.cli:main [options.extras_require] license = - editdistance - -[options.packages.find] -exclude = - tests* - testing* + editdistance-s [bdist_wheel] universal = True diff --git a/tests/identify_test.py b/tests/identify_test.py index f881f0b..1b5dde0 100644 --- a/tests/identify_test.py +++ b/tests/identify_test.py @@ -158,6 +158,8 @@ def test_tags_from_path_plist_text(tmpdir): ('Pipfile.lock', {'text', 'json'}), ('mod/test.py', {'text', 'python'}), ('mod/Dockerfile', {'text', 'dockerfile'}), + ('Gemfile', {'text', 'ruby'}), + ('Gemfile.lock', {'text'}), # does not set binary / text ('f.plist', {'plist'}), |