Logo Search packages:      
Sourcecode: virt-manager version File versions  Download package

def virtManager::IPy::IPint::__contains__ (   self,
  item 
)

Called to implement membership test operators.

Should return true if item is in self, false otherwise. Item
can be other IP-objects, strings or ints.

>>> print IP('195.185.1.1').strHex()
0xC3B90101
>>> 0xC3B90101L in IP('195.185.1.0/24')
1
>>> '127.0.0.1' in IP('127.0.0.0/24')
1
>>> IP('127.0.0.0/24') in IP('127.0.0.0/25')
0

Definition at line 649 of file IPy.py.

00649                                 :
        """Called to implement membership test operators.

        Should return true if item is in self, false otherwise. Item
        can be other IP-objects, strings or ints.

        >>> print IP('195.185.1.1').strHex()
        0xC3B90101
        >>> 0xC3B90101L in IP('195.185.1.0/24')
        1
        >>> '127.0.0.1' in IP('127.0.0.0/24')
        1
        >>> IP('127.0.0.0/24') in IP('127.0.0.0/25')
        0
        """

        item = IP(item)
        if item.ip >= self.ip and item.ip < self.ip + self.len() - item.len() + 1:
            return 1
        else:
            return 0


    def overlaps(self, item):


Generated by  Doxygen 1.6.0   Back to index