print the index as a dict
424129
def DisplayIndexAsDictionary(word_occurrences):
    
    word_keys = word_occurrences.keys()
    for num, word in enumerate(word_keys):
        line_nums = word_occurrences[word]
        print(word + " ")
        if num > 3:
            break
554115
def _read_info_as_dict(fid, values):
    
    output = {}
    for key, fmt in values:
        val = unpack(fmt, fid.read(calcsize(fmt)))
        if len(val) == 1:
            output[key] = val[0]
        else:
            output[key] = val
    return output
1317434
def as_dict(self):
        
        output_dictionary = dict()

        for key, value in iter(self._key_map.items()):
            if isinstance(value, bool):
                output_dictionary[key] = value
            elif isinstance(value, self.__class__):
                output_dictionary[key] = value.as_dict()

        return output_dictionary
1057868
def to_param_dict(self):
        
        param_dict = {}
        for index, dictionary in enumerate(self.value):
            for key, value in dictionary.items():
                param_name = '{param_name}[{index}][{key}]'.format(
                                                    param_name=self.param_name,
                                                    index=index,
                                                    key=key)
                param_dict[param_name] = value
        return OrderedDict(sorted(param_dict.items()))
969953
def get_dict_to_print(field_to_obs):
  

  def compressed_steps(steps):
    return {'num_steps': len(set(steps)),
            'min_step': min(steps),
            'max_step': max(steps),
            'last_step': steps[-1],
            'first_step': steps[0],
            'outoforder_steps': get_out_of_order(steps)}

  def full_steps(steps):
    return {'steps': steps, 'outoforder_steps': get_out_of_order(steps)}

  output = {}
  for field, observations in field_to_obs.items():
    if not observations:
      output[field] = None
      continue

    steps = [x['step'] for x in observations]
    if field in SHORT_FIELDS:
      output[field] = compressed_steps(steps)
    if field in LONG_FIELDS:
      output[field] = full_steps(steps)

  return output
913145
def as_dict(self):
        """"""

        d = {}
        for key, value in self:
            d.setdefault(key, []).append(value)
        return d
1321415
def to_dict(self):
        
        return dict((k, self.get(k)) for k in self.flags.keys())
1034836
def get_as_dict(self):
        
        """
        def convert(val):
            if isinstance(val, tuple):
                return tuple(convert(v) for v in val)
            elif isinstance(val, list):
                return [convert(v) for v in val]
            elif isinstance(val, (dict, ElasticDict)):
                return {k: convert(v) for k, v in val.iteritems()}
            else:
                return val

        return convert(self.__dict__)
1024568
def as_dict(self):
        
        out = {}
        for prop in self:
            propval = getattr(self, prop)

            if hasattr(propval, 'for_json'):
                out[prop] = propval.for_json()
            elif isinstance(propval, list):
                out[prop] = [getattr(x, 'for_json', lambda:x)() for x in propval]
            elif isinstance(propval, (ProtocolBase, LiteralValue)):
                out[prop] = propval.as_dict()
            elif propval is not None:
                out[prop] = propval

        return out
264129
def dicttotext(d, sort=False, max = 0):
    """"""
    if sort:
        f = lambda x: sorted(x, key=lambda y: -1 * y[1])
    else:
        f = lambda x: x

    output = ""
    for i, (key, value) in enumerate(f(d.items())):
        output += key + "\t" + str(value) + "\n"
        if max != 0 and i >= max:
            break
    return output
699931
def list_keys(self):
        """"""
        keys = self._curl_bitmex("/apiKey/")
        print(json.dumps(keys, sort_keys=True, indent=4))
16554
def as_dictionary(self):
        """"""
        values = {
            'id': self._id,
            'type': self._type
        }

        if self._owner:
            values['owner'] = self._owner
        return values
814038
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'results') and self.results is not None:
            _dict['results'] = [x._to_dict() for x in self.results]
        if hasattr(self, 'count') and self.count is not None:
            _dict['count'] = self.count
        return _dict
613028
def to_dict(self):
        
        return {k: v.to_dict() if isinstance(v, AttrDict) else v
                for k, v in self.__dict__.items() if not k.startswith('_')}
616661
def as_dict(self):
        
        return {"name": self.name,
                "@module": self.__class__.__module__,
                "@class": self.__class__.__name__}
415544
def to_dict(self):
        
        return dict((k, str(self.get(k))) for k in self.raw_dict)
547600
def edge_index(self):
        """"""
        return dict((edge, index) for index, edge in enumerate(self.edges))