def validate(self, value):
if value not in self.options:
- raise ValueError(f'Expected {value!r} to be one of {self.options!r}')
+ raise ValueError(
+ f'Expected {value!r} to be one of {self.options!r}'
+ )
class Number(Validator):
Traceback (most recent call last):
...
ValueError: Expected -5 to be at least 0
+
>>> Component('WIDGET', 'metal', 'V') # Blocked: 'V' isn't a number
Traceback (most recent call last):
...
if doc is None and fget is not None:
doc = fget.__doc__
self.__doc__ = doc
- self.__name__ = ''
def __set_name__(self, owner, name):
self.__name__ = name
there may be useful functions which are conceptually related but do not depend
on the data. For instance, ``erf(x)`` is handy conversion routine that comes up
in statistical work but does not directly depend on a particular dataset.
-It can be called either from an object or the class: ``s.erf(1.5) --> .9332`` or
-``Sample.erf(1.5) --> .9332``.
+It can be called either from an object or the class: ``s.erf(1.5) --> 0.9332``
+or ``Sample.erf(1.5) --> 0.9332``.
Since static methods return the underlying function with no changes, the
example calls are unexciting: