djdb/search.py
def load_and_segment_keys(fetched_keys, include_revoked=False):
    """Convert a series of datastore keys into a dict of lists of entities.

    Args:
      fetched_keys: A sequence of datastore keys, possibly returned by
        one of the above fetch_key_*() functions.

    Returns:
      A dict mapping entity kind names (which are strings) to
      lists of entities of that type.
    """
    segmented = {}
    for entity in AutoRetry(db).get(fetched_keys):
        if entity and (include_revoked or not getattr(entity, "revoked", False)):
            by_kind = segmented.get(entity.kind())
            if by_kind is None:
                by_kind = segmented[entity.kind()] = []
            by_kind.append(entity)
    for val in segmented.itervalues():
        val.sort(key=lambda x: x.sort_key)
    return segmented
Convert a series of datastore keys into a dict of lists of entities.

    Args:
      fetched_keys: A sequence of datastore keys, possibly returned by
        one of the above fetch_key_*() functions.

    Returns:
      A dict mapping entity kind names (which are strings) to
      lists of entities of that type.
    
Convert a series of datastore keys into a dict of lists of entities.
Convert a series of datastore keys into a dict of lists of entities .
def load_and_segment_keys(fetched_keys, include_revoked=False):
    segmented = {}
    for entity in AutoRetry(db).get(fetched_keys):
        if entity and (include_revoked or not getattr(entity, "revoked", False)):
            by_kind = segmented.get(entity.kind())
            if by_kind is None:
                by_kind = segmented[entity.kind()] = []
            by_kind.append(entity)
    for val in segmented.itervalues():
        val.sort(key=lambda x: x.sort_key)
    return segmented
def load_and_segment_keys ( fetched_keys , include_revoked = False ) : segmented = { } for entity in AutoRetry ( db ) . get ( fetched_keys ) : if entity and ( include_revoked or not getattr ( entity , "revoked" , False ) ) : by_kind = segmented . get ( entity . kind ( ) ) if by_kind is None : by_kind = segmented [ entity . kind ( ) ] = [ ] by_kind . append ( entity ) for val in segmented . itervalues ( ) : val . sort ( key = lambda x : x . sort_key ) return segmented
Convert a series of datastore keys into a dict of lists of entities.
Convert a series of datastore keys into a dict of lists of entities .
"""Convert a series of datastore keys into a dict of lists of entities.

    Args:
      fetched_keys: A sequence of datastore keys, possibly returned by
        one of the above fetch_key_*() functions.

    Returns:
      A dict mapping entity kind names (which are strings) to
      lists of entities of that type.
    """
A dict mapping entity kind names (which are strings) to
lists of entities of that type.
A dict mapping entity kind names ( which are strings ) to lists of entities of that type .
fetched_keys
A sequence of datastore keys, possibly returned by
one of the above fetch_key_*() functions.
A sequence of datastore keys possibly returned by one of the above fetch_key_ * () functions .
include_revoked