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