Parses Address Component into a single layer Object
771473
function parseAddressComponents(components, short = Options.short) {
  const results = {}
  components.map(component => {
    if (short) { results[component.types[0]] = component.short_name
    } else { results[component.types[0]] = component.long_name }
  })
  return results
}
1148479
function parseNode(line) {
  current = {
    is : 'NODE',
    type : 'NODE',
    id : line.substr(10, 10).trim().toLowerCase(),
    initialStorage : line.substr(20, 10).trim(),
    areaCapfactor : line.substr(30, 10).trim(),
    endingStorage : line.substr(40, 10).trim()
  };
}
79561
private ModelNode parseAddress(final String profileName, final String inputAddress) {
        final ModelNode result = new ModelNode();
        if (profileName != null) {
            result.add(ServerOperations.PROFILE, profileName);
        }
        String[] parts = inputAddress.split(",");
        for (String part : parts) {
            String[] address = part.split("=");
            if (address.length != 2) {
                throw new RuntimeException(part + " is not a valid address segment");
            }
            result.add(address[0], address[1]);
        }
        return result;
    }
822172
function parseAddresses() {
  var addresses = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

  return (0, _ramda.flatten)([].concat(addresses).map(function (address) {
    if (address && address.address) {
      address = convertAddresses(address);
    }
    return (0, _emailjsAddressparser2.default)(address);
  }));
}
1348285
def _ParseIndexTable(self, file_object):
    
    cache_address_map = self._GetDataTypeMap('uint32le')
    file_offset = file_object.get_offset()

    cache_address_data = file_object.read(4)

    while len(cache_address_data) == 4:
      try:
        value = self._ReadStructureFromByteStream(
            cache_address_data, file_offset, cache_address_map)
      except (ValueError, errors.ParseError) as exception:
        raise errors.ParseError((
            'Unable to map cache address at offset: 0x{0:08x} with error: '
            '{1!s}').format(file_offset, exception))

      if value:
        cache_address = CacheAddress(value)
        self.index_table.append(cache_address)

      file_offset += 4

      cache_address_data = file_object.read(4)
998959
public static ModelNode getParentAddress(final ModelNode address) {
        if (address.getType() != ModelType.LIST) {
            throw new IllegalArgumentException("The address type must be a list.");
        }
        final ModelNode result = new ModelNode();
        final List<Property> addressParts = address.asPropertyList();
        if (addressParts.isEmpty()) {
            throw new IllegalArgumentException("The address is empty.");
        }
        for (int i = 0; i < addressParts.size() - 1; ++i) {
            final Property property = addressParts.get(i);
            result.add(property.getName(), property.getValue());
        }
        return result;
    }
1300670
def parse_address(address)
      case address
      when Hash
        Addressable::URI.new(address)
      when String
        Addressable::URI.parse(address)
      else
        raise(InvalidConfig,"invalid address: #{address.inspect}",caller)
      end
    end
662991
function Address(address) {
	this.houseCode = null;
	this.unitCode = null;

	try {
		switch (typeof address) {
		case "object":
			if (_.isArray(address) && address.length === 2) {
				this.houseCode = new HouseCode(address[0]);
				this.unitCode = new UnitCode(address[1]);
			} else {
				if (address.houseCode !== undefined && address.houseCode !== null) {
					this.houseCode = new HouseCode(address.houseCode);
				}
				if (address.unitCode !== undefined && address.unitCode !== null) {
					this.unitCode = new UnitCode(address.unitCode);
				}
			}
			break;
		case "string":
			try {
				address = JSON.parse(address);
				if (address.hasOwnProperty("houseCode") && address.houseCode !== null) {
					this.houseCode = new HouseCode(address.houseCode);
				}
				if (address.hasOwnProperty("unitCode") && address.unitCode !== null) {
					this.unitCode = new UnitCode(address.unitCode);
				}
			} catch (e) {
				this.houseCode = new HouseCode((address.toUpperCase().match(/[A-P]+/)||[null])[0]);
				this.unitCode = new UnitCode((address.match(/\d+/)||[null])[0]);
			}
			break;
		case "number":
			this.houseCode = new HouseCode(address>>>4);
			this.unitCode = new UnitCode(address&0x0F);
			break;
		default:
			throw new Error("Invalid address.");
			break;
		}
	} catch (e) {
		throw new Error('Address out of range.');
	}
}
616234
def parse_conference_address(address_string):
    

    geo_elements = address_string.split(',')
    city = geo_elements[0]
    country_name = geo_elements[-1].upper().replace('.', '').strip()
    us_state = None
    state = None
    country_code = None

    # Try to match the country
    country_code = match_country_name_to_its_code(country_name, city)

    if country_code == 'US' and len(geo_elements) > 1:
        us_state = match_us_state(geo_elements[-2].upper().strip()
                                  .replace('.', ''))

    if not country_code:
        # Sometimes the country name stores info about U.S. state
        us_state = match_us_state(country_name)

    if us_state:
        state = us_state
        country_code = 'US'

    return {
        'cities': [
            city,
        ],
        'country_code': country_code,
        'postal_code': None,
        'state': state,
    }
