def __init__(self, namespace): Namespace.__init__(self, namespace) self.messenger = WebSocketMessenger() self.identity = IdentityManager() self.get_game = GetGame() self.update_game = UpdateGame() self.game_rooms = GameRooms(self.messenger)
def __init__(self, room): """ Creates a new admin room, used to send updates to the admins """ self.key = uuid.uuid4() self.room = room Namespace.__init__(self, "/" + str(self.key)) socketio.on_namespace(self)
def __init__(self, host, port, rootdir, port_pool, polling_interval=20): self.port_pool = port_pool self.rootdir = rootdir self.host = host self.port = port self.exps = {} # Start jupyter jpt = shutil.which('jupyter') self.jupyter_port = p = get_free(self.port_pool) if jpt else -1 if jpt: csp = str(dict(headers={'Content-Security-Policy': f"frame-ancestors 'self' http://localhost:{self.port}/"})) logger.debug(f'Start jupyter ({jpt}) on port {p}') self.jupyter = subprocess.Popen([jpt, 'notebook', '--port='+str(p), '--no-browser', '/', "--NotebookApp.token=''", f"--NotebookApp.tornado_settings={csp}", f"--FileContentsManager.hide_globs=['']"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) Namespace.__init__(self, '/experiments') # Init Repo alt = '/tmp/chi_' + getpass.getuser() if os.path.exists(alt): os.remove(alt) root = os.path.expanduser('~/.chi') os.symlink(root, alt, target_is_directory=True) roots = [rootdir, join(root, 'experiments'), join(root, 'board'), join(root, 'apps')] for p in roots: mkdirs(os.path.expanduser(p)) bashrc = os.path.expanduser('~/.chi') + '/bashrc.sh' if os.path.exists(bashrc): os.remove(bashrc) os.symlink(os.path.expanduser('~/.bashrc'), bashrc) self.bashrc = bashrc self.connections = 0 Repo.__init__(self, roots) Repo.observer.start()
def __init__(self, name, hands): """ Creates a new room, name is a string and hands is a list of notifications to allow The Namespace is the guest namespace. """ global rooms self.name = name self.guest_key = uuid.uuid4() self.admin_room = AdminRoom(self) self.current_hands = {} for hand in hands: h = HandList(hand) self.current_hands[h.channel_id] = h rooms[self.guest_key] = self Namespace.__init__(self, "/" + str(self.guest_key)) socketio.on_namespace(self)
def __init__(self, namespace=None, sio=None): Namespace.__init__(self, namespace) self.__sio = sio
def __init__(self, namespace, socketio): self.socketio = socketio self.namespace = namespace Namespace.__init__(self, namespace)
def __init__(self): Namespace.__init__(self, "/chat")
def __init__(self, namespace, db_session): Namespace.__init__(self, namespace=namespace) self.db_session = db_session
def __init__(self, messagePublisher): Namespace.__init__(self, '') self.messagePublisher = messagePublisher
def __init__(self, dispatch_func, *args, namespace='/'): Namespace.__init__(self, namespace=namespace) self.dispatch_func = dispatch_func self.dispatch_cb_args = args
def __init__(self): Namespace.__init__(self, namespace="/notfications")