def validate_type(self, value):
        """Raise TypeError if type of value isn't allowed."""
        ### if value isn't of specified type...

        if type(value) not in self.num_classes:

            msg = ("'value' must be of one of the following" " types: {}").format(
                self.num_classes
            )

            ## if None is allowed...

            if self.allow_none:

                # if despite being allowed, the value is
                # not None, raise an error

                if value is not None:
                    raise TypeError(msg + " or 'NoneType'")

            ## otherwise, since the value isn't of the
            ## specified type and None is not allowed
            else:
                raise TypeError(msg)

        if value in INFS_AND_NANS:
            raise ValueError("Can't use inf/-inf/nan")
Raise TypeError if type of value isn't allowed.
nodezator/widget/intfloatentry/op.py