chore: using a database for keys
Browse files- handler.py +0 -12
handler.py
CHANGED
@@ -24,10 +24,6 @@ class EndpointHandler:
|
|
24 |
# Simulate a database of keys
|
25 |
self.key_database = {}
|
26 |
|
27 |
-
self.key_database[43] = "benoit"
|
28 |
-
|
29 |
-
print(f"{time.time()}: enter in the init")
|
30 |
-
|
31 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
32 |
"""
|
33 |
data args:
|
@@ -37,8 +33,6 @@ class EndpointHandler:
|
|
37 |
A :obj:`list` | `dict`: will be serialized and returned
|
38 |
"""
|
39 |
|
40 |
-
print(f"{time.time()}: enter in the call")
|
41 |
-
|
42 |
# Get method
|
43 |
method = data.pop("method", data)
|
44 |
|
@@ -52,9 +46,6 @@ class EndpointHandler:
|
|
52 |
while uid in self.key_database.keys():
|
53 |
uid = np.random.randint(2**32)
|
54 |
|
55 |
-
# BCM
|
56 |
-
uid = 42
|
57 |
-
|
58 |
self.key_database[uid] = evaluation_keys
|
59 |
|
60 |
return {"uid": uid}
|
@@ -63,9 +54,6 @@ class EndpointHandler:
|
|
63 |
|
64 |
uid = data.pop("uid", data)
|
65 |
|
66 |
-
# BCM
|
67 |
-
uid = 42
|
68 |
-
|
69 |
assert uid in self.key_database.keys(), f"{uid} not in DB, {self.key_database.keys()=}"
|
70 |
|
71 |
# Get inputs
|
|
|
24 |
# Simulate a database of keys
|
25 |
self.key_database = {}
|
26 |
|
|
|
|
|
|
|
|
|
27 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
28 |
"""
|
29 |
data args:
|
|
|
33 |
A :obj:`list` | `dict`: will be serialized and returned
|
34 |
"""
|
35 |
|
|
|
|
|
36 |
# Get method
|
37 |
method = data.pop("method", data)
|
38 |
|
|
|
46 |
while uid in self.key_database.keys():
|
47 |
uid = np.random.randint(2**32)
|
48 |
|
|
|
|
|
|
|
49 |
self.key_database[uid] = evaluation_keys
|
50 |
|
51 |
return {"uid": uid}
|
|
|
54 |
|
55 |
uid = data.pop("uid", data)
|
56 |
|
|
|
|
|
|
|
57 |
assert uid in self.key_database.keys(), f"{uid} not in DB, {self.key_database.keys()=}"
|
58 |
|
59 |
# Get inputs
|