示例#1
0
文件: dbs.py 项目: 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
示例#2
0
文件: dbs.py 项目: 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
示例#3
0
文件: dbs.py 项目: 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
示例#4
0
文件: dbs.py 项目: 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)
示例#5
0
文件: dbs.py 项目: bthate67/mbx
def lastfn(otype):
    fn = fns(otype)
    if fn:
        fnn = fn[-1]
        return (fnn, hook(fnn))
    return (None, None)
示例#6
0
文件: dbs.py 项目: bthate67/mbx
def lasttype(otype):
    fnn = fns(otype)
    if fnn:
        return hook(fnn[-1])