Make max value IP address errors consistent

Attempt to display the same or similar messages everywhere we are
checking the upper bounds of an IP address.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Add constants for max IPv4 and IPv6 addresses

Use them where appropriate for error message display, various
comparisons, etc. where before we used the 0xfff... and 0x1000...
values directly.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Remove all usages of hex() builtin

We did a lot of stuff to make this value useful, and it wasn't even
consistent everywhere:

* Removal of the 0x prefix
* Removal of the 'L' suffix (or sometimes 'l')
* Lowercasing of the string

Instead, take advantage of the '%x' operator which will always print an
integer value in hex using lowercase characters, no '0x' prefix, and
never an 'L' suffix.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Various small cleanups

* Extend object so we get a new-style class in Python 2
* Small typos in documentation
* Consistency fixups in dict declaration
* One additional IPv6 test for strBin()
* Remove unneeded import

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Allow doctest runner to keep going after failures

It will still return an error code, but there is little need to halt the
running of the three different doctest modules if an early one fails,
which may in fact mask the real reason for failure in an IPy internal
method.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Use _ipVersionToLen() wherever possible

The logic and error raising this function does for us was duplicated in
a lot of places. Use it whenever possible to remove duplicate code and
simplify behavior.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Makefile: fix PHONY target list

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Make address parsing a bit more consistent

We had funny things where ValueErrors would be thrown from different
places if you passed in clearly invalid but similar bad addresses, e.g.,
'xx' and 'foobar' would yield very different error messages.

Attempt to do the numeric parsing upfront and don't depend so much on
the length of the string to calculate what branch we drop into. Add a
catch-all ValueError at the end that indicates the string could not be
parsed instead.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Don't delete README in the Makefile

Silly given that README is checked into source control and immediately
needed in some build targets.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Remove remnants of 'l' suffix stripping

This is leftover from when we used hex() to print long integers, and may
have needed to strip the .lower() 'l' suffix that remained.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Prevent errors when comparing to non-IP values
Merge various cleanups from https://github.com/toofishes/python-ipy

Conflicts:
	IPy.py
Fix several issues with adding IP ranges

* Prevents non-adjacent ranges from being added
* Prevents creating invalid subnets
* Fixes a bug where the integer value of an IPv6 address that is less than
  32 bits would be treated as an IPv4 address during addition.
add IPSet; add IPint().__sub__, move IP.__add__ to IPint().__add__
Cleanup ChangeLog format; add missing notes