Merging upstream version 2.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
13a62a0f54
commit
e5b299766a
5 changed files with 16 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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
|
||||
|
|
14
setup.cfg
14
setup.cfg
|
@ -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
|
||||
|
|
|
@ -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'}),
|
||||
|
|
Loading…
Add table
Reference in a new issue