Parse netloc string.
513132
def parse_netloc(scheme, netloc):
    """"""
    auth, _netloc = netloc.split('@')
    sender, token = auth.split(':')
    if ':' in _netloc:
        domain, port = _netloc.split(':')
        port = int(port)
    else:
        domain = _netloc
        if scheme == 'https':
            port = 443
        else:
            port = 80
    return dict(sender=sender, token=token, domain=domain, port=port)
934675
def parse_mixed_delim_str(line):
    """"""
    arrs = [[], [], []]
    for group in line.split(' '):
        for col, coord in enumerate(group.split('/')):
            if coord:
                arrs[col].append(int(coord))

    return [tuple(arr) for arr in arrs]
523719
def read_string(self, len):
        """"""
        format = '!' + str(len) + 's'
        length = struct.calcsize(format)
        info = struct.unpack(format,
                self.data[self.offset:self.offset + length])
        self.offset += length
        return info[0]
634396
def coords_string_parser(self, coords):
        """"""

        lat, lon = coords.split(',')
        return {"lat": lat.strip(), "lon": lon.strip(), "bounds": {}}
1179133
def parseSLURM(string):
    """"""
    # Use scontrol utility to get the hosts list
    import subprocess, os
    hostsstr = subprocess.check_output(["scontrol", "show", "hostnames", string])
    if sys.version_info.major > 2:
        hostsstr = hostsstr.decode()
    # Split using endline
    hosts = hostsstr.split(os.linesep)
    # Take out last empty host
    hosts = filter(None, hosts)
    # Create the desired pair of host and number of hosts
    hosts = [(host, 1) for host in hosts]
    return hosts
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
308211
def parse_connection_string_libpq(connection_string):
    """"""
    fields = {}
    while True:
        connection_string = connection_string.strip()
        if not connection_string:
            break
        if "=" not in connection_string:
            raise ValueError("expecting key=value format in connection_string fragment {!r}".format(connection_string))
        key, rem = connection_string.split("=", 1)
        if rem.startswith("'"):
            asis, value = False, ""
            for i in range(1, len(rem)):
                if asis:
                    value += rem[i]
                    asis = False
                elif rem[i] == "'":
                    break  # end of entry
                elif rem[i] == "\\":
                    asis = True
                else:
                    value += rem[i]
            else:
                raise ValueError("invalid connection_string fragment {!r}".format(rem))
            connection_string = rem[i + 1:]  # pylint: disable=undefined-loop-variable
        else:
            res = rem.split(None, 1)
            if len(res) > 1:
                value, connection_string = res
            else:
                value, connection_string = rem, ""
        fields[key] = value
    return fields
286518
def parse_line(string):
    """"""
    match = line_regexp().match(string)
    if match:
        matches = match.groupdict()
        line_number = matches['line_number']
        path_to_python = matches['path_to_python']
        spaceless_path_to_python = matches['spaceless_path_to_python']
        if path_to_python:
            return path_to_python, line_number
        elif spaceless_path_to_python:
            return spaceless_path_to_python, line_number
306441
def netloc(self):
        
        url = self._tuple
        if url.username and url.password:
            netloc = '%s:%s@%s' % (url.username, url.password, url.host)
        elif url.username and not url.password:
            netloc = '%s@%s' % (url.username, url.host)
        else:
            netloc = url.host
        if url.port:
            netloc = '%s:%s' % (netloc, url.port)
        return netloc
905738
def parse_networking(
    text    = None
    ):
    
    try:
        address = _builtins.address
        port    = _builtins.port
    except:
        address = None
        port    = None
    triggers = []
    if address and port:
        triggers.extend([
            trigger_keyphrases(
                text                          = text,
                keyphrases                    = [
                                                "reverse SSH",
                                                "reverse ssh"
                                                ],
                function                      = engage_command,
                kwargs                        = {"command": "ssh -R " + str(port) + ":localhost:22 " + address},
                confirm                       = True,
                confirmation_prompt           = "Do you want to reverse SSH "
                                                "connect? (y/n)",
                confirmation_feedback_confirm = "confirm reverse SSH connect: "
                                                "ssh localhost -p " + str(port),
                confirmation_feedback_deny    = "deny reverse SSH connect"
            )
        ])
    if any(triggers):
        responses = [response for response in triggers if response]
        if len(responses) > 1:
            return responses
        else:
            return responses[0]
    else:
        return False
290782
def parse(self, string, evaluate_result=True):
        '''
        '''
        m = self._match_re.match(string)
        if m is None:
            return None

        if evaluate_result:
            return self.evaluate_result(m)
        else:
            return Match(self, m)
289592
def from_string(cls, s):
        """"""
        for num, text in cls._STATUS_TABLE.items():
            if text == s: return cls(num)
        else:
            #raise ValueError("Wrong string %s" % s)
            logger.warning("Got unknown status: %s" % s)
            return cls.from_string("UNKNOWN")
728922
def _parse(fileobj):
    """"""
    fileobj.seek(0)
    try:
        part = fileobj.read(2)
    except UnicodeDecodeError:
        part = ""

    if part == "#!":
        shebang = shlex.split(fileobj.readline().strip())
        if (platform.system() == "Windows" and
                len(shebang) and
                os.path.basename(shebang[0]) == "env"):
            return shebang[1:]

        return shebang

    return []
1262963
def _get_string(data, position, obj_end, dummy):
    """"""
    length = _UNPACK_INT(data[position:position + 4])[0]
    position += 4
    if length < 1 or obj_end - position < length:
        raise InvalidBSON("invalid string length")
    end = position + length - 1
    if data[end:end + 1] != b"\x00":
        raise InvalidBSON("invalid end of string")
    return _utf_8_decode(data[position:end], None, True)[0], end + 1
595658
def decode_nfo( buffer ):
    """"""
    assert utils.is_bytes( buffer )
    return '\n'.join( [''.join( [CP437[y] for y in x] ) for x in buffer.split( b'\r\n' )] )
762941
def parse_string(self):
        """"""
        aliased_value = LITERAL_ALIASES.get(self.current_token.value.lower())
        if aliased_value is not None:
            return aliased_value
        return String(self.current_token.value)
521984
def get_string_from_data(self, offset, data):
        """"""
        
        # OC Patch
        b = None
        
        try:
            b = data[offset]
        except IndexError:
            return ''
        
        s = ''
        while ord(b):
            s += b
            offset += 1
            try:
                b = data[offset]
            except IndexError:
                break
        
        return s