33
44from bisect import bisect_right
55from dataclasses import dataclass
6- from itertools import accumulate , chain , combinations , repeat , starmap
6+ from itertools import accumulate , chain , combinations , repeat
77from re import escape
88from string import ascii_letters , ascii_lowercase
99
@@ -23,8 +23,8 @@ class _TermStrategies:
2323 term_pairs : st .SearchStrategy [list [tuple [str , str ]]]
2424
2525
26- def _not_substring (a : str , b : str ) -> bool :
27- a , b = a .lower (), b . lower ( )
26+ def _not_substring (pair : tuple [ str , str ] ) -> bool :
27+ a , b = ( s .lower () for s in pair )
2828 return a not in b and b not in a
2929
3030
@@ -33,15 +33,11 @@ def _build_term_strategies(
3333) -> _TermStrategies :
3434 item : st .SearchStrategy [str ] = st .text (min_size = 1 , alphabet = alphabet )
3535 pair : st .SearchStrategy [tuple [str , str ]] = st .tuples (item , item ).filter (
36- lambda x : _not_substring ( * x )
36+ _not_substring
3737 )
3838 pairs : st .SearchStrategy [list [tuple [str , str ]]] = st .lists (
3939 pair , min_size = 1 , max_size = BATCH_COUNT
40- ).filter (
41- lambda xs : all (
42- starmap (_not_substring , combinations (chain (* xs ), 2 ))
43- )
44- )
40+ ).filter (lambda xs : all (map (_not_substring , combinations (chain (* xs ), 2 ))))
4541
4642 return _TermStrategies (item , pair , pairs )
4743
0 commit comments