File tree Expand file tree Collapse file tree 2 files changed +13
-17
lines changed Expand file tree Collapse file tree 2 files changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ be enabled by hooking in a format-checking object into an :class:`IValidator`.
183
183
184
184
.. autoclass :: FormatChecker
185
185
:members:
186
+ :exclude-members: cls_checks
186
187
187
188
.. attribute :: checkers
188
189
@@ -191,6 +192,16 @@ be enabled by hooking in a format-checking object into an :class:`IValidator`.
191
192
for all checkers using the :meth: `FormatChecker.checks ` or
192
193
:meth: `FormatChecker.cls_checks ` decorators respectively.
193
194
195
+ .. method :: cls_checks(format)
196
+
197
+ Register a decorated function as *globally * validating a new format.
198
+
199
+ Any instance created after this function is called will pick up the
200
+ supplied checker.
201
+
202
+ :argument str format: the format that the decorated function will check
203
+
204
+
194
205
195
206
There are a number of default checkers that :class: `FormatChecker `\s know how
196
207
to validate. Their names can be viewed by inspecting the
Original file line number Diff line number Diff line change @@ -517,23 +517,6 @@ def __init__(self, formats=None):
517
517
else :
518
518
self .checkers = dict ((k , self .checkers [k ]) for k in formats )
519
519
520
- @classmethod
521
- def cls_checks (cls , format ):
522
- """
523
- Register a decorated function as *globally* validating a new format.
524
-
525
- Any instance created after this function is called will pick up the
526
- supplied checker.
527
-
528
- :argument str format: the format that the decorated function will check
529
-
530
- """
531
-
532
- def _checks (func ):
533
- cls .checkers [format ] = func
534
- return func
535
- return _checks
536
-
537
520
def checks (self , format ):
538
521
"""
539
522
Register a decorated function as validating a new format.
@@ -547,6 +530,8 @@ def _checks(func):
547
530
return func
548
531
return _checks
549
532
533
+ cls_checks = classmethod (checks )
534
+
550
535
def conforms (self , instance , format ):
551
536
"""
552
537
Check whether the instance conforms to the given format.
You can’t perform that action at this time.
0 commit comments