Calculate address from an API with an address default
773800
@Override
  public String address(Class<?> api, String address)
  {
    Objects.requireNonNull(address);

    if (address.isEmpty()) {
      address = addressDefault(api);
    }
    
    int slash = address.indexOf("/");
    //int colon = address.indexOf(":");

    if (address.endsWith(":") && slash < 0) {
      address += "//";
    }

    int p = address.indexOf("://");
    int q = -1;

    if (p > 0) {
      q = address.indexOf('/', p + 3);
    }
    
    if (address.indexOf('{') > 0) {
      return addressBraces(api, address);
    }

    boolean isPrefix
      = address.startsWith("session:") || address.startsWith("pod:"); 

    if (address.isEmpty()
        || p > 0 && q < 0 && isPrefix) {
      if (Vault.class.isAssignableFrom(api)) {
        TypeRef itemRef = TypeRef.of(api).to(Vault.class).param("T");
        
        Class<?> assetClass = itemRef.rawClass();

        address = address + "/" + apiAddress(assetClass);
      }
      else {
        address = address + "/" + apiAddress(api);
      }
    }
    
    return address;
  }
746382
def _parse_address(self, address_string):
        ''''''
        match = utils.match(self.rules, address_string, flags=re.VERBOSE | re.U)
        if match:
            match_as_dict = match.groupdict()
            match_as_dict.update({'country_id': self.country})
            # combine results
            cleaned_dict = self._combine_results(match_as_dict)
            # create object containing results
            return address.Address(**cleaned_dict)

        return False
1331358
function formatAddress(address) {
  const result = address
  if (result) {
    result.formatted =
      `${result.street_address}\n${result.postal_code} ${result.locality}\n${result.country}`
    return result
  }
  return null
}
449812
function defaultApikey(apikey) {
    if (typeof apikey !== 'undefined') {
        if (typeof apikey !== 'string') {
            throw new TypeError('`apikey` argument must be a string');
        }

        if (apikey.length !== 24) {
            throw new TypeError('`apikey` argument must be 24 characters long');
        }

        return apikey;
    }
    throw new TypeError('Gandi client needs an apikey as a first argument');
}
627988
def _parse_address(self, val):
        

        ret = {
            'type': None,
            'value': None
        }

        try:

            ret['type'] = val[1]['type']

        except (KeyError, ValueError, TypeError):

                pass

        try:

            ret['value'] = val[1]['label']

        except (KeyError, ValueError, TypeError):

            ret['value'] = '\n'.join(val[3]).strip()

        try:

            self.vars['address'].append(ret)

        except AttributeError:

            self.vars['address'] = []
            self.vars['address'].append(ret)
1367424
def eth_getCode(self, address, default_block=BLOCK_TAG_LATEST):
        
        if isinstance(default_block, str):
            if default_block not in BLOCK_TAGS:
                raise ValueError
        return self._call("eth_getCode", [address, default_block])
1063535
def parse_bind_address(address, default=('localhost', 8080)):
    
    if ':' in address:
        host, port = address.split(':', 1)
        port = int(port)
    elif re.match('^\d+$', address):
        host = default[0]
        port = int(address)
    else:
        host = address
        port = default[1]
    return host, port
381339
def parse_address(self, address_line):
        
        params = {"term": address_line}
        json = self._make_request('/address/getParsedAddress', params)
        if json is None:
            return None
        return Address.from_json(json)
283698
def fromAddress(address):
        
        validate_address(address)
        address_as_integer = int(address, 16)
        address_as_base36 = baseN(address_as_integer, 36)
        padded = pad_left_hex(address_as_base36, 15)
        return Iban.fromBban(padded.upper())
297267
function getAddressNetwork (address) {
  const prefix = base58.decode(address).toString('hex').substring(0, 2).toUpperCase()
  const networkKey = findKey(networks,
    network => [network.pubKeyHash, network.scriptHash].includes(prefix))
  return networks[networkKey]
}
697127
def get_address(self, address):
        
        
        params = self.build_basic_request()
        params['address'] = address

        response = util.call_api("merchant/{0}/address_balance".format(self.identifier), params,
                                 base_url=self.service_url)
        json_response = json.loads(response)
        self.parse_error(json_response)
        return Address(json_response['balance'],
                       json_response['address'],
                       None,
                       json_response['total_received'])