1157963
function parse (input) {
  var parts = input.split(';');
  var _ = parts.pop();
  var srid = (parts.shift() || '').split('=').pop();

  var i = 0;

  function $ (re) {
    var match = _.substring(i).match(re);
    if (!match) return null;
    else {
      i += match[0].length;
      return match[0];
    }
  }

  function crs (obj) {
    if (obj && srid.match(/\d+/)) {
      obj.crs = {
        type: 'name',
        properties: {
          name: 'urn:ogc:def:crs:EPSG::' + srid
        }
      };
    }

    return obj;
  }

  function white () { $(/^\s*/); }

  function multicoords () {
    white();
    var depth = 0;
    var rings = [];
    var stack = [rings];
    var pointer = rings;
    var elem;

    while (elem =
           $(/^(\()/) ||
             $(/^(\))/) ||
               $(/^(,)/) ||
                 $(tuples)) {
      if (elem === '(') {
        stack.push(pointer);
        pointer = [];
        stack[stack.length - 1].push(pointer);
        depth++;
      } else if (elem === ')') {
        // For the case: Polygon(), ...
        if (pointer.length === 0) return null;

        pointer = stack.pop();
        // the stack was empty, input was malformed
        if (!pointer) return null;
        depth--;
        if (depth === 0) break;
      } else if (elem === ',') {
        pointer = [];
        stack[stack.length - 1].push(pointer);
      } else if (!elem.split(/\s/g).some(isNaN)) {
        Array.prototype.push.apply(pointer, elem.split(/\s/g).map(parseFloat));
      } else {
        return null;
      }
      white();
    }

    if (depth !== 0) return null;

    return rings;
  }

  function coords () {
    var list = [];
    var item;
    var pt;
    while (pt =
           $(tuples) ||
             $(/^(,)/)) {
      if (pt === ',') {
        list.push(item);
        item = [];
      } else if (!pt.split(/\s/g).some(isNaN)) {
        if (!item) item = [];
        Array.prototype.push.apply(item, pt.split(/\s/g).map(parseFloat));
      }
      white();
    }

    if (item) list.push(item);
    else return null;

    return list.length ? list : null;
  }

  function point () {
    if (!$(/^(point(\sz)?)/i)) return null;
    white();
    if (!$(/^(\()/)) return null;
    var c = coords();
    if (!c) return null;
    white();
    if (!$(/^(\))/)) return null;
    return {
      type: 'Point',
      coordinates: c[0]
    };
  }

  function multipoint () {
    if (!$(/^(multipoint)/i)) return null;
    white();
    var newCoordsFormat = _
      .substring(_.indexOf('(') + 1, _.length - 1)
      .replace(/\(/g, '')
      .replace(/\)/g, '');
    _ = 'MULTIPOINT (' + newCoordsFormat + ')';
    var c = multicoords();
    if (!c) return null;
    white();
    return {
      type: 'MultiPoint',
      coordinates: c
    };
  }

  function multilinestring () {
    if (!$(/^(multilinestring)/i)) return null;
    white();
    var c = multicoords();
    if (!c) return null;
    white();
    return {
      type: 'MultiLineString',
      coordinates: c
    };
  }

  function linestring () {
    if (!$(/^(linestring(\sz)?)/i)) return null;
    white();
    if (!$(/^(\()/)) return null;
    var c = coords();
    if (!c) return null;
    if (!$(/^(\))/)) return null;
    return {
      type: 'LineString',
      coordinates: c
    };
  }

  function polygon () {
    if (!$(/^(polygon(\sz)?)/i)) return null;
    white();
    var c = multicoords();
    if (!c) return null;
    return {
      type: 'Polygon',
      coordinates: c
    };
  }

  function multipolygon () {
    if (!$(/^(multipolygon)/i)) return null;
    white();
    var c = multicoords();
    if (!c) return null;
    return {
      type: 'MultiPolygon',
      coordinates: c
    };
  }

  function geometrycollection () {
    var geometries = [];
    var geometry;

    if (!$(/^(geometrycollection)/i)) return null;
    white();

    if (!$(/^(\()/)) return null;
    while (geometry = root()) {
      geometries.push(geometry);
      white();
      $(/^(,)/);
      white();
    }
    if (!$(/^(\))/)) return null;

    return {
      type: 'GeometryCollection',
      geometries: geometries
    };
  }

  function root () {
    return point() ||
      linestring() ||
      polygon() ||
      multipoint() ||
      multilinestring() ||
      multipolygon() ||
      geometrycollection();
  }

  return crs(root());
}
29915
def Convert(self, metadata, interface, token=None):
    """"""
    ip4_addresses = []
    ip6_addresses = []
    for addr in interface.addresses:
      if addr.address_type == addr.Family.INET:
        ip4_addresses.append(addr.human_readable_address)
      elif addr.address_type == addr.Family.INET6:
        ip6_addresses.append(addr.human_readable_address)
      else:
        raise ValueError("Invalid address type: %s" % addr.address_type)

    result = ExportedNetworkInterface(
        metadata=metadata,
        ifname=interface.ifname,
        ip4_addresses=" ".join(ip4_addresses),
        ip6_addresses=" ".join(ip6_addresses))

    if interface.mac_address:
      result.mac_address = interface.mac_address.human_readable_address

    yield result
