def __init__(self): Subject.__init__(self) self.penlist = ["", "white", "black", "red", "yellow", "blue"] self.turtle = turtle.Turtle() self.pen_up() self.check = Ec().check self.triangle_size = 1
def __init__(self, db_name=FILENAME): global lock self.db_name = db_name self.lock = lock Subject.__init__(self) if not os.access(FILEDIR, os.F_OK): os.makedirs(FILEDIR) if not os.path.exists(self.db_name): self.__create()
def __init__(self): Subject.__init__(self) self.graphics = GraphWin("graphics.py", 500, 500) self.x = 250 self.y = 250 self.penDown = False self.color = "blue" self.penlist = ["", "white", "black", "red", "yellow", "blue"] self.check = Ec().check self.triangle_size = 1
def __init__(self, subject, num_of_rows=20, num_of_cols=20, ratio=0.1): assert ratio >= 0 and ratio <= 1 assert num_of_rows >= 0 and num_of_cols >= 0 Observer.__init__(self, subject) Subject.__init__(self) self.num_of_rows = num_of_rows self.num_of_cols = num_of_cols self.round = 0 self.map = [[1 if random() < ratio else 0 \ for _ in range(num_of_cols)] for _ in range(num_of_rows)]
def __init__(self, root, parent, factory): #super(FileTable, self).__init__() Observer.__init__(self) Subject.__init__(self) self._root = root self._parent = parent self._factory = factory self._fileHash = dict() self._dirHash = dict() self._fileSelector = Selector(r"^\s*(\d+) (.*)$") self._dirSelector = Selector(r"^\s*(.*)/$")
def __init__(self, ftp, fileListDir, lock=_threading.Lock()): if not isinstance(ftp, FTP): raise TypeError("gave 'ftp' parameters was not FTP.") #super(Listener, self).__init__() Subject.__init__(self) _threading.Thread.__init__(self) # 如果使用了多个Listener,并且他们都使用同一个lftp程序 # 那么请使用同一个线程锁(lock) self.lock = lock # Notice filetype code in python3 self.setName("{ftpHost}:{ftpDir}".format(ftpHost=ftp.host, ftpDir=fileListDir.encode("utf-8"))) self._ftpFileListDir = fileListDir self._localFilelist = '' self._ftp = ftp