<commit_before>"""
Module :mod:`nhe.imt` defines different intensity measure types.
"""

__all__ = ('PGA', 'PGV', 'PGD', 'SA', 'IA', 'RSD', 'MMI')


class _IMT(object):
    """
    Base class for intensity measure type.

    Subclasses must define __slots__ with names of parameters the specific
    intensity measure type requires.
    """
    __slots__ = ()

    def __eq__(self, other):
        """
        Two intensity measure type objects are considered equal if they
        are of the same type and have all the parameters in their
        ``__slots__`` exactly equal.
        """
        if not type(other) is type(self):
            return False
        return all(getattr(other, param) == getattr(self, param)
                   for param in type(self).__slots__)

    def __ne__(self, other):
        """
        Two intensity measure type objects are considered not equal if
        :meth:`__eq__` for them returns ``False``.
        """
        return not self.__eq__(other)

    def __hash__(self):
        """
        Object's class name as well as all the attributes from ``__slots__``
        are used for calculating object's hash. That means that objects
        that are considered :meth:`equal <__eq__>` have the same hash.
        """
        cls = type(self)
        return hash((cls.__name__, tuple(getattr(self, param)
                                         for param in cls.__slots__)))


class PGA(_IMT):
    """
    Peak ground acceleration during an earthquake measured in units
    of ``g``, times of gravitational acceleration.
    """
    __slots__ = ()


class PGV(_IMT):
    """
    Peak ground velocity during an earthquake measured in units of ``cm/sec``.
    """<commit_msg>imt: added __repr__ for all the IMTs<commit_after>"""
Module :mod:`nhe.imt` defines different intensity measure types.
"""

__all__ = ('PGA', 'PGV', 'PGD', 'SA', 'IA', 'RSD', 'MMI')


class _IMT(object):
    """
    Base class for intensity measure type.

    Subclasses must define __slots__ with names of parameters the specific
    intensity measure type requires.
    """
    __slots__ = ()

    def __eq__(self, other):
        """
        Two intensity measure type objects are considered equal if they
        are of the same type and have all the parameters in their
        ``__slots__`` exactly equal.
        """
        if not type(other) is type(self):
            return False
        return all(getattr(other, param) == getattr(self, param)
                   for param in type(self).__slots__)

    def __ne__(self, other):
        """
        Two intensity measure type objects are considered not equal if
        :meth:`__eq__` for them returns ``False``.
        """
        return not self.__eq__(other)

    def __hash__(self):
        """
        Object's class name as well as all the attributes from ``__slots__``
        are used for calculating object's hash. That means that objects
        that are considered :meth:`equal <__eq__>` have the same hash.
        """
        cls = type(self)
        return hash((cls.__name__, tuple(getattr(self, param)
                                         for param in cls.__slots__)))

    def __repr__(self):
        return '%s(%s)' % (type(self).__name__,
                           ', '.join('%s=%s' % (slot, getattr(self, slot))
                                     for slot in type(self).__slots__))


class PGA(_IMT):
    """
    Peak ground acceleration during an earthquake measured in units
    of ``g``, times of gravitational acceleration.
    """
    __slots__ = ()


class PGV(_IMT):
    """
    Peak ground velocity during an earthquake measured in units of ``cm/sec``.
    """
{'fraction_non_alphanumeric': 0.10732770362299102, 'fraction_numerical': 0.0, 'mean_word_length': 2.246684350132626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6554958', 'n_tokens_mistral': 1024, 'n_tokens_neox': 989, 'n_words': 373}