diff options
| author | Bob Halley <halley@dnspython.org> | 2018-12-09 12:06:24 -0800 |
|---|---|---|
| committer | Bob Halley <halley@dnspython.org> | 2018-12-09 12:06:24 -0800 |
| commit | 129f9e79ff508e36bac08fd588769525d9214a57 (patch) | |
| tree | 8d5c0dc44ef1e232d1e87e38f1c777aba74c81ff /dns/ipv4.py | |
| parent | a0a975bc26728996313425ad4ba8b1281849153c (diff) | |
| download | dnspython-129f9e79ff508e36bac08fd588769525d9214a57.tar.gz | |
Remove _compat module.
Diffstat (limited to 'dns/ipv4.py')
| -rw-r--r-- | dns/ipv4.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/dns/ipv4.py b/dns/ipv4.py index 8fc4f7d..c35775b 100644 --- a/dns/ipv4.py +++ b/dns/ipv4.py @@ -20,14 +20,13 @@ import struct import dns.exception -from ._compat import binary_type def inet_ntoa(address): """Convert an IPv4 address in binary form to text form. - *address*, a ``binary``, the IPv4 address in binary form. + *address*, a ``bytes``, the IPv4 address in binary form. - Returns a ``text``. + Returns a ``str``. """ if len(address) != 4: @@ -40,12 +39,12 @@ def inet_ntoa(address): def inet_aton(text): """Convert an IPv4 address in text form to binary form. - *text*, a ``text``, the IPv4 address in textual form. + *text*, a ``str``, the IPv4 address in textual form. - Returns a ``binary``. + Returns a ``bytes``. """ - if not isinstance(text, binary_type): + if not isinstance(text, bytes): text = text.encode() parts = text.split(b'.') if len(parts) != 4: @@ -57,7 +56,7 @@ def inet_aton(text): # No leading zeros raise dns.exception.SyntaxError try: - bytes = [int(part) for part in parts] - return struct.pack('BBBB', *bytes) + b = [int(part) for part in parts] + return struct.pack('BBBB', *b) except: raise dns.exception.SyntaxError |
