Read an AMQP table, and return as a Python dictionary.
320563
def read_table(self):
        """"""
        self.bitcount = self.bits = 0
        tlen = unpack('>I', self.input.read(4))[0]
        table_data = AMQPReader(self.input.read(tlen))
        result = {}
        while table_data.input.tell() < tlen:
            name = table_data.read_shortstr()
            val = table_data.read_item()
            result[name] = val
        return result
132914
def _as_dict(self):
        
        values = self._dynamic_columns or {}
        for name, col in self._columns.items():
            values[name] = col.to_database(getattr(self, name, None))
        return values
1151404
async def read(self):
        """"""
        try:
            data = await self._stream_reader.readuntil(self.SEPARATOR)
        except asyncio.IncompleteReadError:
            self.connection_lost()
        else:
            query = self.decoder(data)
            if self.debug:
                access_logger.info("get query: {}".format(
                    query
                ), extra=self._extra)
            return query
381033
def _asdict(self):
    """"""
    # Start with any default values we have, and override with loaded values,
    # and then override with flag values.
    retval = {key: self._declarations[key].default_value for
              key in self._declarations if self._declarations[key].has_default}
    retval.update(self._loaded_values)
    # Only update keys that are declared so we don't allow injecting
    # un-declared keys via commandline flags.
    for key, value in self._modules['six'].iteritems(self._flag_values):
      if key in self._declarations:
        retval[key] = value
    return retval
778269
def as_dict(self):
        """"""
        attrs = vars(self)
        return {key: attrs[key] for key in attrs if not key.startswith('_')}
762605
def _get_dict(lines, start_index, indentation, deep):
    """"""

    info = {}
    current_item = None

    i = start_index
    while i < len(lines):

        current_line = lines[i]
        current_line_indentation = _get_indentation(current_line)

        # Check for multi-level returns
        if current_line_indentation < indentation:
            return info, i-1

        if current_line_indentation == indentation:
            current_item = current_line.lstrip(' ')
            info[current_item] = {}
            i = i + 1
            continue

        if i < len(lines) - 1:
            next_line_indentation = _get_indentation(lines[i+1])
        else:
            next_line_indentation = current_line_indentation

        if next_line_indentation > current_line_indentation:
            ret_dict, i = _get_dict(lines, i, current_line_indentation, deep+1)
            for key in ret_dict.keys():
                if key in info[current_item]:
                    info[current_item][key].update(ret_dict[key])
                else:
                    info[current_item][key] = ret_dict[key]
        else:
            key, value = _get_key_value(current_line)
            if key:
                info[current_item][key] = value

        # Do not return if it's the top level of recursion
        if next_line_indentation < current_line_indentation and deep > 0:
            return info, i

        i = i + 1

    return info, i
785645
def read_table(self):
        
        # Only need to check underflow on the table once
        tlen = self.read_long()
        self._check_underflow(tlen)
        end_pos = self._pos + tlen
        result = {}
        while self._pos < end_pos:
            name = self._field_shortstr()
            result[name] = self._read_field()
        return result
1221139
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'values') and self.values is not None:
            _dict['values'] = [x._to_dict() for x in self.values]
        if hasattr(self, 'pagination') and self.pagination is not None:
            _dict['pagination'] = self.pagination._to_dict()
        return _dict
1135553
def _read_dict(self, f):
        
        d = {}
        for k, item in f.items():
            if type(item) == h5py._hl.dataset.Dataset:
                v = item.value
                if type(v) == np.string_:
                    v = str(v)
                if type(v) == str and v == "NONE":
                    d[k] = None
                elif type(v) == str and v == "EMPTYARR":
                    d[k] = np.array([])
                elif isinstance(v, bytes):
                    d[k] = v.decode('utf-8')
                else:
                    d[k] = v

            elif k[:5] == "DICT_":
                d[k[5:]] = self._read_dict(item)
            elif k[:5] == "LIST_":
                tmpD = self._read_dict(item)
                d[k[5:]] = [tmpD[str(i)] for i in range(len(tmpD))]
        return d
1027490
def to_dict(self):
        """"""
        if self.operator == '$eq':
            return {self.q: self.value}
        if self.q is None:
            return {self.operator: self.value}
        return {self.q: {self.operator: self.value}}
442051
def to_dict(self):
        """"""
        result = {}
        for meta in self.intervals.values():
            result[meta.display] = meta.value
        return result
563396
def to_dict(self):
        
        return dict(
            addr=self.addr,
            protocol=self.protocol,
            weight=self.weight,
            last_checked=self.last_checked)
528891
def as_dict(self, depth=0):
        
        result_dict = {}
        for column in self.__table__.columns.keys():
            result_dict[column] = getattr(self, column, None)
            if isinstance(result_dict[column], Decimal):
                result_dict[column] = str(result_dict[column])
        result_dict['links'] = self.links()
        for foreign_key in self.__table__.foreign_keys:
            column_name = foreign_key.column.name
            column_value = getattr(self, column_name, None)
            if column_value:
                table = foreign_key.column.table.name
                with app.app_context():
                    endpoint = current_app.class_references[table]
                    session = db.session()
                    resource = session.query(endpoint).get(column_value)
                if depth > 0:
                    result_dict.update({
                        'rel': endpoint.__name__,
                        endpoint.__name__.lower(): resource.as_dict(depth - 1)
                        })
                else:
                    result_dict[
                        endpoint.__name__.lower() + '_url'] = '/{}/{}'.format(
                        endpoint.__name__, column_value)

        result_dict['self'] = self.resource_uri()
        return result_dict
738401
def _parse_text_DB(self, s):
        """"""
        dic = self.decode_json_str(s)
        new_dic = {}
        for table_name, (header, rows) in dic.items():
            newl = [{c: ligne[i]
                     for i, c in enumerate(header)} for ligne in rows]
            new_dic[table_name] = newl
        return new_dic
1238199
def _perm_dict_from_pyxb(self, access_pyxb):
        """"""
        subj_dict = self._subj_dict_from_pyxb(access_pyxb)
        return self._perm_dict_from_subj_dict(subj_dict)
777531
def convert_table(table):
    

    return dict((ord(k), v) for k, v in table.items())
150720
def from_dict(cls, d):
        """"""
        read = lambda cls: (lambda pair: (pair[0], cls.from_dict(pair[1])))
        return cls(
            variables=map(read(Variable), d.get('variables', {}).items()),
            properties=map(read(Property), d.get('properties', {}).items()),
            roles=map(read(Role), d.get('roles', {}).items()),
            predicates=map(read(Predicate), d.get('predicates', {}).items())
        )