Parses a connection string
321879
protected function parseConnectionString($string)
    {
        // preg_match('%^([^/]+?)://(?:([^/@:]*?)(?::([^/@:]+?))?@([^/@:]+?)(?::([^/@:]+?))?)?/(.+)$%'
        $matches = [];
        preg_match('%^([^/]+?)://(?:([^/@]*?)(?::([^/@:]+?)@)?([^/@:]+?)(?::([^/@:]+?))?)?/(.+)$%',
                   $string, $matches);
        return [
            'dbtype'   => $matches[1],
            'username' => $matches[2],
            'password' => $matches[3],
            'host'     => $matches[4],
            'port'     => $matches[5],
            'database' => $matches[6]
        ];
    }
969099
function parse(string) {
    var result = {},
        lines = string.split(/\r\n|\r|\n/),
        count = lines.length,
        pieces,
        key,
        value,
        meta,
        namespace;

    for (var i = 0; i < count; i++) {
        if (lines[i] === '') {
            continue;
        }
        if (lines[i].toUpperCase() === PREFIX || lines[i].toUpperCase() === POSTFIX) {
            continue;
        }
        var data = lines[i];

        /**
         * Check that next line continues current
         * @param {number} i
         * @returns {boolean}
         */
        var isValueContinued = function (i) {
            return i + 1 < count && (lines[i + 1][0] === ' ' || lines[i + 1][0] === '\t');
        };
        // handle multiline properties (i.e. photo).
        // next line should start with space or tab character
        if (isValueContinued(i)) {
            while (isValueContinued(i)) {
                data += lines[i + 1].trim();
                i++;
            }
        }

        pieces = data.split(':');
        key = pieces.shift();
        value = pieces.join(':');
        namespace = false;
        meta = {};

        // meta fields in property
        if (key.match(/;/)) {
            key = key
                .replace(/\\;/g, 'ΩΩΩ')
                .replace(/\\,/, ',');
            var metaArr = key.split(';').map(function (item) {
                return item.replace(/ΩΩΩ/g, ';');
            });
            key = metaArr.shift();
            metaArr.forEach(function (item) {
                var arr = item.split('=');
                arr[0] = arr[0].toLowerCase();
                if (arr[0].length === 0) {
                    return;
                }
                if (meta[arr[0]]) {
                    meta[arr[0]].push(arr[1]);
                } else {
                    meta[arr[0]] = [arr[1]];
                }
            });
        }

        // values with \n
        value = value
            .replace(/\\n/g, '\n');

        value = tryToSplit(value);

        // Grouped properties
        if (key.match(/\./)) {
            var arr = key.split('.');
            key = arr[1];
            namespace = arr[0];
        }

        var newValue = {
            value: value
        };
        if (Object.keys(meta).length) {
            newValue.meta = meta;
        }
        if (namespace) {
            newValue.namespace = namespace;
        }

        if (key.indexOf('X-') !== 0) {
            key = key.toLowerCase();
        }

        if (typeof result[key] === 'undefined') {
            result[key] = [newValue];
        } else {
            result[key].push(newValue);
        }

    }

    return result;
}
1363243
@Nullable
    public OAuthConnection parse(String email) {
        String domain = extractDomain(email);
        if (domain == null) {
            return null;
        }

        domain = domain.toLowerCase();
        for (OAuthConnection c : connections) {
            String mainDomain = domainForConnection(c);
            if (domain.equalsIgnoreCase(mainDomain)) {
                return c;
            }

            List<String> aliases = c.valueForKey(DOMAIN_ALIASES_KEY, List.class);
            if (aliases != null) {
                for (String d : aliases) {
                    if (d.equalsIgnoreCase(domain)) {
                        return c;
                    }
                }
            }
        }
        return null;
    }
