Skip to content

Commit 4a8289d

Browse files
committed
remove unused findall method
1 parent 95734e8 commit 4a8289d

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

Lib/difflib.py

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,61 +2380,6 @@ def build(self, start2=0, stop2=None):
23802380
self.nodes = self._build(start2, stop2)
23812381
self.cache = key
23822382

2383-
def findall(self, seq1, start1=0, stop1=None, start2=0, stop2=None, *,
2384-
mink=1, maxk=None, maximal=False):
2385-
"""Find all common substrings from single O(n) scan
2386-
Args:
2387-
mink : int
2388-
filter out shorter length matches
2389-
maxk : int
2390-
filter out longer length matches
2391-
maximal : bool
2392-
Example: 2 sequences: seq2 = 'abcdef', seq1 = 'defabc'
2393-
These are matches for each iteration:
2394-
1. 'd'
2395-
2. 'de'
2396-
3. 'def'
2397-
4. 'a'
2398-
5. 'ab'
2399-
6. 'abc'
2400-
If maximal is True, then it will only include 'def' and `abc`
2401-
"""
2402-
if maxk is None:
2403-
maxk = _MAXSIZE
2404-
if not 0 < mink <= maxk:
2405-
raise ValueError(f'not 0 < {mink=} <= {maxk=}')
2406-
start1, stop1 = _adjust_indices(len(seq1), start1, stop1)
2407-
start2, stop2 = _adjust_indices(self.size2, start2, stop2)
2408-
if start1 >= stop1 or start2 >= stop2:
2409-
return
2410-
2411-
if self.cache != (start2, stop2):
2412-
self.build(start2, stop2)
2413-
2414-
it = self._finditer(seq1, start1, stop1)
2415-
if not maximal:
2416-
for block in it:
2417-
k = block[2]
2418-
if mink <= k and (maxk is None or k <= maxk):
2419-
one_mk = 1 - k
2420-
yield (block[0] + one_mk, block[1] + one_mk, k)
2421-
else:
2422-
for last in it:
2423-
break
2424-
else:
2425-
return
2426-
k = last[2]
2427-
for block in it:
2428-
if block[2] <= k:
2429-
if mink <= k and (maxk is None or k <= maxk):
2430-
one_mk = 1 - k
2431-
yield (last[0] + one_mk, last[1] + one_mk, k)
2432-
last = block
2433-
k = last[2]
2434-
if mink <= k and (maxk is None or k <= maxk):
2435-
one_mk = 1 - k
2436-
yield (last[0] + one_mk, last[1] + one_mk, k)
2437-
24382383
def find(self, seq1, start1=0, stop1=None, start2=0, stop2=None):
24392384
"""Find leftmost longest match
24402385
Firstly, it will be leftmost in seq1

0 commit comments

Comments
 (0)