Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(126975)

Delta Between Two Patch Sets: Lib/ipaddress.py

Issue 20480: Add ipaddress property to get reverse DNS name
Left Patch Set: Created 5 years, 9 months ago
Right Patch Set: Created 5 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/ipaddress.rst ('k') | Lib/test/test_ipaddress.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Copyright 2007 Google Inc. 1 # Copyright 2007 Google Inc.
2 # Licensed to PSF under a Contributor Agreement. 2 # Licensed to PSF under a Contributor Agreement.
3 3
4 """A fast, lightweight IPv4/IPv6 manipulation library in Python. 4 """A fast, lightweight IPv4/IPv6 manipulation library in Python.
5 5
6 This library is used to create/poke/manipulate IPv4 and IPv6 addresses 6 This library is used to create/poke/manipulate IPv4 and IPv6 addresses
7 and networks. 7 and networks.
8 8
9 """ 9 """
10 10
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 if parts[0] < parts[-1]: 1176 if parts[0] < parts[-1]:
1177 return True 1177 return True
1178 return False 1178 return False
1179 1179
1180 def _reverse_pointer(self): 1180 def _reverse_pointer(self):
1181 """Return the reverse DNS pointer name for the IPv4 address. 1181 """Return the reverse DNS pointer name for the IPv4 address.
1182 1182
1183 This implements the method described in RFC1035 3.5. 1183 This implements the method described in RFC1035 3.5.
1184 1184
1185 """ 1185 """
1186 rev_octets = str(self).split('.')[::-1] 1186 reverse_octets = str(self).split('.')[::-1]
1187 return '.'.join(rev_octets) + '.in-addr.arpa' 1187 return '.'.join(reverse_octets) + '.in-addr.arpa'
1188 1188
1189 @property 1189 @property
1190 def max_prefixlen(self): 1190 def max_prefixlen(self):
1191 return self._max_prefixlen 1191 return self._max_prefixlen
1192 1192
1193 @property 1193 @property
1194 def version(self): 1194 def version(self):
1195 return self._version 1195 return self._version
1196 1196
1197 1197
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 Note that the site-local address space has been deprecated by RFC 3879. 2173 Note that the site-local address space has been deprecated by RFC 3879.
2174 Use is_private to test if this address is in the space of unique local 2174 Use is_private to test if this address is in the space of unique local
2175 addresses as defined by RFC 4193. 2175 addresses as defined by RFC 4193.
2176 2176
2177 Returns: 2177 Returns:
2178 A boolean, True if the address is reserved per RFC 3513 2.5.6. 2178 A boolean, True if the address is reserved per RFC 3513 2.5.6.
2179 2179
2180 """ 2180 """
2181 return (self.network_address.is_site_local and 2181 return (self.network_address.is_site_local and
2182 self.broadcast_address.is_site_local) 2182 self.broadcast_address.is_site_local)
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+