352999
def getaddresses(fieldvalues):
    """"""
    all = COMMASPACE.join(fieldvalues)
    a = _AddressList(all)
    return a.addresslist
731007
function resolveAddresses(provider, value, paramType) {
    if (Array.isArray(paramType)) {
        var promises_1 = [];
        paramType.forEach(function (paramType, index) {
            var v = null;
            if (Array.isArray(value)) {
                v = value[index];
            }
            else {
                v = value[paramType.name];
            }
            promises_1.push(resolveAddresses(provider, v, paramType));
        });
        return Promise.all(promises_1);
    }
    if (paramType.type === 'address') {
        return provider.resolveName(value);
    }
    if (paramType.type === 'tuple') {
        return resolveAddresses(provider, value, paramType.components);
    }
    // Strips one level of array indexing off the end to recuse into
    var isArrayMatch = paramType.type.match(/(.*)(\[[0-9]*\]$)/);
    if (isArrayMatch) {
        if (!Array.isArray(value)) {
            throw new Error('invalid value for array');
        }
        var promises = [];
        var subParamType = {
            components: paramType.components,
            type: isArrayMatch[1],
        };
        value.forEach(function (v) {
            promises.push(resolveAddresses(provider, v, subParamType));
        });
        return Promise.all(promises);
    }
    return Promise.resolve(value);
}
45906
def parse_component(self, node):
        

        if 'id' in node.lattrib:
            id_ = node.lattrib['id']
        else:
            #self.raise_error('Component must have an id')
            id_ = make_id()

        if 'type' in node.lattrib:
            type_ = node.lattrib['type']
        else:
                self.raise_error("Component {0} must have a type.",
                                 id_)

        component = Component(id_, type_)

        if self.current_component:
            component.set_parent_id(self.current_component.id)
            self.current_component.add_child(component)
        else:
            self.model.add_component(component)
                
        for key in node.attrib:
            if key.lower() not in ['id', 'type']:
                component.set_parameter(key, node.attrib[key])

        old_component = self.current_component
        self.current_component = component
        self.process_nested_tags(node)
        self.current_component = old_component
1098544
public final Object fromAddress(long address) {
		Object[] array = new Object[] { null };
		long baseOffset = THE_UNSAFE.arrayBaseOffset(Object[].class);
		THE_UNSAFE.putLong(array, baseOffset, address);
		return array[0];
	}
