def __init__(self, options, config): """Initializes all of the submodules bitHopper uses""" #Logging logging.basicConfig(stream=sys.stdout, format="%(asctime)s|%(module)s: %(message)s", datefmt="%H:%M:%S", level = logging.INFO) self.options = options self.config = config altercoins = ConfigParser.ConfigParser() altercoins.read(os.path.join(sys.path[0], "whatevercoin.cfg")) self.altercoins = {} for coin in altercoins.sections(): self.altercoins[coin] = dict(altercoins.items(coin)) self.altercoins[coin]['recent_difficulty'] = float(self.altercoins[coin]['recent_difficulty']) self.scheduler = None self.lp_callback = lp_callback.LP_Callback(self) self.difficulty = diff.Difficulty(self) self.exchange = exchange.Exchange(self) self.pool = None self.db = database.Database(self) self.pool = pool.Pool_Parse(self) self.api = api.API(self) self.pool.setup(self) self.work = work.Work(self) self.speed = speed.Speed() self.getwork_store = getwork_store.Getwork_store(self) self.data = data.Data(self) self.lp = lp.LongPoll(self) self.auth = None self.website = website.bitSite(self) self.pile = greenpool.GreenPool() self.plugin = plugin.Plugin(self) self.pile.spawn_n(self.delag_server)
def addWork(medium): #input: valid medium string #user input: work title string #output: none #user output: none, really global workDict global mediumList if medium not in mediumList: print("Invalid medium, otend did something wrong") else: inName = input("What is the name of the work? ") workDict[medium].append(work.Work(inName))
def attachWorkToAuthor(workName, date, authorName): authorInstance = dynamicobjectkeeper.getAuthor(authorName) if authorInstance == None: authorInstance = author.Author(authorName) dynamicobjectkeeper.pushAuthor(authorInstance) workInstance = work.Work(workName, date) authorInstance.attachWork(workInstance) return
def __init__(self): asset.Asset.__init__(self) self.category = asset.WORKPLACE self.max_users = np.inf # set the location self.location.local = location.OFF_SITE # the work activity self.activities = { 'work': work.Work(), } return
def initUI(self): self.setWindowTitle('니짐내짐 데이터 입력 프로그램') self.setWindowIcon(QIcon('니짐내짐.png')) self.resize(500, 500) self.center() # 라벨 log_lb = QLabel('Logs', self) progress_lb = QLabel('진행률', self) self.progress_value_lb = QLabel('0%', self) self.btn = QPushButton('취소', self) self.log_wid = QListWidget() self.progress_wid = QProgressBar() self.btn.clicked.connect(self.submit) #박스 설정 hbox7 = self.add_box([log_lb, self.log_wid]) hbox8 = self.add_box( [progress_lb, self.progress_wid, self.progress_value_lb]) hboxLast = QHBoxLayout() hboxLast.addStretch(1) hboxLast.addWidget(self.btn) hboxLast.addStretch(1) vbox = QVBoxLayout() vbox.addStretch(3) vbox.addLayout(hbox8) vbox.addLayout(hbox7) vbox.addLayout(hboxLast) vbox.addStretch(3) self.setLayout(vbox) self.show() th1 = work.Work(self.data) th1.start() th1.countChanged.connect(self.onCountChanged) th1.logChanged.connect(self.onLogChanged) th1.insertChanged.connect(self.onInsertChanged) return self.data
url = followingURL + '/' + str(i * 25) res = request.urlopen(url).read().decode('UTF-8', 'ignore') res = re.findall(pattern, res) for link in res: nickName = getNickNameByLink(link[0]) db.insert_user(nickName, getUpdateDay(link[1])) uid = db.getUidByName(nickName) works.put((getUserPostData, uid)) arrResult.extend(res) break threads = [] maxThreadCnt = 4 for i in range(0, maxThreadCnt): w = work.Work(works) threads.append(w) for t in threads: t.join() exit(0) ##### unfollow followingURL = "https://www.tumblr.com/following" res = request.urlopen(followingURL).read().decode('UTF-8') reStr = '<a class="tab selected" href="/following">在 Tumblr 上关注 (.*?)</a>' followCnt = re.findall(reStr, res)[0] reStr = '<meta name="tumblr-form-key" content="(.*?)" id="tumblr_form_key">' formkey = re.findall(reStr, res)[0]
def initWorkList(self, l): for d in l: self.workList.append(work.Work(day=d))