mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue 3189: Py3k DeprecationWarning in difflib
This commit is contained in:
parent
cab7e56e84
commit
4ac817213b
1 changed files with 4 additions and 4 deletions
|
@ -202,7 +202,7 @@ class SequenceMatcher:
|
||||||
# DON'T USE! Only __chain_b uses this. Use isbjunk.
|
# DON'T USE! Only __chain_b uses this. Use isbjunk.
|
||||||
# isbjunk
|
# isbjunk
|
||||||
# for x in b, isbjunk(x) == isjunk(x) but much faster;
|
# for x in b, isbjunk(x) == isjunk(x) but much faster;
|
||||||
# it's really the has_key method of a hidden dict.
|
# it's really the __contains__ method of a hidden dict.
|
||||||
# DOES NOT WORK for x in a!
|
# DOES NOT WORK for x in a!
|
||||||
# isbpopular
|
# isbpopular
|
||||||
# for x in b, isbpopular(x) is true iff b is reasonably long
|
# for x in b, isbpopular(x) is true iff b is reasonably long
|
||||||
|
@ -344,8 +344,8 @@ class SequenceMatcher:
|
||||||
# lot of junk in the sequence, the number of *unique* junk
|
# lot of junk in the sequence, the number of *unique* junk
|
||||||
# elements is probably small. So the memory burden of keeping
|
# elements is probably small. So the memory burden of keeping
|
||||||
# this dict alive is likely trivial compared to the size of b2j.
|
# this dict alive is likely trivial compared to the size of b2j.
|
||||||
self.isbjunk = junkdict.has_key
|
self.isbjunk = junkdict.__contains__
|
||||||
self.isbpopular = populardict.has_key
|
self.isbpopular = populardict.__contains__
|
||||||
|
|
||||||
def find_longest_match(self, alo, ahi, blo, bhi):
|
def find_longest_match(self, alo, ahi, blo, bhi):
|
||||||
"""Find longest matching block in a[alo:ahi] and b[blo:bhi].
|
"""Find longest matching block in a[alo:ahi] and b[blo:bhi].
|
||||||
|
@ -677,7 +677,7 @@ class SequenceMatcher:
|
||||||
# avail[x] is the number of times x appears in 'b' less the
|
# avail[x] is the number of times x appears in 'b' less the
|
||||||
# number of times we've seen it in 'a' so far ... kinda
|
# number of times we've seen it in 'a' so far ... kinda
|
||||||
avail = {}
|
avail = {}
|
||||||
availhas, matches = avail.has_key, 0
|
availhas, matches = avail.__contains__, 0
|
||||||
for elt in self.a:
|
for elt in self.a:
|
||||||
if availhas(elt):
|
if availhas(elt):
|
||||||
numb = avail[elt]
|
numb = avail[elt]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue