Ejemplo n.º 1
0
Archivo: dbs.py Proyecto: bthate67/mbx
def deleted(otype):
    otypes = Names.getnames(otype, [otype,])
    for t in otypes:
        for fn in fns(t):
            o = hook(fn)
            if "_deleted" not in o or not o._deleted:
                continue
            yield fn, o
Ejemplo n.º 2
0
Archivo: dbs.py Proyecto: bthate67/mbx
def every(selector=None, index=None, timed=None):
    nr = -1
    if selector is None:
        selector = {}
    for otype in os.listdir(os.path.join(cfg.wd, "store")):
        for fn in fns(otype, timed):
            o = hook(fn)
            if selector and not search(o, selector):
                continue
            if "_deleted" in o and o._deleted:
                continue
            nr += 1
            if index is not None and nr != index:
                continue
            yield fn, o
Ejemplo n.º 3
0
Archivo: dbs.py Proyecto: bthate67/mbx
def all(otype, selector=None, index=None, timed=None):
    nr = -1
    if selector is None:
        selector = {}
    otypes = Names.getnames(otype, [otype,])
    for t in otypes:
        for fn in fns(t, timed):
            o = hook(fn)
            if selector and not search(o, selector):
                continue
            if "_deleted" in o and o._deleted:
                continue
            nr += 1
            if index is not None and nr != index:
                continue
            yield fn, o
Ejemplo n.º 4
0
Archivo: dbs.py Proyecto: bthate67/mbx
def find(otype, selector=None, index=None, timed=None):
    if selector is None:
        selector = {}
    otypes = Names.getnames(otype, [otype,])
    got = False
    nr = -1
    for t in otypes:
        for fn in fns(t, timed):
            o = hook(fn)
            if selector and not search(o, selector):
                continue
            if "_deleted" in o and o._deleted:
                continue
            nr += 1
            if index is not None and nr != index:
                continue
            got = True
            yield (fn, o)
    if not got:
        return (None, None)
Ejemplo n.º 5
0
Archivo: dbs.py Proyecto: bthate67/mbx
def lastfn(otype):
    fn = fns(otype)
    if fn:
        fnn = fn[-1]
        return (fnn, hook(fnn))
    return (None, None)
Ejemplo n.º 6
0
Archivo: dbs.py Proyecto: bthate67/mbx
def lasttype(otype):
    fnn = fns(otype)
    if fnn:
        return hook(fnn[-1])