Returns true if resembles hex data but definitely not a valid address.
965830
function resemblesData (string) {
  const fixed = ethUtil.addHexPrefix(string)
  const isValidAddress = ethUtil.isValidAddress(fixed)
  return !isValidAddress && isValidHex(string)
}
1724
def _valid_ip(ip_address):
    '''
    
    '''

    try:
        address = ipaddress.IPv4Address(ip_address)
    except ipaddress.AddressValueError:
        return False

    if address.is_unspecified or \
        address.is_loopback or \
        address.is_link_local or \
        address.is_multicast or \
        address.is_reserved:
        return False

    return True
1353123
public boolean isMatch(String address)
  {
    try {
      return isMatch(InetAddress.getByName(address));
    } catch (Exception e) {
      log.log(Level.FINER, e.toString(), e);

      return false;
    }
  }
165560
def validateaddress(self, address: str) -> bool:
        ""

        try:
            Address.from_string(address, self.network_properties)
        except InvalidAddress:
            return False

        return True
581171
public static void validateAddress(String address) {
		// Check for improperly formatted addresses
		Matcher matcher = ADDRESS_PATTERN.matcher(address);
		if(!matcher.matches()) {
			String message = "The address must have the format X.X.X.X";
			throw new IllegalArgumentException(message);
		}

		// Check for out of range address components
		for(int i = 1; i <= 4; i++) {
			int component = Integer.parseInt(matcher.group(i));
			if(component < 0 || component > 255) {
				String message = "All address components must be in the range [0, 255]";
				throw new IllegalArgumentException(message);
			}
		}
	}
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)
480408
public boolean validateHexColor(String hexColor, DiagnosticChain diagnostics, Map<Object, Object> context) {
		boolean result = validateHexColor_Pattern(hexColor, diagnostics, context);
		return result;
	}
880691
private boolean isTypeValid(char type) {
		return (type == MAPPED_ADDRESS || type == RESPONSE_ADDRESS
				|| type == SOURCE_ADDRESS || type == CHANGED_ADDRESS
				|| type == REFLECTED_FROM || type == XOR_MAPPED_ADDRESS
				|| type == ALTERNATE_SERVER || type == XOR_PEER_ADDRESS
				|| type == XOR_RELAYED_ADDRESS || type == DESTINATION_ADDRESS);
	}
682557
private function validateIPNumber(): bool
    {
        $value = $this->value;

        if (\preg_match('/^([01]{8}\.){3}[01]{8}$/', $this->value)) {
            // binary format 00000000.00000000.00000000.00000000
            $value = \sprintf(
                '%s.%s.%s.%s',
                \bindec(\substr($this->value, 0, 8)),
                \bindec(\substr($this->value, 9, 8)),
                \bindec(\substr($this->value, 18, 8)),
                \bindec(\substr($this->value, 27, 8))
            );
        } elseif (\preg_match('/^([0-9a-f]{2}\.){3}[0-9a-f]{2}$/i', $this->value)) {
            // hex format ff.ff.ff.ff
            $value = \sprintf(
                '%s.%s.%s.%s',
                \hexdec(\substr($this->value, 0, 2)),
                \hexdec(\substr($this->value, 3, 2)),
                \hexdec(\substr($this->value, 6, 2)),
                \hexdec(\substr($this->value, 9, 2))
            );
        }
        $flags = 0;
        if ($this->options['allow-ipv4'] === true) {
            $flags |= FILTER_FLAG_IPV4;
        }
        if ($this->options['allow-ipv6'] === true) {
            $flags |= FILTER_FLAG_IPV6;
        }
        $isValid = \filter_var($value, FILTER_VALIDATE_IP, ['flags' => $flags]) !== false ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_IP_INVALID_NUMBER);
        }
        return $isValid;
    }
475858
def addr(self,address):
        ''''''
        if isinstance(address,basestring):
            # If you just gave me a single string, assume its "XXXX XXXX"
            addr = address.split()
        else:
            addr = list(address)
        # Convert to actual hex if you give me strings
        for i in xrange(len(addr)):
            if isinstance(addr[i],basestring):
                addr[i] = int(addr[i],16)
        for frame in self.raw_frames:
            if frame['addr']==address:
                return frame
1117571
def validatepubkey(pub):
    '''
    
    '''

    try:
        pub = hexstrlify(unhexlify(pub))
    except:
        return False
    if len(pub) == 130:
        if pub[:2] != '04':
            return False
        if uncompress(compress(pub)) != pub:
            return False
    elif len(pub) == 66:
        if pub[:2] != '02' and pub[:2] != '03':
            return False
    else:
        return False
    return pub
1240679
public static boolean isValidEmail(Object value) {

	InternetAddress addr = parseEmail(value, null);

	if (addr != null) {

	    String address = addr.getAddress();

	    if (address.contains("..")) return false;

	    int pos = address.indexOf('@');

	    if (pos < 1 || pos == address.length() - 1) return false;

	    String local = address.substring(0, pos);
	    String domain = address.substring(pos + 1);

	    if (domain.charAt(0) == '.' || local.charAt(0) == '.' || local.charAt(local.length() - 1) == '.') return false;

	    pos = domain.lastIndexOf('.');

	    if (pos > 0 && pos < domain.length() - 2) { // test TLD to be at
							// least 2 chars all
							// alpha characters
		if (StringUtil.isAllAlpha(domain.substring(pos + 1))) return true;
		try {
		    addr.validate();
		    return true;
		}
		catch (AddressException e) {}
	    }
	}

	return false;
    }
494842
def has_valid_padding(value, bits=7):
        """"""

        assert bits <= 8

        mask = (((1 << (8 - bits)) - 1) << bits)

        if isinstance(value, integer_types):
            while value:
                if value & mask:
                    return False
                value >>= 8
        elif isinstance(value, bytes):
            for byte in bytearray(value):
                if byte & mask:
                    return False
        else:
            raise TypeError

        return True
483628
def _check_valid_data(self, data):
        
        if data.dtype.type is not np.float32 and \
           data.dtype.type is not np.float64:
            raise ValueError(
                'Illegal data type. RGB-D images only support float arrays')

        if len(data.shape) != 3 and data.shape[2] != 4:
            raise ValueError(
                'Illegal data type. RGB-D images only support four channel')

        color_data = data[:, :, :3]
        if np.any((color_data < 0) | (color_data > BINARY_IM_MAX_VAL)):
            raise ValueError(
                'Color channels must be in the range (0, BINARY_IM_MAX_VAL)')
1116480
def valid_address(address):
    
    if not address:
        return False

    components = str(address).split(':')
    if len(components) > 2 or not valid_hostname(components[0]):
        return False

    if len(components) == 2 and not valid_port(components[1]):
        return False

    return True
263760
function needsHexEscape(character) {
  return !((0x00020 <= character && character <= 0x00007E) ||
           (0x00085 === character)                         ||
           (0x000A0 <= character && character <= 0x00D7FF) ||
           (0x0E000 <= character && character <= 0x00FFFD) ||
           (0x10000 <= character && character <= 0x10FFFF));
}
368659
def neo_get_scripthash_from_address(address):
    
    hash_bytes = binascii.hexlify(base58.b58decode_check(address))
    return reverse_hex(hash_bytes[2:].decode('utf-8'))