import os class Channel(object): def __init__(self, server, name): self.server = server self.name = name self.members = set() def add_member(self, client): self.members.add(client) def remove_client(self, client): self.members.discard(client) if not self.members: self.server.remove_channel(self)