@@ -1276,8 +1276,6 @@ def predecessor(
1276
1276
* ,
1277
1277
strict : bool = True ,
1278
1278
key : Optional [Callable [[Any ], Any ]] = None ,
1279
- min_length : int = 0 ,
1280
- max_length : Optional [int ] = None ,
1281
1279
) -> Optional [str ]:
1282
1280
"""
1283
1281
Returns the first string accepted by the DFA that comes before
@@ -1293,10 +1291,6 @@ def predecessor(
1293
1291
key : Optional[Callable], default: None
1294
1292
Function for defining custom lexicographical ordering. Defaults to using
1295
1293
the standard string ordering.
1296
- min_length : int, default: 0
1297
- Limits generation to words with at least the given length.
1298
- max_length : Optional[int], default: None
1299
- Limits generation to words with at most the given length.
1300
1294
1301
1295
Returns
1302
1296
------
@@ -1309,13 +1303,7 @@ def predecessor(
1309
1303
Raised if the language accepted by self is infinite, as we cannot
1310
1304
generate predecessors in this case.
1311
1305
"""
1312
- for word in self .predecessors (
1313
- input_str ,
1314
- strict = strict ,
1315
- key = key ,
1316
- min_length = min_length ,
1317
- max_length = max_length ,
1318
- ):
1306
+ for word in self .predecessors (input_str , strict = strict , key = key ):
1319
1307
return word
1320
1308
return None
1321
1309
@@ -1325,8 +1313,6 @@ def predecessors(
1325
1313
* ,
1326
1314
strict : bool = True ,
1327
1315
key : Optional [Callable [[Any ], Any ]] = None ,
1328
- min_length : int = 0 ,
1329
- max_length : Optional [int ] = None ,
1330
1316
) -> Generator [str , None , None ]:
1331
1317
"""
1332
1318
Generates all strings that come before the input string
@@ -1342,10 +1328,6 @@ def predecessors(
1342
1328
key : Optional[Callable], default: None
1343
1329
Function for defining custom lexicographical ordering. Defaults to using
1344
1330
the standard string ordering.
1345
- min_length : int, default: 0
1346
- Limits generation to words with at least the given length.
1347
- max_length : Optional[int], default: None
1348
- Limits generation to words with at most the given length.
1349
1331
1350
1332
Returns
1351
1333
------
@@ -1359,23 +1341,14 @@ def predecessors(
1359
1341
Raised if the language accepted by self is infinite, as we cannot
1360
1342
generate predecessors in this case.
1361
1343
"""
1362
- yield from self .successors (
1363
- input_str ,
1364
- strict = strict ,
1365
- reverse = True ,
1366
- key = key ,
1367
- min_length = min_length ,
1368
- max_length = max_length ,
1369
- )
1344
+ yield from self .successors (input_str , strict = strict , reverse = True , key = key )
1370
1345
1371
1346
def successor (
1372
1347
self ,
1373
1348
input_str : Optional [str ],
1374
1349
* ,
1375
1350
strict : bool = True ,
1376
1351
key : Optional [Callable [[Any ], Any ]] = None ,
1377
- min_length : int = 0 ,
1378
- max_length : Optional [int ] = None ,
1379
1352
) -> Optional [str ]:
1380
1353
"""
1381
1354
Returns the first string accepted by the DFA that comes after
@@ -1391,23 +1364,13 @@ def successor(
1391
1364
key : Optional[Callable], default: None
1392
1365
Function for defining custom lexicographical ordering. Defaults to using
1393
1366
the standard string ordering.
1394
- min_length : int, default: 0
1395
- Limits generation to words with at least the given length.
1396
- max_length : Optional[int], default: None
1397
- Limits generation to words with at most the given length.
1398
1367
1399
1368
Returns
1400
1369
------
1401
1370
str
1402
1371
The first string accepted by the DFA lexicographically before input_string.
1403
1372
"""
1404
- for word in self .successors (
1405
- input_str ,
1406
- strict = strict ,
1407
- key = key ,
1408
- min_length = min_length ,
1409
- max_length = max_length ,
1410
- ):
1373
+ for word in self .successors (input_str , strict = strict , key = key ):
1411
1374
return word
1412
1375
return None
1413
1376
@@ -1418,8 +1381,6 @@ def successors(
1418
1381
strict : bool = True ,
1419
1382
key : Optional [Callable [[Any ], Any ]] = None ,
1420
1383
reverse : bool = False ,
1421
- min_length : int = 0 ,
1422
- max_length : Optional [int ] = None ,
1423
1384
) -> Generator [str , None , None ]:
1424
1385
"""
1425
1386
Generates all strings that come after the input string
@@ -1437,10 +1398,6 @@ def successors(
1437
1398
the standard string ordering.
1438
1399
reverse : bool, default: False
1439
1400
If True, then predecessors will be generated instead of successors.
1440
- min_length : int, default: 0
1441
- Limits generation to words with at least the given length.
1442
- max_length : Optional[int], default: None
1443
- Limits generation to words with at most the given length.
1444
1401
1445
1402
Returns
1446
1403
------
@@ -1489,8 +1446,6 @@ def successors(
1489
1446
if (
1490
1447
not reverse
1491
1448
and should_yield
1492
- and min_length <= len (char_stack )
1493
- and (max_length is None or len (char_stack ) <= max_length )
1494
1449
and candidate == first_symbol
1495
1450
and state in self .final_states
1496
1451
):
@@ -1501,9 +1456,7 @@ def successors(
1501
1456
else self ._get_next_current_state (state , candidate )
1502
1457
)
1503
1458
# Traverse to child if candidate is viable
1504
- if candidate_state in coaccessible_nodes and (
1505
- max_length is None or len (char_stack ) < max_length
1506
- ):
1459
+ if candidate_state in coaccessible_nodes :
1507
1460
state_stack .append (candidate_state )
1508
1461
char_stack .append (cast (str , candidate ))
1509
1462
candidate = first_symbol
@@ -1512,8 +1465,6 @@ def successors(
1512
1465
if (
1513
1466
reverse
1514
1467
and should_yield
1515
- and min_length <= len (char_stack )
1516
- and (max_length is None or len (char_stack ) <= max_length )
1517
1468
and candidate is None
1518
1469
and state in self .final_states
1519
1470
):
@@ -1529,8 +1480,6 @@ def successors(
1529
1480
if (
1530
1481
reverse
1531
1482
and should_yield
1532
- and min_length <= len (char_stack )
1533
- and (max_length is None or len (char_stack ) <= max_length )
1534
1483
and candidate is None
1535
1484
and state in self .final_states
1536
1485
):
0 commit comments