bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def endTagListItem(self, token): if token["name"] == "li": variant = "list" else: variant = None if not self.tree.elementInScope(token["name"], variant=variant): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) else: self.tree.generateImpliedEndTags(exclude = token["name"]) if self.tree.openElement...
def endTagListItem(self, token): if token["name"] == "li": variant = "list" else: variant = None if not self.tree.elementInScope(token["name"], variant=variant): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) else: self.tree.generateImpliedEndTags(exclude = token["name"]) if self.tree.openElement...
458,200
def endTagHeading(self, token): for item in headingElements: if self.tree.elementInScope(item): self.tree.generateImpliedEndTags() break if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
def endTagHeading(self, token): for item in headingElements: if self.tree.elementInScope(item): self.tree.generateImpliedEndTags() break if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
458,201
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
458,202
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
458,203
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
458,204
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
def endTagFormatting(self, token): """The much-feared adoption agency algorithm""" # http://www.whatwg.org/specs/web-apps/current-work/#adoptionAgency # XXX Better parseError messages appreciated. name = token["name"] while True: # Step 1 paragraph 1 formattingElement = self.tree.elementInActiveFormattingElements( toke...
458,205
def endTagAppletMarqueeObject(self, token): if self.tree.elementInScope(token["name"]): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
def endTagAppletMarqueeObject(self, token): if self.tree.elementInScope(token["name"]): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("end-tag-too-early", {"name": token["name"]})
458,206
def endTagOther(self, token): for node in self.tree.openElements[::-1]: if node.name == token["name"]: self.tree.generateImpliedEndTags(exclude=token["name"]) if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) while self.tree.openElements.pop() != ...
def endTagOther(self, token): for node in self.tree.openElements[::-1]: if node.name == token["name"]: self.tree.generateImpliedEndTags(exclude=token["name"]) if self.tree.openElements[-1].name != token["name"]: self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) while self.tree.openElements.pop() != ...
458,207
def clearStackToTableContext(self): # "clear the stack back to a table context" while self.tree.openElements[-1].name not in ("table", "html"): #self.parser.parseError("unexpected-implied-end-tag-in-table", # {"name": self.tree.openElements[-1].name}) self.tree.openElements.pop() # When the current node is <html> it'...
def clearStackToTableContext(self): # "clear the stack back to a table context" while self.tree.openElements[-1].name not in ("table", "html"): #self.parser.parseError("unexpected-implied-end-tag-in-table", # {"name": self.tree.openElements[-1].name}) self.tree.openElements.pop() # When the current node is <html> it'...
458,208
def startTagStyleScript(self, token): self.parser.phases["inHead"].processStartTag(token)
def startTagStyleScript(self, token): self.parser.phases["inHead"].processStartTag(token)
458,209
def startTagInput(self, token): if ("type" in token["data"] and token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): self.parser.parseError("unexpected-hidden-input-in-table") self.tree.insertElement(token) # XXX associate with form self.tree.openElements.pop() else: self.startTagOther(token)
def startTagInput(self, token): if ("type" in token["data"] and token["data"]["type"].translate(asciiUpper2Lower) == "hidden"): self.parser.parseError("unexpected-hidden-input-in-table") self.tree.insertElement(token) # XXX associate with form self.tree.openElements.pop() else: self.startTagOther(token)
458,210
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
458,211
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
def endTagTable(self, token): if self.tree.elementInScope("table", variant="table"): self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "table": self.parser.parseError("end-tag-too-early-named", {"gotName": "table", "expectedName": self.tree.openElements[-1].name}) while self.tree.openElements[-1]...
458,212
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
458,213
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
def endTagCaption(self, token): if not self.ignoreEndTagCaption(): # AT this code is quite similar to endTagTable in "InTable" self.tree.generateImpliedEndTags() if self.tree.openElements[-1].name != "caption": self.parser.parseError("expected-one-end-tag-but-got-another", {"gotName": "caption", "expectedName": self.tr...
458,214
def processEOF(self): if self.tree.openElements[-1].name == "html": assert self.parser.innerHTML return else: ignoreEndTag = self.ignoreEndTagColgroup() self.endTagColgroup(impliedTagToken("colgroup")) if not ignoreEndTag: self.parser.phase.processEOF()
def processEOF(self): if self.tree.openElements[-1].name == "html": assert self.parser.innerHTML return else: ignoreEndTag = self.ignoreEndTagColgroup() self.endTagColgroup(impliedTagToken("colgroup")) if not ignoreEndTag: self.parser.phase.processEOF()
458,215
def endTagColgroup(self, token): if self.ignoreEndTagColgroup(): # innerHTML case assert self.parser.innerHTML self.parser.parseError() else: self.tree.openElements.pop() self.parser.phase = self.parser.phases["inTable"]
def endTagColgroup(self, token): if self.ignoreEndTagColgroup(): # innerHTML case assert self.parser.innerHTML self.parser.parseError() else: self.tree.openElements.pop() self.parser.phase = self.parser.phases["inTable"]
458,216
def endTagTable(self, token): if (self.tree.elementInScope("tbody", variant="table") or self.tree.elementInScope("thead", variant="table") or self.tree.elementInScope("tfoot", variant="table")): self.clearStackToTableBodyContext() self.endTagTableRowGroup( impliedTagToken(self.tree.openElements[-1].name)) self.parser.p...
def endTagOther(self, token): self.parser.phases["inTable"].processEndTag(token) class InRowPhase(Phase): def __init__(self, parser, tree): Phase.__init__(self, parser, tree) self.startTagHandler = utils.MethodDispatcher([ ("html", self.startTagHtml), (("td", "th"), self.startTagTableCell), (("caption", "col", "colg...
458,217
def endTagTable(self, token): if (self.tree.elementInScope("tbody", variant="table") or self.tree.elementInScope("thead", variant="table") or self.tree.elementInScope("tfoot", variant="table")): self.clearStackToTableBodyContext() self.endTagTableRowGroup( impliedTagToken(self.tree.openElements[-1].name)) self.parser.p...
def endTagTable(self, token): if (self.tree.elementInScope("tbody", variant="table") or self.tree.elementInScope("thead", variant="table") or self.tree.elementInScope("tfoot", variant="table")): self.clearStackToTableBodyContext() self.endTagTableRowGroup( impliedTagToken(self.tree.openElements[-1].name)) self.parser.p...
458,218
def ignoreEndTagTr(self): return not self.tree.elementInScope("tr", variant="table")
def ignoreEndTagTr(self): return not self.tree.elementInScope("tr", variant="table")
458,219
def startTagOther(self, token): self.parser.phases["inTable"].processStartTag(token)
def startTagOther(self, token): self.parser.phases["inTable"].processStartTag(token)
458,220
def endTagTableRowGroup(self, token): if self.tree.elementInScope(token["name"], variant="table"): self.endTagTr(impliedTagToken("tr")) self.parser.phase.processEndTag(token) else: # innerHTML case assert self.parser.innerHTML self.parser.parseError()
def endTagTableRowGroup(self, token): if self.tree.elementInScope(token["name"], variant="table"): self.endTagTr(impliedTagToken("tr")) self.parser.phase.processEndTag(token) else: # innerHTML case assert self.parser.innerHTML self.parser.parseError()
458,221
def readChunk(self, chunkSize=None): if chunkSize is None: chunkSize = self._defaultChunkSize
def readChunk(self, chunkSize=None): if chunkSize is None: chunkSize = self._defaultChunkSize
458,222
def run(self): dataset, mapping = npy_cached_load(self.cellpath) queryset = FEATURE_VIEW(load_file(self.qpath)) flann = pyflann.FLANN() params = flann.build_index(dataset, kwargs=self.params) INFO(params) results, dists = flann.nn_index(queryset, self.params['nn'], checks=self.params['checks']) INFO(results) INFO(dists...
def run(self): records, mapping = npy_cached_load(self.cellpath) query = load_file(self.qpath) queryset = FEATURE_VIEW(query) flann = pyflann.FLANN() params = flann.build_index(dataset, kwargs=self.params) INFO(params) results, dists = flann.nn_index(queryset, self.params['nn'], checks=self.params['checks']) INFO(resul...
458,223
def run(self): dataset, mapping = npy_cached_load(self.cellpath) queryset = FEATURE_VIEW(load_file(self.qpath)) flann = pyflann.FLANN() params = flann.build_index(dataset, kwargs=self.params) INFO(params) results, dists = flann.nn_index(queryset, self.params['nn'], checks=self.params['checks']) INFO(results) INFO(dists...
def run(self): dataset, mapping = npy_cached_load(self.cellpath) queryset = FEATURE_VIEW(load_file(self.qpath)) flann = pyflann.FLANN() params = flann.build_index(FEATURE_VIEW(records), kwargs=self.params) INFO(params) results, dists = flann.nn_index(queryset, self.params['nn'], checks=self.params['checks']) INFO(resul...
458,224
def run_parallel(dbdir, cells, querydir, querysift, outputFilePaths, params, num_threads=4): semaphore = threading.Semaphore(num_threads) threads = [] for cell, outputFilePath in zip(cells, outputFilePaths): if not os.path.exists(outputFilePath): thread = Query(dbdir, cell, querydir, querysift, outputFilePath, params, ...
def run_parallel(dbdir, cells, querydir, querysift, outputFilePaths, params, num_threads=8): semaphore = threading.Semaphore(num_threads) threads = [] for cell, outputFilePath in zip(cells, outputFilePaths): if not os.path.exists(outputFilePath): thread = Query(dbdir, cell, querydir, querysift, outputFilePath, params, ...
458,225
def npy_cached_load(directory, map_only=False): """Efficiently loads a matrix of sift features and reverse lookup table for a directory of sift files.""" cellid = getcellid(directory) data_out = getfile(directory, cellid + '-features.npy') key_out = getfile(directory, cellid + '-keys.npy') map_out = getfile(directory, ...
def npy_cached_load(directory, map_only=False): """Efficiently loads a matrix of sift features and reverse lookup table for a directory of sift files.""" cellid = getcellid(directory) data_out = getfile(directory, cellid + '-features.npy') key_out = getfile(directory, cellid + '-keys.npy') map_out = getfile(directory, ...
458,226
def write_scores(querysift, ranked_matches, outdir): if not os.path.exists(outdir): os.makedirs(outdir) outfile = open(os.path.join(outdir, querysift + ".top"), 'w') for matchedimg, score in ranked_matches: outfile.write(str(score)) outfile.write('\t') outfile.write(matchedimg) outfile.write('\n')
def write_scores(querysift, ranked_matches, outdir): if not os.path.exists(outdir): os.makedirs(outdir) outfile = open(os.path.join(outdir, querysift + ".top"), 'w') for matchedimg, score in ranked_matches: outfile.write(str(score)) outfile.write('\t') outfile.write(matchedimg) outfile.write('\n')
458,227
def query2(querydir, querysift, dbdir, mainOutputDir, nClosestCells, copytopmatch, copy_top_n_percell=0): lat, lon = info.getQuerySIFTCoord(querysift) closest_cells = util.getclosestcells(lat, lon, dbdir) outputFilePaths = [] cells_in_range = [(cell, dist) for cell, dist in closest_cells[0:nClosestCells] if dist < cell...
def query2(querydir, querysift, dbdir, mainOutputDir, nClosestCells, copytopmatch, copy_top_n_percell=0): lat, lon = info.getQuerySIFTCoord(querysift) closest_cells = util.getclosestcells(lat, lon, dbdir) outputFilePaths = [] cells_in_range = [(cell, dist) for cell, dist in closest_cells[0:nClosestCells] if dist < cell...
458,228
def getfile(directory, name): default = os.path.join(os.path.dirname(directory), name) if IS_REMOTE(directory): local = os.path.join(CACHE_PATH, name) if os.path.exists(local): return local elif os.path.exists(default): INFO('copying %s to local cache' % name) shutil.copyfile(default, local) return local return default...
def getfile(directory, name): default = os.path.join(os.path.dirname(directory), name) if IS_REMOTE(directory): local = os.path.join(CACHE_PATH, name) if os.path.exists(local): return local elif os.path.exists(default): INFO('copying %s to local cache' % name) shutil.copyfile(default, local + '.tmp') os.rename(local + ...
458,229
def update(self, player, response): if not self.running: return if player is None: self.adapter.reply('You didn\'t specify a player.') return elif player != self.currentAct.player.nickname: # People are allowed to sit out, out of turn if (response[0] != script.Action.SitOut and response[0] != script.Action.AutopostBlin...
def update(self, player, response): if not self.running: return if player is None: self.adapter.reply('You didn\'t specify a player.') return elif (isinstance(self.currentAct, script.Action) and player != self.currentAct.player.nickname): # People are allowed to sit out, out of turn if (response[0] != script.Action.Sit...
458,230
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): self.bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,231
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting self.reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,232
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,233
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,234
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,235
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,236
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,237
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,238
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,239
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,240
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,241
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
def run(self): bettingFinished = False # Whether to re-open betting when a shorty goes all-in # and caps the betting reOpenBetting = False # Betting Round is closed. bettingClosed = False
458,242
def __init__(self, s): self.nickname = s
def __init__(self, s): self.nickname = s
458,243
def __init__(self, s): self.nickname = s
def __init__(self, s): self.nickname = s
458,244
def __init__(self, s): self.nickname = s
def __init__(self, s): self.nickname = s
458,245
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
458,246
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
458,247
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
458,248
def __init__(self): super(MdiTable, self).__init__() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) #self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
def __init__(self): super(MdiTable, self).__init__() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) #self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
458,249
def createSidebarItems(self): icon = lambda s: QtGui.QIcon('./data/gfx/icons/' + s)
def createSidebarItems(self): icon = lambda s: QtGui.QIcon('./data/gfx/icons/' + s)
458,250
def pmHands(self, cardsDealt): players = cardsDealt.players for player in players: c = cardsDealt.get_player_hand(player) self.adapter.privmsg('genjix', {'cards': c})
def pmHands(self, cardsDealt): players = cardsDealt.players for player in players: c = cardsDealt.get_player_hand(player) self.adapter.privmsg('genjix', {'cards': c})
458,251
def __init__(self, prot, chan): reload(script) reload(table) self.prot = prot self.chan = chan self.cash = table.Table(9, 0.25, 0.5, 0, 5000, 25000) self.cash.registerScheduler(Schedule(self.reply)) self.handler = Handler(self) self.cash.registerHandler(self.handler) self.cash.setStartupDelayTime(0)
def __init__(self, prot, chan): reload(script) reload(table) self.prot = prot self.chan = chan self.cash = table.Table(9, 0.25, 0.5, 0, 5000, 25000) self.cash.registerScheduler(Schedule(self.reply)) self.handler = Handler(self) self.cash.registerHandler(self.handler) self.cash.setStartupDelayTime(0)
458,252
def msg(self, user, message): print('%s: %s'%(user, message))
def msg(self, user, message): print('%s: %s'%(user, message))
458,253
def msg(self, user, message): print('%s: %s'%(user, message))
def msg(self, user, message): print('%s: %s'%(user, message))
458,254
def start(self): """Start the game.""" if self.gameState != GameState.Starting: if self.gameState == GameState.Running: print('Game already running.') else: print('Start game cancelled.') return self.gameState = GameState.Running print('Game started.') # select a random dealer occupiedSeats = \ [i for i, p in enumerate...
def start(self): """Start the game.""" if self.gameState != GameState.Starting: if self.gameState == GameState.Running: print('Game already running.') else: print('Start game cancelled.') return self.gameState = GameState.Running print('Game started.') # select a random dealer occupiedSeats = \ [i for i, p in enumerate...
458,255
def nextDealer(self): # Get list of indices of the seats rotatedSeats = [i for i, p in enumerate(self.seats)] # Rotate it around the current dealer position + 1 rotatedSeats = \ rotatedSeats[self.dealer+1:] + rotatedSeats[:self.dealer+1] # Filter empty seats and sitting out players filterSeats = [i for i in rotatedSeat...
def nextDealer(self): # Get list of indices of the seats rotatedSeats = [i for i, p in enumerate(self.seats)] # Rotate it around the current dealer position + 1 rotatedSeats = \ rotatedSeats[self.dealer+1:] + rotatedSeats[:self.dealer+1] # Filter empty seats and sitting out players filterSeats = [i for i in rotatedSeat...
458,256
def addchip(chip, scene, pos): other = scene.addPixmap(chip) other.setTransformationMode(QtCore.Qt.SmoothTransformation) other.setFlags(other.ItemIsMovable) other.setPos(*pos)
def addchip(chip, scene, pos): other = scene.addPixmap(chip) other.setTransformationMode(QtCore.Qt.SmoothTransformation) other.setFlags(other.ItemIsMovable) other.setPos(*pos)
458,257
def __init__(self): self.bet = 0 self.darkbet = 0 self.active = True
def __init__(self): self.bet = 0 self.darkbet = 0 self.active = True
458,258
def __init__(self): self.bet = 0 self.darkbet = 0 self.active = True
def __init__(self): self.bet = 0 self.darkbet = 0 self.active = True
458,259
def link(self, parent): self.parent = parent # attach self to parent self.parent.betpart = self
def link(self, parent): self.parent = parent # attach self to parent self.parent.betpart = self
458,260
def raiseto(self, bet): price = bet - self.bet if price >= self.parent.stack: self.pay(self.parent.stack) raise AllIn(self) self.pay(price)
def raiseto(self, bet): price = bet - self.bet if price >= self.parent.stack: self.pay(self.parent.stack) raise AllIn(self) self.pay(price)
458,261
def run(self): for player in self.players: bettor = player.betpart bettor.begin_stack = player.stack
def run(self): for player in self.players: bettor = player.betpart bettor.begin_stack = player.stack
458,262
def run(self): for player in self.players: bettor = player.betpart bettor.begin_stack = player.stack
def run(self): for player in self.players: bettor = player.betpart bettor.begin_stack = player.stack
458,263
def prompt_open(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingFinished return False elif bettor.stack == 0: return False
def prompt_open(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingFinished return False elif bettor.stack == 0: return False
458,264
def prompt_open(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingFinished return False elif bettor.stack == 0: return False
def prompt_open(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingFinished return False elif bettor.stack == 0: return False
458,265
def prompt_capped(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingClosed elif bettor == self.cap_bettor: self.state = Rotator.BettingFinished return False
def prompt_capped(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingClosed elif bettor == self.cap_bettor: self.state = Rotator.BettingFinished return False
458,266
def prompt_capped(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingClosed elif bettor == self.cap_bettor: self.state = Rotator.BettingFinished return False
def prompt_capped(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingClosed elif bettor == self.cap_bettor: self.state = Rotator.BettingFinished return False
458,267
def prompt_capped(self, bettor): if not bettor.active: return False elif bettor == self.last_bettor: self.state = Rotator.BettingClosed elif bettor == self.cap_bettor: self.state = Rotator.BettingFinished return False
defprompt_capped(self,bettor):ifnotbettor.active:returnFalseelifbettor==self.last_bettor:self.state=Rotator.BettingClosedelifbettor==self.cap_bettor:self.state=Rotator.BettingFinishedreturnFalse
458,268
def fold(self, bettor): bettor.fold() if self.num_bettors() < 2: self.state = Rotator.BettingFinished
def fold(self, bettor): bettor.fold() if self.num_active_bettors() < 2: self.state = Rotator.BettingFinished
458,269
def raiseto(self, bettor, amount): if (not bettor.min_raise <= amount <= bettor.max_raise or not bettor.can_raise): raise IllegalRaise(bettor) try: bettor.raiseto(amount) except AllIn as allin: raise_size = bettor.bet - self.current_bet if raise_size < self.last_raise: self.state = Rotator.BettingCapped self.cap_bettor...
def raiseto(self, bettor, amount): if (not bettor.min_raise <= amount <= bettor.max_raise or not bettor.can_raise): raise IllegalRaise(bettor) try: bettor.raiseto(amount) except AllIn as allin: raise_size = bettor.bet - self.current_bet if raise_size < self.last_raise: self.state = Rotator.BettingCapped self.cap_bettor...
458,270
def __repr__(self): return self.nickname
def __repr__(self): return self.nickname
458,271
def _multiSetVisible(self, widgets, state): if self.currentState == state: return newExceptions = [] if state: self.setVisible(False) else: if self.currentState != None: newExceptions = [w for w in widgets if not w.isVisible()] # get the tab bar to reset the active tab position tabList = self.parent().findChildren(QTab...
def _multiSetVisible(self, widgets, state): if self.currentState == state: return newExceptions = [] if state: self.setVisible(False) else: if self.currentState != None: newExceptions = [w for w in widgets if not w.isVisible()] # get the tab bar to reset the active tab position tabList = self.parent().findChildren(QTab...
458,272
def run(self): # Active people in the current hand # Added to the list preflop as the hand progresses. activePlayers = []
def run(self): # Active people in the current hand # Added to the list preflop as the hand progresses. activePlayers = []
458,273
def run(self): # Active people in the current hand # Added to the list preflop as the hand progresses. activePlayers = []
def run(self): # Active people in the current hand # Added to the list preflop as the hand progresses. activePlayers = []
458,274
def __init__(self): super(MdiTable, self).__init__() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
def __init__(self): super(MdiTable, self).__init__() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
458,275
def __init__(self): super(MdiTable, self).__init__() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
def __init__(self): super(MdiTable, self).__init__() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
458,276
def textChanged(self, value): self.slider.setValue(int(value) - 1)
def textChanged(self, value): self.slider.setValue(int(value) - 1)
458,277
def __repr__(self): pname = self.player.nickname return 'Uncalled bet. %s won %d\n'%(self.pname, self.bet)
def __repr__(self): pname = self.player.nickname return 'Uncalled bet. %s won %d\n'%(self.pname, self.bet)
458,278
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
def run(self): seats = self.table.seats dealer = self.table.dealer # Rotate the seats around the dealer. # If we have 6 seats and dealer = seat 3 then we get a list like: # [p3, p4, p5, p0, p1, p2] seats = seats[dealer:] + seats[:dealer]
458,279
def run(self): # Active people in the current hand # Added to the list preflop as the hand progresses. activePlayers = []
def run(self): # Active people in the current hand # Added to the list preflop as the hand progresses. activePlayers = []
458,280
def __init__(self, adapter): self.running = False self.adapter = adapter self.script = None self.actIter = None self.currentAct = None
def __init__(self, adapter): self.adapter = adapter self.script = None self.actIter = None self.currentAct = None
458,281
def __init__(self, adapter): self.running = False self.adapter = adapter self.script = None self.actIter = None self.currentAct = None
def __init__(self, adapter): self.running = False self.adapter = adapter self.script = None self.actIter = None self.currentAct = None
458,282
def __init__(self, prot, chan): reload(script) reload(table) self.prot = prot self.chan = chan self.cash = table.Table(9, 0.25, 0.5, 0, 5000, 25000) self.cash.registerScheduler(Schedule(self.reply)) self.handler = Handler(self) self.cash.registerHandler(self.handler) self.cash.setStartupDelayTime(0)
def __init__(self, prot, chan): reload(script) reload(table) self.prot = prot self.chan = chan self.cash = table.Table(9, 0.25, 0.5, 0, 5000, 25000) self.cash.registerScheduler(Schedule(self.reply)) self.handler = Handler(self) self.cash.registerHandler(self.handler) self.cash.setStartupDelayTime(0)
458,283
def __init__(self, prot, chan): reload(script) reload(table) self.prot = prot self.chan = chan self.cash = table.Table(9, 0.25, 0.5, 0, 5000, 25000) self.cash.registerScheduler(Schedule(self.reply)) self.handler = Handler(self) self.cash.registerHandler(self.handler) self.cash.setStartupDelayTime(0)
def __init__(self, prot, chan): reload(script) reload(table) self.prot = prot self.chan = chan self.cash = table.Table(9, 0.25, 0.5, 0, 5000, 25000) self.cash.registerScheduler(Schedule(self.reply)) self.handler = Handler(self) self.cash.registerHandler(self.handler) self.cash.setStartupDelayTime(0)
458,284
def prompt_open(self, bettor): if not bettor.active: # Player folded. Continue on. return False elif bettor == self.last_bettor: # Table went a full cycle without re-raising. Finish up. self.state = Rotator.BettingFinished return False elif bettor.stack == 0: # Player is all-in. Continue on. return False
def prompt_open(self, bettor): if not bettor.active: # Player folded. Continue on. return False elif bettor == self.last_bettor: # Table went a full cycle without re-raising. Finish up. self.state = Rotator.BettingFinished return False elif bettor.stack == 0: # Player is all-in. Continue on. return False
458,285
def show_all(players): for b in [p.bettor for p in players]: print b
def show_all(players): for b in [p.bettor for p in players]: print b
458,286
def show_all(players): for b in [p.bettor for p in players]: print b
def show_all(players): for b in [p.bettor for p in players]: print b
458,287
def show_all(players): for b in [p.bettor for p in players]: print b
def show_all(players): for b in [p.bettor for p in players]: print b
458,288
def __init__(self): super(MdiTable, self).__init__() self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) #self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
def __init__(self, parent): super(MdiTable, self).__init__(parent) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(self.tr('Table titilonius')) #self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint) self.setMinimumHeight(200)
458,289
def resizeEvent(self, event): super(MdiTable, self).resizeEvent(event) #return size = self.contentsRect().size()
defresizeEvent(self,event):super(MdiTable,self).resizeEvent(event)#returnsize=self.contentsRect().size()
458,290
def resizeEvent(self, event): super(MdiTable, self).resizeEvent(event) #return size = self.contentsRect().size()
def resizeEvent(self, event): super(MdiTable, self).resizeEvent(event) #return size = self.contentsRect().size()
458,291
def resizeEvent(self, event): super(MdiTable, self).resizeEvent(event) #return size = self.contentsRect().size()
def resizeEvent(self, event): super(MdiTable, self).resizeEvent(event) #return size = self.contentsRect().size()
458,292
def createMdiChild(self): child = MdiTable() self.mdiArea.addSubWindow(child) child.show() child.shownInit() return child
def createMdiChild(self): child = MdiTable(self) self.mdiArea.addSubWindow(child) child.show() child.shownInit() return child
458,293
def dz_wifi(): r = wifi_online() if r: if r[0]==0: return i("net_wired","green")+"^fg(white) "+r[1] if r[0]==1: return i("wifi_02","green")+"^fg(white) "+r[1] else: return i("empty","")
def dz_wifi(): r = wifi_online() if r: if r[0]==0: return i("net_wired","green")+"^fg(white) "+r[1] if r[0]==1: return i("wifi_02","green")+"^fg(white) "+r[1] else: return "offline"
458,294
def new_mail(): mail_dir="~/mail" def count_instances(rex,mailbox): return int(cmd([["grep",rex,mail_dir+"/"+mailbox],["wc","-l"]]).strip()) mailboxes={} for mailbox in [f for f in os.listdir(mail_dir) if "IN-" in f]: mailboxes[mailbox] = \ count_instances("^From:",mailbox) \ - count_instances("^Status:",mailbox) ret...
def new_mail(): mail_dir=home_dir+"/mail" def count_instances(rex,mailbox): return int(cmd([["grep",rex,mail_dir+"/"+mailbox],["wc","-l"]]).strip()) mailboxes={} for mailbox in [f for f in os.listdir(mail_dir) if "IN-" in f]: mailboxes[mailbox] = \ count_instances("^From:",mailbox) \ - count_instances("^Status:",mailb...
458,295
def dz_downloaded(): numfiles = len(os.listdir("~/downloaded")) movedfiles = len([f for f in os.listdir("~/downloaded") if re.match(r'.*\.moved$',f)]) if numfiles > 0: if numfiles < 10: color = "blue" else: color = "red" return i("diskette",color)+" "+str(numfiles-movedfiles)+"/"+str(numfiles) else: if movedfiles == 0...
def dz_downloaded(): numfiles = len(os.listdir(home_dir+"/downloaded")) movedfiles = len([f for f in os.listdir(home_dir+"/downloaded") if re.match(r'.*\.moved$',f)]) if numfiles > 0: if numfiles < 10: color = "blue" else: color = "red" return i("diskette",color)+" "+str(numfiles-movedfiles)+"/"+str(numfiles) else: if...
458,296
def wifi_online(): raw = cmd([["iwconfig"],["grep","-io","essid:\".*\""]]).strip() rex = re.compile(r'ESSID:"(.*)"') m = rex.search(raw) if m: return rex.search(raw).groups()[0] else: return ""
def wifi_online(): nic="eth0" wifi="wlan0" rex = re.compile(r'inet addr:(.*)') raw_nic = cmd([["ifconfig",nic],["grep","-io","inet addr:[0-9\\.]\+"]]).strip() raw_wifi = cmd([["ifconfig",wifi],["grep","-io","inet addr:[0-9\\.]\+"]]).strip() m_nic = rex.search(raw_nic) m_wifi = rex.search(raw_wifi) if m_nic: return (0,m...
458,297
def dz_wifi(): r = wifi_online() if r: return i("wifi_02","green")+"^fg(white) "+r else: return i("wifi_02","")
def dz_wifi(): r = wifi_online() if r: if r[0]==0: return i("net_wired","green")+"^fg(white) "+r[1] if r[0]==1: return i("wifi_02","green")+"^fg(white) "+r[1] else: return i("empty","")
458,298
def __init__(self, datasetType=None, ids=None, **kw): """ @param datasetType the type of dataset to look for. This can either be a single type name or list of names @param ids a dictionary mapping identifier names to IDFilter instances @param * additional named parameters are taken as identifie...
def __init__(self, datasetType=None, ids=None, **kw): """ @param datasetType the type of dataset to look for. This can either be a single type name or list of names @param ids a dictionary mapping identifier names to IDFilter instances @param * additional named parameters are taken as identifie...
458,299