1066833
def parseString(string):
    
    buildable_dependencies = []
    given_dependencies = []
    output_directory = None
    output_format = None
    building_directory = None
    output_name = None

    _check_whitespace(string)

    there_are_dependencies = _check_dependencies(string)
    if there_are_dependencies:
        buildable_dependencies, \
            given_dependencies, \
            string = _parse_dependencies(string)

    there_are_options = _check_building_options(string)
    if there_are_options:
        output_directory, \
            output_format, \
            building_directory, string = _parse_building_options(string)

    if string[0] == '>':
        string = string[1:]
    if string[-1] == '>':
        string = string[:-1]

    is_a_flow_operator = _check_flow_operator(string)
    if is_a_flow_operator:
        greater_than_location = string.index('>')
        output_name = string[greater_than_location + 1:]
        string = string[:greater_than_location]

    ret = object()
    ret.input_name = string
    ret.output_name = output_name
    ret.buildable_dependencies = buildable_dependencies
    ret.given_dependencies = given_dependencies
    ret.output_format = output_format
    ret.building_directory = building_directory
    ret.output_directory = output_directory
    return ret
697103
def connection_service_name(service, *args):
    '''  '''
    # if the service is a string
    if isinstance(service, str):
        return service

    return normalize_string(type(service).__name__)
159738
private static String buildConnectionString(final String connectionString,
                                               final Config config) {

      if(config == null) {
         return connectionString;
      }

      StringBuilder buf = new StringBuilder();
      Iterator<Map.Entry<String, ConfigValue>> iter = config.entrySet().iterator();
      if(iter.hasNext()) {
         Map.Entry<String, ConfigValue> curr = iter.next();
         buf.append(curr.getKey()).append("=").append(curr.getValue().unwrapped().toString());
      } else {
         return connectionString;
      }

      while(iter.hasNext()) {
         Map.Entry<String, ConfigValue> curr = iter.next();
         buf.append("&").append(curr.getKey()).append("=").append(curr.getValue().unwrapped().toString());
      }

      if(connectionString.indexOf('?') > 0) {
         return connectionString + "&" + buf.toString();
      } else {
         return connectionString + "?" + buf.toString();
      }
   }
944179
private void parseThrowIOEForInboundConnections(Map<?, ?> props) {
        //PI57542
        Object value = props.get(HttpConfigConstants.PROPNAME_THROW_IOE_FOR_INBOUND_CONNECTIONS);
        if (null != value) {
            this.throwIOEForInboundConnections = convertBoolean(value);
            if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) {
                Tr.event(tc, "Config: ThrowIOEForInboundConnections is " + throwIOEForInboundConnections());
            }
        }
    }
112321
public static List<String> parseConnectionPrefixes(Config config, SharedRestClientKey key) throws URISyntaxException, NotConfiguredException {
    if (key instanceof UriRestClientKey) {
      return Lists.newArrayList(((UriRestClientKey) key).getUri());
    }

    if (!config.hasPath(SERVER_URI_KEY)) {
      throw new NotConfiguredException("Missing key " + SERVER_URI_KEY);
    }

    List<String> uris = Lists.newArrayList();
    for (String uri : Splitter.on(",").omitEmptyStrings().trimResults().splitToList(config.getString(SERVER_URI_KEY))) {
      uris.add(resolveUriPrefix(new URI(uri)));
    }
    return uris;
  }
1220231
def parse(cls, string):
		'''
			
		'''
		obj, i = cls.match(string, 0)
		if i != len(string):
			raise Exception("Could not parse '" + string + "' beyond index " + str(i))
		return obj
