Massive structure rewrite

This commit is contained in:
2020-02-21 15:45:30 +01:00
parent 1c807c2af4
commit 17d14d45ae
10 changed files with 347 additions and 26 deletions

2
helpers/__init__.py Normal file
View File

@@ -0,0 +1,2 @@
from . import uuid
from . import connection

10
helpers/connection.py Normal file
View File

@@ -0,0 +1,10 @@
from objects import glob
def connect(sid):
glob.connections[sid] = set()
def disconnect(sid):
for display in glob.connections[sid]:
display.detach(sid)
del glob.connections[sid]

8
helpers/uuid.py Normal file
View File

@@ -0,0 +1,8 @@
from random import randint
UUID_SIZE = (8, 4, 4, 4, 12)
UUID_GLUE = "-"
def generate():
#[randint(0, 15) for s in UUID_SIZE for _ in range(s)]
return "-".join("".join(format(randint(0, 15), "x") for _ in range(s)) for s in UUID_SIZE)