@@ -39,7 +39,12 @@ def __init__(
39
39
max : dt .date | None = None ,
40
40
max_exclusive : dt .date | None = None ,
41
41
resolution : str | None = None ,
42
- check : Callable [[pl .Expr ], pl .Expr ] | None = None ,
42
+ check : (
43
+ Callable [[pl .Expr ], pl .Expr ]
44
+ | list [Callable [[pl .Expr ], pl .Expr ]]
45
+ | dict [str , Callable [[pl .Expr ], pl .Expr ]]
46
+ | None
47
+ ) = None ,
43
48
alias : str | None = None ,
44
49
metadata : dict [str , Any ] | None = None ,
45
50
):
@@ -61,8 +66,17 @@ def __init__(
61
66
formatting language used by :mod:`polars` datetime ``round`` method.
62
67
For example, a value ``1mo`` expects all dates to be on the first of the
63
68
month. Note that this setting does *not* affect the storage resolution.
64
- check: A custom check to run for this column. Must return a non-aggregated
65
- boolean expression.
69
+ check: A custom rule or multiple rules to run for this column. This can be:
70
+ - A single callable that returns a non-aggregated boolean expression.
71
+ The name of the rule is derived from the callable name, or defaults to
72
+ "check" for lambdas.
73
+ - A list of callables, where each callable returns a non-aggregated
74
+ boolean expression. The name of the rule is derived from the callable
75
+ name, or defaults to "check" for lambdas. Where multiple rules result
76
+ in the same name, the suffix __i is appended to the name.
77
+ - A dictionary mapping rule names to callables, where each callable
78
+ returns a non-aggregated boolean expression.
79
+ All rule names provided here are given the prefix "check_".
66
80
alias: An overwrite for this column's name which allows for using a column
67
81
name that is not a valid Python identifier. Especially note that setting
68
82
this option does _not_ allow to refer to the column with two different
@@ -152,7 +166,12 @@ def __init__(
152
166
max : dt .time | None = None ,
153
167
max_exclusive : dt .time | None = None ,
154
168
resolution : str | None = None ,
155
- check : Callable [[pl .Expr ], pl .Expr ] | None = None ,
169
+ check : (
170
+ Callable [[pl .Expr ], pl .Expr ]
171
+ | list [Callable [[pl .Expr ], pl .Expr ]]
172
+ | dict [str , Callable [[pl .Expr ], pl .Expr ]]
173
+ | None
174
+ ) = None ,
156
175
alias : str | None = None ,
157
176
metadata : dict [str , Any ] | None = None ,
158
177
):
@@ -174,8 +193,17 @@ def __init__(
174
193
formatting language used by :mod:`polars` datetime ``round`` method.
175
194
For example, a value ``1h`` expects all times to be full hours. Note
176
195
that this setting does *not* affect the storage resolution.
177
- check: A custom check to run for this column. Must return a non-aggregated
178
- boolean expression.
196
+ check: A custom rule or multiple rules to run for this column. This can be:
197
+ - A single callable that returns a non-aggregated boolean expression.
198
+ The name of the rule is derived from the callable name, or defaults to
199
+ "check" for lambdas.
200
+ - A list of callables, where each callable returns a non-aggregated
201
+ boolean expression. The name of the rule is derived from the callable
202
+ name, or defaults to "check" for lambdas. Where multiple rules result
203
+ in the same name, the suffix __i is appended to the name.
204
+ - A dictionary mapping rule names to callables, where each callable
205
+ returns a non-aggregated boolean expression.
206
+ All rule names provided here are given the prefix "check_".
179
207
alias: An overwrite for this column's name which allows for using a column
180
208
name that is not a valid Python identifier. Especially note that setting
181
209
this option does _not_ allow to refer to the column with two different
@@ -271,7 +299,12 @@ def __init__(
271
299
max : dt .datetime | None = None ,
272
300
max_exclusive : dt .datetime | None = None ,
273
301
resolution : str | None = None ,
274
- check : Callable [[pl .Expr ], pl .Expr ] | None = None ,
302
+ check : (
303
+ Callable [[pl .Expr ], pl .Expr ]
304
+ | list [Callable [[pl .Expr ], pl .Expr ]]
305
+ | dict [str , Callable [[pl .Expr ], pl .Expr ]]
306
+ | None
307
+ ) = None ,
275
308
alias : str | None = None ,
276
309
metadata : dict [str , Any ] | None = None ,
277
310
):
@@ -293,8 +326,17 @@ def __init__(
293
326
the formatting language used by :mod:`polars` datetime ``round`` method.
294
327
For example, a value ``1h`` expects all datetimes to be full hours. Note
295
328
that this setting does *not* affect the storage resolution.
296
- check: A custom check to run for this column. Must return a non-aggregated
297
- boolean expression.
329
+ check: A custom rule or multiple rules to run for this column. This can be:
330
+ - A single callable that returns a non-aggregated boolean expression.
331
+ The name of the rule is derived from the callable name, or defaults to
332
+ "check" for lambdas.
333
+ - A list of callables, where each callable returns a non-aggregated
334
+ boolean expression. The name of the rule is derived from the callable
335
+ name, or defaults to "check" for lambdas. Where multiple rules result
336
+ in the same name, the suffix __i is appended to the name.
337
+ - A dictionary mapping rule names to callables, where each callable
338
+ returns a non-aggregated boolean expression.
339
+ All rule names provided here are given the prefix "check_".
298
340
alias: An overwrite for this column's name which allows for using a column
299
341
name that is not a valid Python identifier. Especially note that setting
300
342
this option does _not_ allow to refer to the column with two different
@@ -380,7 +422,12 @@ def __init__(
380
422
max : dt .timedelta | None = None ,
381
423
max_exclusive : dt .timedelta | None = None ,
382
424
resolution : str | None = None ,
383
- check : Callable [[pl .Expr ], pl .Expr ] | None = None ,
425
+ check : (
426
+ Callable [[pl .Expr ], pl .Expr ]
427
+ | list [Callable [[pl .Expr ], pl .Expr ]]
428
+ | dict [str , Callable [[pl .Expr ], pl .Expr ]]
429
+ | None
430
+ ) = None ,
384
431
alias : str | None = None ,
385
432
metadata : dict [str , Any ] | None = None ,
386
433
):
@@ -402,8 +449,17 @@ def __init__(
402
449
the formatting language used by :mod:`polars` datetime ``round`` method.
403
450
For example, a value ``1h`` expects all durations to be full hours. Note
404
451
that this setting does *not* affect the storage resolution.
405
- check: A custom check to run for this column. Must return a non-aggregated
406
- boolean expression.
452
+ check: A custom rule or multiple rules to run for this column. This can be:
453
+ - A single callable that returns a non-aggregated boolean expression.
454
+ The name of the rule is derived from the callable name, or defaults to
455
+ "check" for lambdas.
456
+ - A list of callables, where each callable returns a non-aggregated
457
+ boolean expression. The name of the rule is derived from the callable
458
+ name, or defaults to "check" for lambdas. Where multiple rules result
459
+ in the same name, the suffix __i is appended to the name.
460
+ - A dictionary mapping rule names to callables, where each callable
461
+ returns a non-aggregated boolean expression.
462
+ All rule names provided here are given the prefix "check_".
407
463
alias: An overwrite for this column's name which allows for using a column
408
464
name that is not a valid Python identifier. Especially note that setting
409
465
this option does _not_ allow to refer to the column with two different
0 commit comments