@@ -28,13 +28,12 @@ class FormatChecker:
2828 `FormatChecker` objects always return ``True`` when asked about
2929 formats that they do not know how to validate.
3030
31- To check a custom format using a function that takes an instance and
32- returns a ``bool``, use the `FormatChecker.checks` or
33- `FormatChecker.cls_checks` decorators.
31+ To add a check for a custom format use the `FormatChecker.checks`
32+ decorator.
3433
3534 Arguments:
3635
37- formats (~collections.abc.Iterable) :
36+ formats:
3837
3938 The known formats to validate. This argument can be used to
4039 limit which formats will be used during validation.
@@ -47,9 +46,8 @@ class FormatChecker:
4746
4847 def __init__ (self , formats : typing .Iterable [str ] | None = None ):
4948 if formats is None :
50- self .checkers = self .checkers .copy ()
51- else :
52- self .checkers = dict ((k , self .checkers [k ]) for k in formats )
49+ formats = self .checkers .keys ()
50+ self .checkers = {k : self .checkers [k ] for k in formats }
5351
5452 def __repr__ (self ):
5553 return "<FormatChecker checkers={}>" .format (sorted (self .checkers ))
@@ -62,11 +60,11 @@ def checks(
6260
6361 Arguments:
6462
65- format (str) :
63+ format:
6664
6765 The format that the decorated function will check.
6866
69- raises (Exception) :
67+ raises:
7068
7169 The exception(s) raised by the decorated function when an
7270 invalid instance is found.
@@ -117,7 +115,7 @@ def check(self, instance: object, format: str) -> None:
117115
118116 The instance to check
119117
120- format (str) :
118+ format:
121119
122120 The format that instance should conform to
123121
@@ -150,7 +148,7 @@ def conforms(self, instance: object, format: str) -> bool:
150148
151149 The instance to check
152150
153- format (str) :
151+ format:
154152
155153 The format that instance should conform to
156154
0 commit comments