Massive structure rewrite
This commit is contained in:
2
helpers/__init__.py
Normal file
2
helpers/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import uuid
|
||||
from . import connection
|
||||
10
helpers/connection.py
Normal file
10
helpers/connection.py
Normal 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
8
helpers/uuid.py
Normal 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)
|
||||
Reference in New Issue
Block a user