342545
def payments_for_address(self, address):
        ""
        URL = self.api_domain + ("/address/%s?format=json" % address)
        d = urlopen(URL).read()
        json_response = json.loads(d.decode("utf8"))
        response = []
        for tx in json_response.get("txs", []):
            total_out = 0
            for tx_out in tx.get("out", []):
                if tx_out.get("addr") == address:
                    total_out += tx_out.get("value", 0)
            if total_out > 0:
                response.append((tx.get("hash"), total_out))
        return response
1295497
function getAddress(addressInput) {
  var address = addressInput; // eslint-disable-line
  var result = null; // eslint-disable-line

  if (typeof(address) !== 'string') { throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`); }

  // Missing the 0x prefix
  if (address.substring(0, 2) !== '0x' &&
      address.substring(0, 2) !== 'XE') { address = `0x${address}`; }

  if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
    result = getChecksumAddress(address);

    // It is a checksummed address with a bad checksum
    if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
      throw new Error('[ethjs-account] invalid address checksum');
    }

  // Maybe ICAP? (we only support direct mode)
  } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
    throw new Error('[ethjs-account] ICAP and IBAN addresses, not supported yet..');

    /*
    // It is an ICAP address with a bad checksum
    if (address.substring(2, 4) !== ibanChecksum(address)) {
      throw new Error('invalid address icap checksum');
    }

    result = (new BN(address.substring(4), 36)).toString(16);
    while (result.length < 40) { result = '0' + result; }
    result = getChecksumAddress('0x' + result);
    */
  } else {
    throw new Error(`[ethjs-account] invalid address value ${JSON.stringify(address)} not a valid hex string`);
  }

  return result;
}
389166
function getCanonicalAddress(addresses) {
  // We suppose that the addresses are all valid, and therefore use loose regex
  for (var i = 0; i < addresses.length; i++) {
    var addresse = addresses[i];
    if ((/^127(\.\d{1,3}){3}$/.test(addresse.host)) || (/0?:?0?:?0?:?0?:?0?:?0?:0?:1/.test(addresse.host))) {
      addresse.value = 0;
    }
    else if ((net.isIPv6(addresse.host)) && (/^[fF]|[eE]80:.*\:.*\:/.test(addresse.host))) {
      addresse.value = 1;
    }
    else if (/^169\.254\.\d{1,3}\.\d{1,3}$/.test(addresse.host)) {
      addresse.value = 2;
    }
    else if (/^192\.168\.\d{1,3}\.\d{1,3}$/.test(addresse.host)) {
      addresse.value = 3;
    }
    else if (/^172\.(1\d|2\d|30|31)\.\d{1,3}\.\d{1,3}$/.test(addresse.host)) {
      addresse.value = 4;
    }
    else if (/^10(\.\d{1,3}){3}$/.test(addresse.host)) {
      addresse.value = 5;
    }
    else if ((net.isIPv6(addresse.host)) && (/^[fF]|[cCdD].*\:.*\:/.test('addresse.host'))) {
      addresse.value = 6;
    }
    else {
      addresse.value = 7;
    }
  }
  var result = addresses[0];
  var max = addresses[0].value;
  for (var z = 0; z < addresses.length; z++) {
    if (addresses[z].value > max) {
      result = addresses[z];
      max = addresses[z].value;
    }
  }
  return result;
}
259477
function checkAddressBalance(url, address, options) {
  options = options || {};
  let path = '/address/.../balance'.replace('...', address);
  url = resolveURL(url, path);

  return new P(function (resolve, reject) {
    request({
      url: url,
      method: 'GET',
      headers: options.headers
    }, function (err, res, body) {
      if (err) return reject(err);
      return resolve(body);
    });
  });
}
505472
def from_(self) -> Optional[Sequence[AddressHeader]]:
        """"""
        try:
            return cast(Sequence[AddressHeader], self[b'from'])
        except KeyError:
            return None
288521
function getDefaultRoute() {
  try {
    const fileContents = fs.readFileSync('/proc/net/route', 'utf8'); // eslint-disable-line no-sync
    const routes = fileContents.split('\n');
    for (const routeIdx in routes) {
      const fields = routes[routeIdx].trim().split('\t');
      if (fields[1] === '00000000') {
        const address = fields[2];
        // Convert to little endian by splitting every 2 digits and reversing that list
        const littleEndianAddress = address.match(/.{2}/g).reverse().join('');
        return intToIP(parseInt(littleEndianAddress, 16));
      }
    }
  } catch (e) {
    console.error('Could not get default route from /proc/net/route');
  }
  return null;
}