Parse the input data dict into a `Channel`.

    Parameters
    ----------
    data : `dict`
        input data from CIS json query

    Returns
    -------
    c : `Channel`
        a `Channel` built from the data
192577
def parse_json(data):
    
    sample_rate = data['datarate']
    unit = data['units']
    dtype = CIS_DATA_TYPE[data['datatype']]
    model = data['source']
    url = data['displayurl']
    return Channel(data['name'], sample_rate=sample_rate, unit=unit,
                   dtype=dtype, model=model, url=url)
201525
def feed(self, data):
        
        assert isinstance(data, binary_type)
        for b in iterbytes(data):
            self._parser.send(int2byte(b))
498813
def from_dict(data):
        
        data = deepcopy(data)

        created_at = data.get('created_at', None)
        if created_at is not None:
            data['created_at'] = dateutil.parser.parse(created_at)

        return Image(**data)
540469
async def send_data(self, data, addr):
        
        channel = self.peer_to_channel.get(addr)
        if channel is None:
            channel = self.channel_number
            self.channel_number += 1
            self.channel_to_peer[channel] = addr
            self.peer_to_channel[addr] = channel

            # bind channel
            await self.channel_bind(channel, addr)

        header = struct.pack('!HH', channel, len(data))
        self._send(header + data)
994842
def parse_packet(data, format=None):
    
    unpacked = struct.unpack(BASE_FORMAT, data[:_FORMAT_SIZE])
    psize, protocol, mac, gateway, time, ptype = unpacked
    header = Header(psize, protocol, mac, gateway, time, ptype)
    return header, data[_FORMAT_SIZE:]
58280
def decode_data(self, data):
        
        assert self.get_empty() is False
        assert self._data_encoded is True
        if self._block_allowed:
            data = self._decode_transfer_block_data(data)
        else:
            data = self._decode_transfer_data(data)
        return data
764797
def _data_to_json(data):
        
        if type(data) not in [str, unicode]:
            data = json.dumps(data)
        return data
1308945
def parse(self, data):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Logical Volume Header Descriptor already initialized')
        (self.unique_id, reserved_unused) = struct.unpack_from(self.FMT, data, 0)

        self._initialized = True
918229
def parse_dict(self, data_dict):
        
        assert isinstance(data_dict, dict)
        string_repr = json.dumps(data_dict)
        return self.parse_JSON(string_repr)
561197
def parse(cls, data: bytes) -> 'MessageContent':
        
        lines = cls._find_lines(data)
        view = memoryview(data)
        return cls._parse(data, view, lines)
110032
def to_python(self, data):
        
        if data is None:
            return ''
        if isinstance(data, unicode):
            data = data.encode(DEFAULT_ENCODING)
        else:
            data = str(data)
        return data
1295597
def transform(self, data):
        
        out = {}
        for key, val in data.items():
            if key in self._transform_map:
                target = self._transform_map[key]
                key, val = target(key, val) if type(target) == types.FunctionType else (key, target)

            out[key] = val


        return out
389791
def tlv_parse(data):
    
    parsed = {}
    while data:
        t, l, data = ord_byte(data[0]), ord_byte(data[1]), data[2:]
        parsed[t], data = data[:l], data[l:]
    return parsed
525102
def _parse(self, data):
        
        self.description = data['description']
        self.in_gallery = data['in_gallery']
        self.mod_time = int(time.time())
        self.title = data['title']
914038
def _parse_dict(self, data):
		
		d = {}
		for line in data.split('\r\n'):
			match = GNTP_HEADER.match(line)
			if not match:
				continue

			key = match.group(1).strip()
			val = match.group(2).strip()
			d[key] = val
		return d
1230302
def from_dict(data, ctx):
        

        data = data.copy()

        if data.get('bid') is not None:
            data['bid'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['bid'], ctx
                )

        if data.get('ask') is not None:
            data['ask'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['ask'], ctx
                )

        if data.get('mid') is not None:
            data['mid'] = \
                ctx.instrument.CandlestickData.from_dict(
                    data['mid'], ctx
                )

        return Candlestick(**data)
1148128
def from_json(self, data):
        
        try:
            d = json.loads(data)
        except ValueError:
            raise InvalidMessageException()
        self.from_dict(d)