[Python-modules-commits] [fuzzywuzzy] 01/06: Import fuzzywuzzy_0.8.0.orig.tar.gz
Edward Betts
edward at moszumanska.debian.org
Wed Dec 2 12:43:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
edward pushed a commit to branch master
in repository fuzzywuzzy.
commit f683e89ffaa6d94bae6550137fecf280978b4f52
Author: Edward Betts <edward at 4angle.com>
Date: Wed Dec 2 12:29:19 2015 +0000
Import fuzzywuzzy_0.8.0.orig.tar.gz
---
CHANGES.rst | 42 +++++++++++++++++++++++++++++++++++
PKG-INFO | 8 +++----
README | 6 ++---
README.rst | 6 ++---
fuzzywuzzy.egg-info/PKG-INFO | 8 +++----
fuzzywuzzy.egg-info/pbr.json | 2 +-
fuzzywuzzy/__init__.py | 2 +-
fuzzywuzzy/fuzz.py | 10 ++++-----
fuzzywuzzy/utils.py | 4 +++-
test_fuzzywuzzy.py | 52 +++++++++++++++++++++++++-------------------
10 files changed, 95 insertions(+), 45 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 37cfdb5..9dd59c2 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,48 @@
Changelog
=========
+0.8.0 (2015-11-16)
+------------------
+
+- Refer to Levenshtein distance in readme. Closes #88. [Jose Diaz-
+ Gonzalez]
+
+- Added install step for travis to have pep8 available. [Pedro
+ Rodrigues]
+
+- Added a pep8 test. The way I add the error 501 to the ignore tuple is
+ probably wrong but from the docs and source code of pep8 I could not
+ find any other way. [Pedro Rodrigues]
+
+ I also went ahead and removed the pep8 call from the release file.
+
+
+- Added python 3.5, pypy, and ypyp3 to the travis config file. [Pedro
+ Rodrigues]
+
+- Added another step to the release file to run the tests before
+ releasing. [Pedro Rodrigues]
+
+- Fixed a few pep8 errors Added a verification step in the release
+ automation file. This step should probably be somewhere at git level.
+ [Pedro Rodrigues]
+
+- Pep8. [Pedro Rodrigues]
+
+- Leaving TODOs in the code was never a good idea. [Pedro Rodrigues]
+
+- Changed return values to be rounded integers. [Pedro Rodrigues]
+
+- Added a test with the recovered data file. [Pedro Rodrigues]
+
+- Recovered titledata.csv. [Pedro Rodrigues]
+
+- Move extract test methods into the process test. [Shale Craig]
+
+ Somehow, they ended up in the `RatioTest`, despite asserting that the
+ `ProcessTest` works.
+
+
0.7.0 (2015-10-02)
------------------
diff --git a/PKG-INFO b/PKG-INFO
index 44c44cb..99f4b63 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: fuzzywuzzy
-Version: 0.7.0
+Version: 0.8.0
Summary: Fuzzy string matching in python
Home-page: https://github.com/seatgeek/fuzzywuzzy
Author: Adam Cohen
@@ -31,7 +31,7 @@ Description: |Build Status|
FuzzyWuzzy
==========
- Fuzzy string matching like a boss.
+ Fuzzy string matching like a boss. It uses [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to help calculate differences between sequences in a simple to use package.
Requirements
============
@@ -54,13 +54,13 @@ Description: |Build Status|
.. code:: bash
- pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Adding to your ``requirements.txt`` file (run ``pip install -r requirements.txt`` afterwards)
.. code:: bash
- git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Manually via GIT
diff --git a/README b/README
index 2044a24..d89e0fa 100644
--- a/README
+++ b/README
@@ -3,7 +3,7 @@
FuzzyWuzzy
==========
-Fuzzy string matching like a boss.
+Fuzzy string matching like a boss. It uses [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to help calculate differences between sequences in a simple to use package.
Requirements
============
@@ -26,13 +26,13 @@ Using PIP via Github
.. code:: bash
- pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Adding to your ``requirements.txt`` file (run ``pip install -r requirements.txt`` afterwards)
.. code:: bash
- git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Manually via GIT
diff --git a/README.rst b/README.rst
index 2044a24..d89e0fa 100644
--- a/README.rst
+++ b/README.rst
@@ -3,7 +3,7 @@
FuzzyWuzzy
==========
-Fuzzy string matching like a boss.
+Fuzzy string matching like a boss. It uses [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to help calculate differences between sequences in a simple to use package.
Requirements
============
@@ -26,13 +26,13 @@ Using PIP via Github
.. code:: bash
- pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Adding to your ``requirements.txt`` file (run ``pip install -r requirements.txt`` afterwards)
.. code:: bash
- git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Manually via GIT
diff --git a/fuzzywuzzy.egg-info/PKG-INFO b/fuzzywuzzy.egg-info/PKG-INFO
index 44c44cb..99f4b63 100644
--- a/fuzzywuzzy.egg-info/PKG-INFO
+++ b/fuzzywuzzy.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: fuzzywuzzy
-Version: 0.7.0
+Version: 0.8.0
Summary: Fuzzy string matching in python
Home-page: https://github.com/seatgeek/fuzzywuzzy
Author: Adam Cohen
@@ -31,7 +31,7 @@ Description: |Build Status|
FuzzyWuzzy
==========
- Fuzzy string matching like a boss.
+ Fuzzy string matching like a boss. It uses [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to help calculate differences between sequences in a simple to use package.
Requirements
============
@@ -54,13 +54,13 @@ Description: |Build Status|
.. code:: bash
- pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ pip install git+git://github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Adding to your ``requirements.txt`` file (run ``pip install -r requirements.txt`` afterwards)
.. code:: bash
- git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.7.0#egg=fuzzywuzzy
+ git+ssh://git@github.com/seatgeek/fuzzywuzzy.git@0.8.0#egg=fuzzywuzzy
Manually via GIT
diff --git a/fuzzywuzzy.egg-info/pbr.json b/fuzzywuzzy.egg-info/pbr.json
index 7bebd3d..fc763b7 100644
--- a/fuzzywuzzy.egg-info/pbr.json
+++ b/fuzzywuzzy.egg-info/pbr.json
@@ -1 +1 @@
-{"is_release": true, "git_version": "11d2b58"}
\ No newline at end of file
+{"is_release": true, "git_version": "8679c17"}
\ No newline at end of file
diff --git a/fuzzywuzzy/__init__.py b/fuzzywuzzy/__init__.py
index 28b1b2f..690cefb 100644
--- a/fuzzywuzzy/__init__.py
+++ b/fuzzywuzzy/__init__.py
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
-__version__ = '0.7.0'
+__version__ = '0.8.0'
diff --git a/fuzzywuzzy/fuzz.py b/fuzzywuzzy/fuzz.py
index e7560e1..46ace22 100644
--- a/fuzzywuzzy/fuzz.py
+++ b/fuzzywuzzy/fuzz.py
@@ -49,7 +49,6 @@ def ratio(s1, s2):
return utils.intr(100 * m.ratio())
-# todo: skip duplicate indexes for a little more speed
@utils.check_for_none
@utils.check_empty_string
def partial_ratio(s1, s2):
@@ -86,7 +85,7 @@ def partial_ratio(s1, s2):
else:
scores.append(r)
- return int(100 * max(scores))
+ return utils.intr(100 * max(scores))
##############################
@@ -131,6 +130,7 @@ def partial_token_sort_ratio(s1, s2, force_ascii=True):
"""
return _token_sort(s1, s2, partial=True, force_ascii=force_ascii)
+
@utils.check_for_none
def _token_set(s1, s2, partial=True, force_ascii=True):
"""Find all alphanumeric tokens in each string...
@@ -189,8 +189,6 @@ def partial_token_set_ratio(s1, s2, force_ascii=True):
return _token_set(s1, s2, partial=True, force_ascii=force_ascii)
-# TODO: numerics
-
###################
# Combination API #
###################
@@ -250,12 +248,12 @@ def WRatio(s1, s2, force_ascii=True):
ptser = partial_token_set_ratio(p1, p2, force_ascii=force_ascii) \
* unbase_scale * partial_scale
- return int(max(base, partial, ptsor, ptser))
+ return utils.intr(max(base, partial, ptsor, ptser))
else:
tsor = token_sort_ratio(p1, p2, force_ascii=force_ascii) * unbase_scale
tser = token_set_ratio(p1, p2, force_ascii=force_ascii) * unbase_scale
- return int(max(base, tsor, tser))
+ return utils.intr(max(base, tsor, tser))
def UWRatio(s1, s2):
diff --git a/fuzzywuzzy/utils.py b/fuzzywuzzy/utils.py
index be1baad..bb0426d 100644
--- a/fuzzywuzzy/utils.py
+++ b/fuzzywuzzy/utils.py
@@ -14,6 +14,7 @@ def validate_string(s):
except TypeError:
return False
+
def check_for_none(func):
@functools.wraps(func)
def decorator(*args, **kwargs):
@@ -24,12 +25,13 @@ def check_for_none(func):
return func(*args, **kwargs)
return decorator
+
def check_empty_string(func):
@functools.wraps(func)
def decorator(*args, **kwargs):
if len(args[0]) == 0 or len(args[1]) == 0:
return 0
- return func(*args, **kwargs)
+ return func(*args, **kwargs)
return decorator
bad_chars = str("").join([chr(i) for i in range(128, 256)]) # ascii dammit!
diff --git a/test_fuzzywuzzy.py b/test_fuzzywuzzy.py
index d5621ea..93123e6 100644
--- a/test_fuzzywuzzy.py
+++ b/test_fuzzywuzzy.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import unittest
import re
import sys
+import pep8
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
@@ -263,26 +264,6 @@ class RatioTest(unittest.TestCase):
score = fuzz._token_sort(s1, s2, force_ascii=False)
self.assertLess(score, 100)
- # test processing methods
- def testGetBestChoice1(self):
- query = "new york mets at atlanta braves"
- best = process.extractOne(query, self.baseball_strings)
- self.assertEqual(best[0], "braves vs mets")
-
- def testGetBestChoice2(self):
- query = "philadelphia phillies at atlanta braves"
- best = process.extractOne(query, self.baseball_strings)
- self.assertEqual(best[0], self.baseball_strings[2])
-
- def testGetBestChoice3(self):
- query = "atlanta braves at philadelphia phillies"
- best = process.extractOne(query, self.baseball_strings)
- self.assertEqual(best[0], self.baseball_strings[2])
-
- def testGetBestChoice4(self):
- query = "chicago cubs vs new york mets"
- best = process.extractOne(query, self.baseball_strings)
- self.assertEqual(best[0], self.baseball_strings[0])
class ValidatorTest(unittest.TestCase):
def setUp(self):
@@ -346,6 +327,26 @@ class ProcessTest(unittest.TestCase):
"braves vs mets",
]
+ def testGetBestChoice1(self):
+ query = "new york mets at atlanta braves"
+ best = process.extractOne(query, self.baseball_strings)
+ self.assertEqual(best[0], "braves vs mets")
+
+ def testGetBestChoice2(self):
+ query = "philadelphia phillies at atlanta braves"
+ best = process.extractOne(query, self.baseball_strings)
+ self.assertEqual(best[0], self.baseball_strings[2])
+
+ def testGetBestChoice3(self):
+ query = "atlanta braves at philadelphia phillies"
+ best = process.extractOne(query, self.baseball_strings)
+ self.assertEqual(best[0], self.baseball_strings[2])
+
+ def testGetBestChoice4(self):
+ query = "chicago cubs vs new york mets"
+ best = process.extractOne(query, self.baseball_strings)
+ self.assertEqual(best[0], self.baseball_strings[0])
+
def testWithProcessor(self):
events = [
["chicago cubs vs new york mets", "CitiField", "2011-05-11", "8pm"],
@@ -353,9 +354,8 @@ class ProcessTest(unittest.TestCase):
["atlanta braves vs pittsburgh pirates", "PNC Park", "2011-05-11", "8pm"],
]
query = "new york mets vs chicago cubs"
- processor = lambda event: event[0]
- best = process.extractOne(query, events, processor=processor)
+ best = process.extractOne(query, events, processor=lambda event: event[0])
self.assertEqual(best[0], events[0])
def testWithScorer(self):
@@ -501,5 +501,13 @@ class ProcessTest(unittest.TestCase):
self.assertEqual(result, deduped_list)
+class TestCodeFormat(unittest.TestCase):
+ def test_pep8_conformance(self):
+ pep8style = pep8.StyleGuide(quiet=True)
+ pep8style.options.ignore = pep8style.options.ignore + tuple(['E501'])
+ pep8style.input_dir('fuzzywuzzy')
+ result = pep8style.check_files()
+ self.assertEqual(result.total_errors, 0, "PEP8 POLICE - WOOOOOWOOOOOOOOOO")
+
if __name__ == '__main__':
unittest.main() # run all tests
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/fuzzywuzzy.git
More information about the Python-modules-commits
mailing list