1231495
def _parse_conn_string(self, conn_string):
        
        disconnection_required = False

        """If device not in conn_string, set to default info"""
        if conn_string is None or 'device' not in conn_string:
            if self._default_device_info is not None and self._device_info != self._default_device_info:
                disconnection_required = True
                self._device_info = self._default_device_info

        if conn_string is None or len(conn_string) == 0:
            return disconnection_required

        if '@' in conn_string:
            raise ArgumentError("Configuration files are not yet supported as part of a connection string argument",
                                conn_string=conn_string)

        pairs = conn_string.split(';')
        for pair in pairs:
            name, _, value = pair.partition('=')
            if len(name) == 0 or len(value) == 0:
                continue

            name = name.strip()
            value = value.strip()

            if name == 'device':
                if value in DEVICE_ALIASES:
                    device_name = DEVICE_ALIASES[value]
                if device_name in KNOWN_DEVICES:
                    device_info = KNOWN_DEVICES.get(device_name)
                    if self._device_info != device_info:
                        self._device_info = device_info
                        disconnection_required = True
                else:
                    raise ArgumentError("Unknown device name or alias, please select from known_devices",
                                        device_name=value, known_devices=[x for x in DEVICE_ALIASES.keys()])
            elif name == 'channel':
                if self._mux_func is not None:
                    if self._channel != int(value):
                        self._channel = int(value)
                        disconnection_required = True
                else:
                    print("Warning: multiplexing architecture not selected, channel will not be set")
        return disconnection_required
734384
private function parseConn($conn)
    {
        while(true)
        {
            $meta = fread($conn, 4);
            if('' === $meta || false === $meta)
            {
                return;
            }
            $length = unpack('N', $meta)[1];
            $data = fread($conn, $length);
            if(false === $data || !isset($data[$length - 1]))
            {
                return;
            }
            $body = ($this->unserialize)($data);
            if(!$body instanceof Operation)
            {
                return;
            }
            try{
                $result = new Result($this->operationParser->parse($body));
            } catch(\Throwable $th) {
                $result = new Result(null, $th);
            }
            $resultData = ($this->serialize)($result);
            $length = strlen($resultData);
            $resultData = pack('N', $length) . $resultData;
            fwrite($conn, $resultData, $length + 4);
        }
    }
877016
private function parseUrl($url)
    {
        $parsed = parse_url($url);
        if ($parsed === false) {
            throw new ConnectionException('Unable to parse url '. $url);
        }
        array_push($this->hosts, $parsed + ['port' => '61613', 'scheme' => 'tcp']);
    }
1019763
function parse(fileString, callback) {
	return NginxConf.parse(fileString, function(err, _config) {
		if (err) {
			return callback(err);
		}

		return parseNginxConf(_config, callback);
	});
}
421609
function parseQueryString(string) {
    return _.transform(_.toString(string).split('&'), (result, segment) => {
        const split = segment.split('=');
        result[decodeURIComponent(split[0])] = decodeURIComponent(split[1]);
    }, {});
}
692660
def parse(self) -> InstanceRoute:
        """"""
        res = InstanceRoute()
        while True:
            self.char("/")
            res.append(MemberName(*self.prefixed_name()))
            try:
                next = self.peek()
            except EndOfInput:
                return res
            if next == "[":
                self.offset += 1
                self.skip_ws()
                next = self.peek()
                if next in "0123456789":
                    ind = self.unsigned_integer() - 1
                    if ind < 0:
                        raise UnexpectedInput(self, "positive index")
                    self.skip_ws()
                    self.char("]")
                    res.append(EntryIndex(ind))
                elif next == '.':
                    self.offset += 1
                    res.append(EntryValue(self._get_value()))
                else:
                    res.append(self._key_predicates())
                if self.at_end():
                    return res
290247
def parse_response(self, connection, command_name, **options):
        
        response = connection.read_response()
        if command_name in self.response_callbacks and len(response):
            status = nativestr(response[0])
            if status == RES_STATUS.OK:
                return self.response_callbacks[command_name](response[1:],
                                                             **options)
            elif status == RES_STATUS.NOT_FOUND:
                return None
            else:
                raise DataError(RES_STATUS_MSG[status]+':'.join(response))
                #raise DataError('Not Found')
        return response
1228534
def parse(cls, detail_string):
        """"""
        split = detail_string.split(':')
        if len(split) != 4:
            raise Exception('invalid credentials')  # TODO: other exception

        ltpk = binascii.unhexlify(split[0])
        ltsk = binascii.unhexlify(split[1])
        atv_id = binascii.unhexlify(split[2])
        client_id = binascii.unhexlify(split[3])
        return Credentials(ltpk, ltsk, atv_id, client_id)