@@ -389,7 +389,9 @@ Here are three practical data validation utilities:
389
389
390
390
def validate(self, value):
391
391
if value not in self.options:
392
- raise ValueError(f'Expected {value!r} to be one of {self.options!r}')
392
+ raise ValueError(
393
+ f'Expected {value!r} to be one of {self.options!r}'
394
+ )
393
395
394
396
class Number(Validator):
395
397
@@ -469,6 +471,7 @@ The descriptors prevent invalid instances from being created:
469
471
Traceback (most recent call last):
470
472
...
471
473
ValueError: Expected -5 to be at least 0
474
+
472
475
>>> Component(' WIDGET' , ' metal' , ' V' ) # Blocked: 'V' isn't a number
473
476
Traceback (most recent call last):
474
477
...
@@ -1004,7 +1007,6 @@ here is a pure Python equivalent that implements most of the core functionality:
1004
1007
if doc is None and fget is not None:
1005
1008
doc = fget.__doc__
1006
1009
self.__doc__ = doc
1007
- self.__name__ = ''
1008
1010
1009
1011
def __set_name__(self, owner, name):
1010
1012
self.__name__ = name
@@ -1303,8 +1305,8 @@ mean, median, and other descriptive statistics that depend on the data. However,
1303
1305
there may be useful functions which are conceptually related but do not depend
1304
1306
on the data. For instance, ``erf(x) `` is handy conversion routine that comes up
1305
1307
in statistical work but does not directly depend on a particular dataset.
1306
- It can be called either from an object or the class: ``s.erf(1.5) --> .9332 `` or
1307
- ``Sample.erf(1.5) --> .9332 ``.
1308
+ It can be called either from an object or the class: ``s.erf(1.5) --> 0 .9332 ``
1309
+ or ``Sample.erf(1.5) --> 0 .9332 ``.
1308
1310
1309
1311
Since static methods return the underlying function with no changes, the
1310
1312
example calls are unexciting:
0 commit comments