34
34
TableDataSource ,
35
35
get_date_growth_rate ,
36
36
)
37
+ from .utils import OutputProcessor
37
38
38
39
T = TypeVar ("T" )
39
40
@@ -262,9 +263,7 @@ def add_uniques_equality_constraint(
262
263
filter_func : Callable [[List [T ]], List [T ]] = None ,
263
264
map_func : Callable [[T ], T ] = None ,
264
265
reduce_func : Callable [[Collection ], Collection ] = None ,
265
- output_processor : Callable [
266
- [Collection , Optional [Collection ]], Collection
267
- ] = None ,
266
+ output_processors : List [OutputProcessor ] = None ,
268
267
condition : Condition = None ,
269
268
name : str = None ,
270
269
):
@@ -297,7 +296,7 @@ def add_uniques_equality_constraint(
297
296
filter_func = filter_func ,
298
297
map_func = map_func ,
299
298
reduce_func = reduce_func ,
300
- output_processor = output_processor ,
299
+ output_processors = output_processors ,
301
300
name = name ,
302
301
)
303
302
)
@@ -312,10 +311,7 @@ def add_uniques_superset_constraint(
312
311
reduce_func : Callable [[Collection ], Collection ] = None ,
313
312
condition : Condition = None ,
314
313
name : str = None ,
315
- output_processor : Callable [
316
- [Collection , Optional [Collection ]], Collection
317
- ] = None ,
318
- output_remainder_slicer = slice (5 ),
314
+ output_processors : List [OutputProcessor ] = None ,
319
315
):
320
316
"""Check if unique values of columns are contained in the reference data.
321
317
@@ -341,7 +337,7 @@ def add_uniques_superset_constraint(
341
337
categorical values.
342
338
343
339
See ``Uniques`` for further details on ``map_func``, ``reduce_func``,
344
- ``output_processor``, and ``output_remainder_slicer ``.
340
+ and ``output_processors ``.
345
341
"""
346
342
347
343
ref = DataReference (self .data_source , columns , condition )
@@ -353,8 +349,7 @@ def add_uniques_superset_constraint(
353
349
filter_func = filter_func ,
354
350
map_func = map_func ,
355
351
reduce_func = reduce_func ,
356
- output_processor = output_processor ,
357
- output_remainder_slicer = output_remainder_slicer ,
352
+ output_processors = output_processors ,
358
353
name = name ,
359
354
)
360
355
)
@@ -370,10 +365,7 @@ def add_uniques_subset_constraint(
370
365
reduce_func : Callable [[Collection ], Collection ] = None ,
371
366
condition : Condition = None ,
372
367
name : str = None ,
373
- output_processor : Callable [
374
- [Collection , Optional [Collection ]], Collection
375
- ] = None ,
376
- output_remainder_slicer = slice (5 ),
368
+ output_processors : List [OutputProcessor ] = None ,
377
369
):
378
370
"""Check if the data's unique values are contained in a given set of values.
379
371
@@ -403,7 +395,7 @@ def add_uniques_subset_constraint(
403
395
or if `max_relative_violations` is 0.
404
396
405
397
See ``Uniques`` for further details on ``map_func``, ``reduce_func``,
406
- ``output_processor``, and ``output_remainder_slicer ``.
398
+ and ``output_processors ``.
407
399
"""
408
400
409
401
ref = DataReference (self .data_source , columns , condition )
@@ -416,8 +408,7 @@ def add_uniques_subset_constraint(
416
408
compare_distinct = compare_distinct ,
417
409
map_func = map_func ,
418
410
reduce_func = reduce_func ,
419
- output_processor = output_processor ,
420
- output_remainder_slicer = output_remainder_slicer ,
411
+ output_processors = output_processors ,
421
412
name = name ,
422
413
)
423
414
)
@@ -876,10 +867,7 @@ def add_functional_dependency_constraint(
876
867
value_columns : List [str ],
877
868
condition : Condition = None ,
878
869
name : str = None ,
879
- output_processor : Callable [
880
- [Collection , Optional [Collection ]], Collection
881
- ] = None ,
882
- output_remainder_slicer = slice (5 ),
870
+ output_processors : List [OutputProcessor ] = None ,
883
871
):
884
872
"""
885
873
Expresses a functional dependency, a constraint where the `value_columns` are uniquely determined by the `key_columns`.
@@ -889,7 +877,8 @@ def add_functional_dependency_constraint(
889
877
and all other columns are included `value_columns`.
890
878
This constraint allows for a more general definition of functional dependencies, where the `key_columns` are not necessarily a primary key.
891
879
892
- Additional configuration options (for details see the analogous parameters in for ``Uniques``-constraints) on how the output is sorted and how many counterexamples are shown are available as ``output_processor`` and ``output_remainder_slicer``.
880
+ An additional configuration option (for details see the analogous parameter in for ``Uniques``-constraints)
881
+ on how the output is sorted and how many counterexamples are shown is available as ``output_processors``.
893
882
894
883
For more information on functional dependencies, see https://en.wikipedia.org/wiki/Functional_dependency.
895
884
"""
@@ -899,8 +888,7 @@ def add_functional_dependency_constraint(
899
888
miscs_constraints .FunctionalDependency (
900
889
ref ,
901
890
key_columns = key_columns ,
902
- output_processor = output_processor ,
903
- output_remainder_slicer = output_remainder_slicer ,
891
+ output_processors = output_processors ,
904
892
name = name ,
905
893
)
906
894
)
@@ -1476,9 +1464,7 @@ def add_uniques_equality_constraint(
1476
1464
filter_func : Callable [[List [T ]], List [T ]] = None ,
1477
1465
map_func : Callable [[T ], T ] = None ,
1478
1466
reduce_func : Callable [[Collection ], Collection ] = None ,
1479
- output_processor : Callable [
1480
- [Collection , Optional [Collection ]], Collection
1481
- ] = None ,
1467
+ output_processors : List [OutputProcessor ] = None ,
1482
1468
condition1 : Condition = None ,
1483
1469
condition2 : Condition = None ,
1484
1470
name : str = None ,
@@ -1513,7 +1499,7 @@ def add_uniques_equality_constraint(
1513
1499
filter_func = filter_func ,
1514
1500
map_func = map_func ,
1515
1501
reduce_func = reduce_func ,
1516
- output_processor = output_processor ,
1502
+ output_processors = output_processors ,
1517
1503
name = name ,
1518
1504
)
1519
1505
)
@@ -1529,10 +1515,7 @@ def add_uniques_superset_constraint(
1529
1515
condition1 : Condition = None ,
1530
1516
condition2 : Condition = None ,
1531
1517
name : str = None ,
1532
- output_processor : Callable [
1533
- [Collection , Optional [Collection ]], Collection
1534
- ] = None ,
1535
- output_remainder_slicer = slice (5 ),
1518
+ output_processors : List [OutputProcessor ] = None ,
1536
1519
):
1537
1520
"""Check if unique values of columns are contained in the reference data.
1538
1521
@@ -1559,7 +1542,7 @@ def add_uniques_superset_constraint(
1559
1542
categorical values.
1560
1543
1561
1544
See ``Uniques`` for further details on ``map_func``, ``reduce_func``,
1562
- ``output_processor``, and ``output_remainder_slicer ``.
1545
+ and ``output_processors ``.
1563
1546
"""
1564
1547
1565
1548
ref = DataReference (self .data_source , columns1 , condition1 )
@@ -1572,8 +1555,7 @@ def add_uniques_superset_constraint(
1572
1555
filter_func = filter_func ,
1573
1556
map_func = map_func ,
1574
1557
reduce_func = reduce_func ,
1575
- output_processor = output_processor ,
1576
- output_remainder_slicer = output_remainder_slicer ,
1558
+ output_processors = output_processors ,
1577
1559
name = name ,
1578
1560
)
1579
1561
)
@@ -1590,10 +1572,7 @@ def add_uniques_subset_constraint(
1590
1572
condition1 : Condition = None ,
1591
1573
condition2 : Condition = None ,
1592
1574
name : str = None ,
1593
- output_processor : Callable [
1594
- [Collection , Optional [Collection ]], Collection
1595
- ] = None ,
1596
- output_remainder_slicer = slice (5 ),
1575
+ output_processors : List [OutputProcessor ] = None ,
1597
1576
):
1598
1577
"""Check if the given columns's unique values in are contained in reference data.
1599
1578
@@ -1622,7 +1601,7 @@ def add_uniques_subset_constraint(
1622
1601
or if `max_relative_violations` is 0.
1623
1602
1624
1603
See ``Uniques`` for further details on ``map_func``, ``reduce_func``,
1625
- ``output_processor``, and ``output_remainder_slicer ``.
1604
+ and ``output_processors ``.
1626
1605
"""
1627
1606
1628
1607
ref = DataReference (self .data_source , columns1 , condition1 )
@@ -1636,8 +1615,7 @@ def add_uniques_subset_constraint(
1636
1615
filter_func = filter_func ,
1637
1616
map_func = map_func ,
1638
1617
reduce_func = reduce_func ,
1639
- output_processor = output_processor ,
1640
- output_remainder_slicer = output_remainder_slicer ,
1618
+ output_processors = output_processors ,
1641
1619
name = name ,
1642
1620
)
1643
1621
)
0 commit comments