コード例 #1
0
ファイル: Partition.py プロジェクト: mrozo/PyNas
    def __eq__(self, other):
        """
        Compare the instance with other Partition instance. Comparison is based
        on list of specific attributes. If an attribute is set to None, in any
        of the instances, the attribute will not compared
        :param other: Partition class instance to be compared
        :return: False when any of compared attributes in both objects is not
                 None and both objects share the same value of the attribute,
                 otherwise True.
        :raise NotImplemented: when the other object is not instance of the
                               Partition class
        """

        #
        # todo this is not a python way of doing things
        #
        if not isinstance(other, Partition):
            raise NotImplemented

        return lazy_attributes_compare(self, other, self._PartitionsAttributes)
コード例 #2
0
ファイル: Disk.py プロジェクト: mrozo/PyNas
    def __eq__(self, other):
        # todo not a pythons way of doing things
        if not isinstance(other, Disk):
            raise NotImplemented

        return lazy_attributes_compare(self, other, self._DiskAttributes)