Convert rv to tuple(data, code, headers)

    Args:
        rv: data or tuple that contain code and headers
    Returns:
        tuple (rv, status, headers)
965824
def unpack(rv):
    
    status = headers = None
    if isinstance(rv, tuple):
        rv, status, headers = rv + (None,) * (3 - len(rv))
    if isinstance(status, (dict, list)):
        headers, status = status, headers
    return (rv, status, headers)
344176
def rvs(self, size=1, **kwargs):
        
        size = int(size)
        dtype = [(p, float) for p in self.params]
        arr = numpy.zeros(size, dtype=dtype)
        remaining = size
        keepidx = 0
        while remaining:
            draws = self._draw(size=remaining, **kwargs)
            mask = self._constraints(draws)
            addpts = mask.sum()
            arr[keepidx:keepidx+addpts] = draws[mask]
            keepidx += addpts
            remaining = size - keepidx
        return arr
499199
def filter_headers(data):
    
    headers = {}
    for i in data:
        if i == 'Content-Type' or i == 'Host' or i[0] == 'x' or i[0] == 'X':
            headers[i] = data[i]
    return headers
853023
def getWordAtRva(self, rva):
        
        return datatypes.WORD.parse(utils.ReadData(self.getDataAtRva(rva,  2)))
917340
def parse_close(data: bytes) -> Tuple[int, str]:
    
    length = len(data)
    if length >= 2:
        code, = struct.unpack("!H", data[:2])
        check_close(code)
        reason = data[2:].decode("utf-8")
        return code, reason
    elif length == 0:
        return 1005, ""
    else:
        assert length == 1
        raise WebSocketProtocolError("Close frame too short")
267415
def get_hash_tuple(header_path, cython_path, gen_file_path):
    """"""

    header_hash = (sha1_of_file(header_path)
                   if os.path.exists(header_path) else 'NA')
    from_hash = sha1_of_file(cython_path)
    to_hash = (sha1_of_file(gen_file_path)
               if os.path.exists(gen_file_path) else 'NA')

    return header_hash, from_hash, to_hash
696059
def _get_protocol_tuple(data: Dict[str, Any]) -> Tuple[str, List, Dict]:
    """"""
    return data['function'], data.get('args', []), data.get('kwargs', {})
537226
def to_python(self, data):
        
        if data is None:
            return data
        if self.datatype:
            return self.datatype(data)
        else:
            return data
1291409
def from_pystr_to_cstr(data):
    

    if not isinstance(data, list):
        raise NotImplementedError
    pointers = (ctypes.c_char_p * len(data))()
    if PY3:
        data = [bytes(d, 'utf-8') for d in data]
    else:
        data = [d.encode('utf-8') if isinstance(d, unicode) else d  # pylint: disable=undefined-variable
                for d in data]
    pointers[:] = data
    return pointers
1365236
def _decode_list(data):
    
    if six.PY3:
        return data
    rv = []
    for item in data:
        if not isinstance(item, text_type):
            item = item.encode('utf-8')
        elif isinstance(item, list):
            item = _decode_list(item)
        rv.append(item)
    return rv
895984
def parse(self, argv):
        
        rv = {}
        for pattern in self.patterns:
            pattern.apply(rv, argv)
        return rv
1025057
def parse(v):
        

        parts = v.split(',')

        slices = []

        for part in parts:
            p = part.split(':')

            if len(p) == 1:
                slices.append(int(p[0]))
            elif len(p) == 2:
                slices.append(tuple(p))
            else:
                raise ValueError("Too many ':': {}".format(part))

        return slices
295705
def _attrs_to_tuple(obj, attrs):
    
    return tuple(getattr(obj, a.name) for a in attrs)
81150
def get_unicode_from_response(r):
    
    warnings.warn((
        'In requests 3.0, get_unicode_from_response will be removed. For '
        'more information, please see the discussion on issue #2266. (This'
        ' warning should only appear once.)'),
        DeprecationWarning)

    tried_encodings = []

    # Try charset from content-type
    encoding = get_encoding_from_headers(r.headers)

    if encoding:
        try:
            return str(r.content, encoding)
        except UnicodeError:
            tried_encodings.append(encoding)

    # Fall back:
    try:
        return str(r.content, encoding, errors='replace')
    except TypeError:
        return r.content
590270
def get_data(self, rva=0, length=None):
        
        
        s = self.get_section_by_rva(rva)
        
        if length:
            end = rva + length
        else:
            end = None

        if not s:
            if rva < len(self.header):
                return self.header[rva:end]
            
            # Before we give up we check whether the file might
            # contain the data anyway. There are cases of PE files
            # without sections that rely on windows loading the first
            # 8291 bytes into memory and assume the data will be
            # there
            # A functional file with these characteristics is:
            # MD5: 0008892cdfbc3bda5ce047c565e52295
            # SHA-1: c7116b9ff950f86af256defb95b5d4859d4752a9
            #
            if rva < len(self.__data__):
                return self.__data__[rva:end]
            
            raise PEFormatError, 'data at RVA can\'t be fetched. Corrupt header?'
        
        return s.get_data(rva, length)
814967
def parse_response(response):
    
    if isinstance(response, tuple):
        if len(response) > 2:
            return response[0], response[1], response[2]
        elif len(response) > 1:
            return response[0], response[1], {}
    try:
        return response.data, response.status_code, response.headers
    except AttributeError:
        return response, 200, {}
254303
def getDwordAtRva(self, rva):
        
        return datatypes.DWORD.parse(utils.ReadData(self.getDataAtRva(rva,  4)))