def genkey(s): hashdb = safetch('hashkey.tch') key = pycabinet.get(hashdb,s) if key==None: key=ntsha1(s) pycabinet.put(hashdb,s,key) fname = safetch( "%s.tch" % key, autodir(s) ) return key
import pycabinet import os, sys p = sys.argv[1] dbname = pycabinet.get('hashkey.tch', p) data = pycabinet.list('data/1/%s.tch' % dbname) print "\n".join(data)
def __getitem__(self, k): if len(self.datapath) == 1: return safefloat(pycabinet.get(self.datapath[0], k)) return [safefloat(pycabinet.get(db, k)) for db in self.datapath]
def __getitem__(self,k): if len(self.datapath)==1: return safefloat(pycabinet.get(self.datapath[0],k)) return [safefloat(pycabinet.get(db,k)) for db in self.datapath]
import pycabinet import os,sys p = sys.argv[1] dbname = pycabinet.get('hashkey.tch',p) data = pycabinet.list('data/1/%s.tch' % dbname) print "\n".join(data)