Checks if the given string is an address in raw bytes form.
334675
def is_binary_address(value: Any) -> bool:
    
    if not is_bytes(value):
        return False
    elif len(value) != 20:
        return False
    else:
        return True
1233515
private static String ipBytesToString(ByteBuf header, int addressLen) {
        StringBuilder sb = new StringBuilder();
        if (addressLen == 4) {
            sb.append(header.readByte() & 0xff);
            sb.append('.');
            sb.append(header.readByte() & 0xff);
            sb.append('.');
            sb.append(header.readByte() & 0xff);
            sb.append('.');
            sb.append(header.readByte() & 0xff);
        } else {
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
            sb.append(':');
            sb.append(Integer.toHexString(header.readUnsignedShort()));
        }
        return sb.toString();
    }
988981
def address(self, s):
        
        s = parseable_str(s)
        return self.p2pkh(s) or self.p2sh(s) or self.p2pkh_segwit(s) or self.p2sh_segwit(s)
106218
def stringify_address(addr, encoding='utf-8'):
    
    if isinstance(addr, bytes_type):
        return addr
    try:
        addr = addr.encode('ascii')
    except UnicodeEncodeError:
        if '@' in addr:
            localpart, domain = addr.split('@', 1)
            addr = b'@'.join([
                localpart.encode(encoding),
                domain.encode('idna'),
            ])
        else:
            addr = addr.encode(encoding)
    return addr.decode('utf-8')
205859
public static boolean isPotentiallyEncryptedString(String string) {
        checkNotNull(string, "string");

        // String is base64 encoded
        byte[] encryptedBytes;
        try {
            encryptedBytes = BaseEncoding.base64().omitPadding().decode(string);
        } catch (IllegalArgumentException e) {
            return false;
        }

        return isPotentiallyEncryptedBytes(encryptedBytes);
    }
1358875
def validate_address(value):
    
    if is_bytes(value):
        if not is_binary_address(value):
            raise InvalidAddress("Address must be 20 bytes when input type is bytes", value)
        return

    if not isinstance(value, str):
        raise TypeError('Address {} must be provided as a string'.format(value))
    if not is_hex_address(value):
        raise InvalidAddress("Address must be 20 bytes, as a hex string with a 0x prefix", value)
    if not is_checksum_address(value):
        if value == value.lower():
            raise InvalidAddress(
                "Web3.py only accepts checksum addresses. "
                "The software that gave you this non-checksum address should be considered unsafe, "
                "please file it as a bug on their platform. "
                "Try using an ENS name instead. Or, if you must accept lower safety, "
                "use Web3.toChecksumAddress(lower_case_address).",
                value,
            )
        else:
            raise InvalidAddress(
                "Address has an invalid EIP-55 checksum. "
                "After looking up the address from the original source, try again.",
                value,
            )
681670
def is_canonical_address(address: Any) -> bool:
    
    if not is_bytes(address) or len(address) != 20:
        return False
    return address == to_canonical_address(address)
4430
public static ErrorCode isAddressValid(String address){
        if (!isMustFieldValid( address, ipRegEx)) {
            return ErrorCode.SERVICE_INSTANCE_ADDRESS_FORMAT_ERROR;
        }
        return ErrorCode.OK;
    }
978169
def parse_hash(address):
    '''
    
    '''

    raw = parse(address)

    # Cash addresses
    try:
        if address.find(riemann.network.CASHADDR_PREFIX) == 0:
            if raw.find(riemann.network.CASHADDR_P2SH) == 0:
                return raw[len(riemann.network.CASHADDR_P2SH):]
            if raw.find(riemann.network.CASHADDR_P2PKH) == 0:
                return raw[len(riemann.network.CASHADDR_P2PKH):]
    except TypeError:
        pass

    # Segwit addresses
    try:
        if address.find(riemann.network.BECH32_HRP) == 0:
            if raw.find(riemann.network.P2WSH_PREFIX) == 0:
                return raw[len(riemann.network.P2WSH_PREFIX):]
            if raw.find(riemann.network.P2WPKH_PREFIX) == 0:
                return raw[len(riemann.network.P2WPKH_PREFIX):]
    except TypeError:
        pass

    # Legacy Addresses
    if raw.find(riemann.network.P2SH_PREFIX) == 0:
        return raw[len(riemann.network.P2SH_PREFIX):]
    if raw.find(riemann.network.P2PKH_PREFIX) == 0:
        return raw[len(riemann.network.P2PKH_PREFIX):]
749816
private static byte[] parseDottedQuad(String address) {
		String[] splitString = address.split("\\.");

		if (splitString.length == 4) {

			int[] ints = new int[4];
			byte[] bytes = new byte[4];
			for (int i=0; i<4; i++) {
				ints[i] = Integer.parseInt(splitString[i]);
				if (ints[i] < 0 || ints[i] > 255) {
					throw new IllegalArgumentException("Invalid ip4Address or netmask");
				}
				bytes[i] = toByte(ints[i]); //a pox on java and it's signed bytes
			}

			return bytes;
		}
		else {
			throw new IllegalArgumentException("Address must be in dotted quad notation");
		}
	}
798623
def write_byte(self, address, data):
        
        buf = [
            self.WriteCommandWord,
            address // 256,
            address % 256,
            self.EndMark,
            self.WriteCommandWord,
            data,
            0,
            self.EndMark,
            ]
        if not self.dev.write_data(buf):
            return False
        buf = self.dev.read_data(8)
        if buf is None:
            return False
        for byte in buf:
            if byte != 0xA5:
                return False
        return True
157732
def mime_encode_address string
    return string if string.ascii_only?
    string.sub(RE_ADDRESS) { |match| mime_encode($1) + $2 }
  end
1218606
private static byte readByte(boolean[] rawbits, int startIndex) {
    int n = rawbits.length - startIndex;
    if (n >= 8) {
      return (byte) readCode(rawbits, startIndex, 8);
    }
    return (byte) (readCode(rawbits, startIndex, n) << (8 - n));
  }
391992
function read_raw_string(buf, encoding) {
  var len = buf.readUInt16BE();
  return buf.toString(encoding || 'utf8', len);
}
20348
def validipaddr(address):
    
    try:
        octets = address.split('.')
        if len(octets) != 4:
            return False
        for x in octets:
            if not (0 <= int(x) <= 255):
                return False
    except ValueError:
        return False
    return True
314143
def cstring(address)
      base = base_of(address)
      len = 1
      cur = ''
      loop do
        cur << (dump(base + len - 1, len) || '')
        break if cur.index("\x00")

        len <<= 1
        return cur if cur.size != len - 1 # reached undumpable memory
      end
      cur[0, cur.index("\x00")]
    end
1320154
def from_string(address):
		
		str_address = None

		if WMACAddress.re_dash_format.match(address):
			str_address = "".join(address.split("-"))
		elif WMACAddress.re_colon_format.match(address):
			str_address = "".join(address.split(":"))
		elif WMACAddress.re_cisco_format.match(address):
			str_address = "".join(address.split("."))
		elif WMACAddress.re_spaceless_format.match(address):
			str_address = address

		if str_address is None:
			raise ValueError("Invalid MAC address format: " + address)

		result = WMACAddress()
		for octet_index in range(WMACAddress.octet_count):
			octet = str_address[:2]
			result.__address[octet_index] = int(octet, 16)
			str_address = str_address[2:]

		return result