Beispiel #1
0
 def __hash__(self):
     try:
         id_hash = int(self.identifier)
     except ValueError:
         id_hash = elfhash(self.identifier.encode())
     return id_hash * 1000 + id(type(self)) % 1000
Beispiel #2
0
def gen_id(s):
    return str(elfhash(base64.b64encode(bytes(s, 'utf-8'))))
Beispiel #3
0
 def get_coll_id(self, coll):
     # TODO: 目前还没想好 collection identifier 计算方法,故添加这个函数
     # 现在把 fpath 当作 identifier 使用,但对外透明
     return elfhash(base64.b64encode(bytes(coll.fpath, 'utf-8')))
Beispiel #4
0
 def __hash__(self):
     id_hash = elfhash(self.identifier.encode())
     return id_hash * 1000 + id(type(self)) % 1000
Beispiel #5
0
 def __hash__(self):
     id_hash = elfhash(f'{self.source}{self.identifier}'.encode())
     return id_hash * 1000 + id(type(self)) % 1000