~ubuntu-branches/ubuntu/trusty/ipy/trusty

« back to all changes in this revision

Viewing changes to IPy.py

  • Committer: Bazaar Package Importer
  • Author(s): Bernd Zeimetz
  • Date: 2009-11-06 14:15:48 UTC
  • mfrom: (1.1.10 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091106141548-11ujcqfn0kz2s7ky
Tags: 1:0.70-1
New upstream version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
http://software.inl.fr/trac/trac.cgi/wiki/IPy
7
7
"""
8
8
 
9
 
# $HeadURL: https://svn.inl.fr/inl-svn/src/tools/ipy/trunk/IPy.py $
10
 
# $Id: IPy.py 19001 2009-08-19 08:09:28Z haypo $
 
9
# $HeadURL: https://svn.inl.fr/inl-svn/src/tools/ipy/tags/IPy-0.70/IPy.py $
 
10
# $Id: IPy.py 19309 2009-10-29 10:21:13Z haypo $
11
11
 
12
 
__rcsid__ = '$Id: IPy.py 19001 2009-08-19 08:09:28Z haypo $'
13
 
__version__ = '0.64'
 
12
__rcsid__ = '$Id: IPy.py 19309 2009-10-29 10:21:13Z haypo $'
 
13
__version__ = '0.70'
14
14
 
15
15
import types
16
16
 
684
684
                return -1
685
685
            elif self.ip > other.ip:
686
686
                return 1
 
687
            elif self._ipversion != other._ipversion:
 
688
                # IP('0.0.0.0'), IP('::/0')
 
689
                return cmp(self._ipversion, other._ipversion)
687
690
            else:
688
691
                return 0
689
692
 
719
722
        >>> IP('10.0.0.0/8').net()
720
723
        IP('10.0.0.0')
721
724
        """
722
 
        return IP(IPint.net(self))
 
725
        return IP(IPint.net(self), ipversion=self._ipversion)
723
726
 
724
727
    def broadcast(self):
725
728
        """Return the broadcast (last) address of a network as an IP object.