-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDb.py
More file actions
32 lines (23 loc) · 647 Bytes
/
Copy pathDb.py
File metadata and controls
32 lines (23 loc) · 647 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding=utf-8
import numpy as np
class Db(object):
def __init__(self, paths):
self.__paths = paths
@staticmethod
def load(config):
dbPath = config['dbPath']
paths = np.load(dbPath)
return Db(paths)
def getPath(self, indexs):
# paths = [self.__paths[index] for index in indexs]
paths = list(self.__paths[indexs])
return paths
if __name__ == '__main__':
# ##################################
# # 使用范例
# ##################################
config = {
'dbPath': 'data/path.npy'
}
db = Db.load(config)
print(db.getPath([1, 2]))