-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_AssignedUserPools.py
More file actions
27 lines (23 loc) · 1.23 KB
/
_AssignedUserPools.py
File metadata and controls
27 lines (23 loc) · 1.23 KB
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
from typing import Optional
from uuid import UUID
from PoolType import PoolType
#########################################################################################################
#########################################################################################################
##### _AssignedUSerPools (Private) #####
##### - A class to keep track of which user is assigned to which pool. #####
#########################################################################################################
#########################################################################################################
class _AssignedUserPools:
def __init__(self) -> None:
self.pools: dict[PoolType, UUID] = {}
def assign_pool(self, pool_type: PoolType, pool_id: Optional[UUID]) -> None:
if pool_id is None:
if pool_type in self.pools:
del self.pools[pool_type]
else:
self.pools[pool_type] = pool_id
def get_pool(self, pool_type: PoolType) -> Optional[UUID]:
if pool_type in self.pools:
return self.pools[pool_type]
else:
return None