365642
function cda_line_address(addressString) {
    var addressObj = {
        "use": "primary home",
        "street_lines": [],
        "city": "",
        "state": "",
        "zip": "",
        "country": "United States" //assume U.S. for now
    };
    var addressArray = addressString.trim().split(',');
    var uppCaseAdrStr = addressString.toUpperCase();
    var foundWord, x, word, tempCityIndex, foundCityIndex, zip, stateAndZip, streetFound;
    if (addressArray.length === 1) {
        var tempArr = addressArray[0].split(' ');
        //this goes from best method to worse

        //check if you can see a number from the last index, which means that's it's likely to be a p.o. box or an address

        // 1. Obtain address from zip code.
        /*
         Also need to consider time complexity here, Notice that it maybe doing
        a retrieval from a rather big object. I think it's okay since documentation
        says that it's better than hashing, which is constant time lookup. May need
        beter method later */
        var addressLine;
        var fiveDigitZip = tempArr[tempArr.length - 1].substring(0, 5);
        if (fiveDigitZip in zipDict && !isNaN(fiveDigitZip)) {
            var foundCity = zipDict[fiveDigitZip][0].trim();
            var foundCityArr = foundCity.split(' ');
            var foundCityMatch = '';
            foundCityIndex = -1;
            for (x = 0; x < foundCityArr.length; x++) {
                tempCityIndex = addressString.toUpperCase().indexOf(foundCityArr[x]);
                if (tempCityIndex > 0) {
                    if (foundCityIndex === -1) {
                        foundCityIndex = tempCityIndex;
                    }
                    foundCityMatch += foundCityArr[x] + ' ';
                }
            }
            foundCityMatch = foundCityMatch.substring(0, foundCityMatch.length - 1);
            if (foundCityIndex >= 1) {
                addressLine = addressString.substring(0, foundCityIndex - 1).trim();
                addressObj.street_lines.push(addressLine);
                /*TODO: foundCIty, which is the city name obtained from looking up the
                zip code table, needs to do something like an longest common substring match
                in case there isn't a 1 to 1 match between the city names of the raw string
                and foundCity. For now I'm just going to take the field in the dictionary. However,
                the more correct approach would be running Ukkonen's algorithm for suffix trees
                to find the longest common substring between the raw string and the value from
                lookup. If the lcs algorithm is implemented correctly it should give O(m+n) time. */
                addressObj.city = foundCityMatch.trim();
                addressObj.zip = tempArr[tempArr.length - 1].trim();
                addressObj.state = tempArr[tempArr.length - 2].trim();
                return addressObj;
            }
        }
        //2. try out commonly found suffixes
        var cityBegIndex, cityEndIndex, zipIndex;
        for (x = tempArr.length - 1; x > 0; x--) {
            word = tempArr[x].toUpperCase();
            if (word in streetSuffix) {
                streetFound = true;
                foundWord = tempArr[x];
                cityBegIndex = addressString.indexOf(foundWord);
                cityEndIndex = cityBegIndex + foundWord.length;
                addressLine = addressString.substring(0, cityEndIndex).trim();
                addressObj.street_lines.push(addressLine);

                //These might not always be the last and second to last, what if there's just state code? need to make changes forthat later.
                addressObj.zip = tempArr[tempArr.length - 1].trim();
                addressObj.state = tempArr[tempArr.length - 2].trim();
                //get city name
                zipIndex = addressString.indexOf(addressObj.zip);
                var stateIndex = addressString.indexOf(addressObj.state);

                addressObj.city = addressString.substring(cityEndIndex, stateIndex).trim();
                return addressObj;
            }
        }

        for (x = tempArr.length - 1; x > 0; x--) {
            word = tempArr[x].toUpperCase();
            if (word in unitDesignators) {
                streetFound = true;
                foundWord = tempArr[x];
                cityBegIndex = addressString.indexOf(foundWord);
                cityEndIndex = cityBegIndex + foundWord.length;
                addressLine = addressString.substring(cityBegIndex, cityEndIndex).trim();
                addressObj.street_lines.push(addressLine);

                //These might not always be the last and second to last
                addressObj.zip = tempArr[tempArr.length - 1].trim();
                addressObj.state = tempArr[tempArr.length - 2].trim();
                //get city name
                zipIndex = addressString.indexOf(addressObj.zip);

                addressObj.city = addressString.substring(cityEndIndex, zipIndex).trim();
                return addressObj;
            }
        }

        return null;
    }

    /*case when there is only one comma, right after the city , ie. 1111 Address Dr Hoosville, VA 11111*/
    else if (addressArray.length === 2) {
        var streetAndCity = addressArray[0].trim();
        stateAndZip = addressArray[1].trim();

        var test = false;
        streetFound = false;
        var street;
        var city;

        //try to figure out street and city, going for fastest computation to slowest

        var streetArray = streetAndCity.split(" ");

        /*the whole point of this code is to find the point where we need to split the
        string */

        //find longest worded us city

        //this is the default breaking point
        var breakPoint = streetAndCity.lastIndexOf(' ');

        //check if you can see a number from the last index, which means that's it's likely to be a p.o. box or an address

        //First, check if the beginning token is a word if it's a word, then it's likely to be a PO box
        if (isNaN(streetArray[0])) {
            for (x = streetArray.length; x > 0; x--) {
                /* NOTE: the > 0 IS NOT A MISTAKE! Address lines usually start with a number so we don't want the loop
                to go all the way through */
                if (!isNaN(streetArray[x])) { //so it is a number
                    streetFound = true;
                    foundWord = streetArray[x];
                    breakPoint = streetAndCity.indexOf(foundWord) + foundWord.length;
                    //console.log(streetAndCity.substring(0, breakPoint));
                }

            }
        }
        //means that we do start with a street number, and need to look for a common suffix
        else {

            /*The stop index is where looping should stop in an address. The reason why
            5 is used is because the longest worded city is 5 words long. */
            //loop only to the 2nd to last word, i.e. 7777 blah blah STOP city, ST 99999
            if (!streetFound) {
                for (x = 0; x < streetArray.length - 1; x++) {
                    word = streetArray[x].toUpperCase();
                    if (word in streetSuffix) {
                        streetFound = true;
                        foundWord = streetArray[x];
                        breakPoint = streetAndCity.indexOf(foundWord) + foundWord.length;
                        break;
                    }
                }
            }

            //go through the string and look up usps C2 suffix address, unit designators
            if (!streetFound) {

                for (x = 0; x > streetArray.length; x++) {
                    word = streetArray[x].toUpperCase();
                    if (word in unitDesignators) {
                        streetFound = true;
                        foundWord = streetArray[x];
                        breakPoint = streetAndCity.indexOf(foundWord) + foundWord.length;
                        test = true;
                        break;
                    }
                }
            }
            //last major option, lookup the 5 letter zip code, then do a match on the address string
            //with the obtained value.
            if (!streetFound) {
                var stateAndZipArr = stateAndZip.split(' ');
                zip = stateAndZipArr[1].trim().substring(0, 5);
                if (zip in zipDict && !isNaN(zip)) {
                    var cityRetrieved = zipDict[zip][0].trim();
                    var cityArr = cityRetrieved.split(" ");
                    var capAdrString = addressString.toUpperCase();
                    var possibleBreakPoint = -1;
                    for (x = 0; x < cityArr.length; x++) {
                        tempCityIndex = addressString.toUpperCase().indexOf(cityArr[x]);
                        if (tempCityIndex > 0) {
                            if (foundCityIndex === -1) {
                                foundCityIndex = tempCityIndex;
                            }

                        }
                    }
                }

            }

        }

        // this step is taken for all procedures, the above code is to find the right point to split the stirng(breakpoint)
        street = streetAndCity.substring(0, breakPoint);
        city = streetAndCity.substring(breakPoint + 1, streetAndCity.length);
        //state and zip are consistent
        stateAndZip = stateAndZip.split(' ');
        var state = stateAndZip[0];
        zip = stateAndZip[1];
        addressObj.street_lines.push(street);
        addressObj.city = city;
        addressObj.state = state;
        addressObj.zip = zip;

        return addressObj;
    }
    /*ie. 1111 Address Dr, Hoosville, VA 11111*/
    else if (addressArray.length === 3) {
        addressObj.street_lines[0] = addressArray[0].trim();
        addressObj.city = addressArray[1].trim();
        stateAndZip = addressArray[2].trim().split(' ');
        addressObj.state = stateAndZip[0];
        addressObj.zip = stateAndZip[1];
        return addressObj;
    }
    return null;
}
934199
def disassemble(self, data, address, architecture_mode=ARCH_X86_MODE_32):
        
        asm, size = self._cs_disassemble_one(data, address)

        instr = self._parser.parse(asm) if asm else None

        if instr:
            instr.address = address
            instr.size = size
            instr.bytes = data[0:size]
        else:
            raise DisassemblerError()

        return instr