(y)
| 256 | return str2mac(bytes(data)[:size]) |
| 257 | |
| 258 | def _resolve_ips(y): |
| 259 | # type: (List[Dict[str, Any]]) -> List[str] |
| 260 | if not isinstance(y, list): |
| 261 | return [] |
| 262 | ips = [] |
| 263 | for ip in y: |
| 264 | addr = ip['address']['address'].contents |
| 265 | if addr.si_family == socket.AF_INET6: |
| 266 | ip_key = "Ipv6" |
| 267 | si_key = "sin6_addr" |
| 268 | else: |
| 269 | ip_key = "Ipv4" |
| 270 | si_key = "sin_addr" |
| 271 | data = getattr(addr, ip_key) |
| 272 | data = getattr(data, si_key) |
| 273 | data = bytes(bytearray(data.byte)) |
| 274 | # Build IP |
| 275 | if data: |
| 276 | ips.append(inet_ntop(addr.si_family, data)) |
| 277 | return ips |
| 278 | |
| 279 | def _get_ips(x): |
| 280 | # type: (Dict[str, Any]) -> List[str] |
no test coverage detected