File: mixins.py

package info (click to toggle)
python-geoip2 2.9.0%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 572 kB
  • sloc: python: 1,224; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""This package contains utility mixins"""
# pylint: disable=too-few-public-methods
from abc import ABCMeta


class SimpleEquality(object):
    """Naive __dict__ equality mixin"""

    __metaclass__ = ABCMeta

    def __eq__(self, other):
        return (isinstance(other, self.__class__)
                and self.__dict__ == other.__dict__)

    def __ne__(self, other):
        return not self.__eq__(other)