Set number of matches to four and cutoff to 0.4
Review Request #8043 — Created March 9, 2016 and submitted
Set number of matches to four and cutoff to 0.4
This script...
#!/usr/bin/env python2 import difflib word = "git@git.example.org:/foo.git" possibilities = ["/srv/git/repositories/baz.git", "git://git.example.org/test.git", "/srv/git/repositories/bar.git", "/srv/git/repositories/test.git", "/srv/git/repositories/website.git", "/srv/git/repositories/foo.git"] print(difflib.get_close_matches(word, possibilities, n=4))
...will return
['git://git.example.org/test.git']
, while this script...#!/usr/bin/env python2 import difflib word = "git@git.example.org:/foo.git" possibilities = ["/srv/git/repositories/baz.git", "git://git.example.org/test.git", "/srv/git/repositories/bar.git", "/srv/git/repositories/test.git", "/srv/git/repositories/website.git", "/srv/git/repositories/foo.git"] print(difflib.get_close_matches(word, possibilities, n=4, cutoff=0.4))
...will return
['git://git.example.org/test.git', '/srv/git/repositories/foo.git', '/srv/git/repositories/baz.git', '/srv/git/repositories/bar.git']
.