rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def processCharacter(self, data): | def processNonSpaceCharacter(self, data): | def processCharacter(self, data): self.parser.reconstructActiveFormattingElements() self.parser.insertText(data) |
for name, value in self.attributes: | for name, value in self.attributes.iteritems(): | def printTree(self, indent): tree = '\n|%s%s' % (' '*indent, str(self)) indent += 2 if self.attributes: # XXX need more than 1 value to unpack?? for name, value in self.attributes: tree += '\n|%s%s="%s"' % (' '*indent, name, value) for child in self.childNodes: tree += child.printTree(indent) return tree |
self.endTagHead() | self.endTagHead("head") | def processNonSpaceCharacter(self, data): if self.parser.openElements[-1] in ("title", "style", "script"): self.parser.openElements[-1].appendChild(TextNode(data)) else: self.endTagHead() self.parser.switchInsertionMode("afterHead") self.parser.processCharacter(data) """ if self.collectingCharacters: self.characterBuff... |
self.parser.phase.insertionModes["inHead"](self.parser).processStartTag(name, attributes) | self.parser.phase.insertionModes["inHead"](self.parser).\ processStartTag(name, attributes) | def startTagScript(self, name, attributes): self.parser.phase.insertionModes["inHead"](self.parser).processStartTag(name, attributes) |
self.parser.phase.insertionModes["inHead"](self.parser).processStartTag(name, attributes) | self.parser.phase.insertionModes["inHead"](self.parser).\ processStartTag(name, attributes) | def startTagFromHead(self, name, attributes): self.parser.parseError() self.parser.phase.insertionModes["inHead"](self.parser).processStartTag(name, attributes) |
if len(self.parser.openElements)==1 or self.parser.openElements[1].name != "body": | if len(self.parser.openElements) == 1 \ or self.parser.openElements[1].name != "body": | def startTagBody(self, name, attributes): self.parser.parseError() if len(self.parser.openElements)==1 or self.parser.openElements[1].name != "body": assert self.parser.innerHTML else: for attr, value in attributes.iteritems(): if attr not in self.parser.openElements[1].attributes: self.parser.openElements[1].attribute... |
self.endTagA("a") | self.endTagFormatting("a") | def startTagA(self, name, attributes): afeAElement = self.parser.elementInActiveFormattingElements("a") if afeAElement: self.parser.parseError() self.endTagA("a") if afeAElement in self.parser.openElements: self.parser.openElements.remove(afeAElement) if afeAElement in self.parser.activeFormattingElements: self.parser.... |
self.endTagTr() | if not self.parser.elementInScope("tr", True): self.parser.processStartTag(name, attributes) else: self.endTagTr() | def startTagTableOther(self, name, attributes): self.endTagTr() # XXX check if it wasn't ignored... innerHTML case ... reprocess # current. see also endTagTable |
self.parser.switchInsertionMode("inTable") self.parser.processStartTag(name, attributes) self.parser.switchInsertionMode("inRow") | InTable(self.parser).processStartTag(name, attributes) | def startTagOther(self, name, attributes): self.parser.switchInsertionMode("inTable") self.parser.processStartTag(name, attributes) self.parser.switchInsertionMode("inRow") |
self.endTagTr() | if not self.parser.elementInScope("tr", True): self.parser.processStartTag(name, attributes) else: self.endTagTr() | def endTagTable(self, name): self.endTagTr() # XXX check if it wasn't ignored... innerHTML case ... reprocess # current. see also startTagTableOther... |
self.parser.processEndTag(name) | def endTagImply(self, name): if self.parser.elementInScope(name): self.closeCell() # XXX something is wrong here!!! #self.parser.processEndTag(name) else: # sometimes innerHTML case self.parser.parseError() | |
"markupDeclerationOpen":self.markupDeclerationOpenState, | "markupDeclarationOpen":self.markupDeclarationOpenState, | def __init__(self, parser): self.parser = parser |
self.changeState("markupDeclerationOpen") | self.changeState("markupDeclarationOpen") | def tagOpenState(self): data = self.consumeChar() if (self.contentModelFlag in (contentModelFlags["RCDATA"], contentModelFlags["CDATA"])): if data == u"/": self.changeState("closeTagOpen") else: self.parser.processCharacter(u"<") self.characterQueue.append(data) self.changeState("data") elif self.contentModelFlag == co... |
self.characterQueue.append(charStack) | self.characterQueue.extend(charStack) | def closeTagOpenState(self): if (self.contentModelFlag in (contentModelFlags["RCDATA"], contentModelFlags["CDATA"])): charStack = [] |
self.currentToken = CommentToken("".charStack[:-1]) | self.currentToken = CommentToken("".join(charStack[:-1])) | def bogusCommentState(self): assert self.contentModelFlag == contentModelFlags["PCDATA"] |
def markupDeclerationOpenState(self): | def markupDeclarationOpenState(self): | def markupDeclerationOpenState(self): assert self.contentModelFlag == contentModelFlags["PCDATA"] |
if name != exclude and name in frozenset(("dd", "dt", "li", "p", "td", "th", "tr")): self.processEndTag(name) self.generateImpliedEndTags() | while name in frozenset(("dd", "dt", "li", "p", "td", "th", "tr")) \ and name != exclude: self.phase.processEndTag(name) name = self.openElements[-1].name | def generateImpliedEndTags(self, exclude=None): name = self.openElements[-1].name if name != exclude and name in frozenset(("dd", "dt", "li", "p", "td", "th", "tr")): self.processEndTag(name) # XXX as opposed to the method proposed below, this seems to break # when an exclude paramter is passed... self.generateImpliedE... |
pass else: self.parser.parseError() def processStartTag(self, tagname, attributes): | self.parser.document.appendChild(TextNode(data)) else: self.parser.parseError() self.parser.switchPhase("rootElement") self.parser.processCharacter(data) def processStartTag(self, name, attributes): | def processCharacter(self, data): if data in spaceCharacters: # XXX these should be appended to the Document node as Text node. pass else: # XXX self.parser.parseError() |
self.parser.processStartTag(tagname, attributes) def processEndTag(self, tagname): | self.parser.processStartTag(name, attributes) def processEndTag(self, name): | def processStartTag(self, tagname, attributes): self.parser.switchPhase("rootElement") self.parser.processStartTag(tagname, attributes) |
self.parser.processEndTag(tagname) | self.parser.processEndTag(name) | def processEndTag(self, tagname): self.parser.switchPhase("rootElement") self.parser.processEndTag(tagname) |
self.parser.switchPhase("rootElement") self.parser.processComment(data) | self.parser.document.appendChild(Comment(data)) | def processComment(self, data): # XXX WRONG! self.parser.switchPhase("rootElement") self.parser.processComment(data) |
def closeCell(self, type="td"): if self.parser.elementInScope(type, True): self.endTagTableCell(type) return self.closeCell("th") | def closeCell(self): if self.parser.elementInScope("td", True): self.endTagTableCell("td") elif self.parser.elementInScope("th", True): self.endTagTableCell("th") | def closeCell(self, type="td"): if self.parser.elementInScope(type, True): self.endTagTableCell(type) return self.closeCell("th") # AT We could use elif... |
self.parser.generateImpliedEndTags() | self.parser.generateImpliedEndTags(name) | def endTagTableCell(self, name): if self.parser.elementInScope(name): self.parser.generateImpliedEndTags() if self.parser.openElements[-1].name != name: self.parser.parseError() node = self.parser.openElements.pop() while node.name != name: node = self.parser.openElements.pop() self.parser.clearActiveFormattingElements... |
self.processStartTag(self, name, attributes) | self.processStartTag(name, attributes) | def startTagNoframes(self, name, attributes): self.parser.switchInsertionMode("inBody") self.processStartTag(self, name, attributes) |
import sys sys.stderr.write(repr(fosterParent)) | def insertMisnestedNodeFromTable(self, element): #The foster parent element is the one which comes before the most #recently opened table element #XXX - this is really inelegant lastTable=None for elm in self.openElements[::-1]: if elm.name == u"table": lastTable = elm break if lastTable: #XXX - we should really check ... | |
def startTagOther(self, name, attributes) | def startTagOther(self, name, attributes): | def startTagOther(self, name, attributes) # XXX parse error?! self.parser.switchInsertionMode("inBody") self.parser.processStartTag(name, attributes) |
def endTagOther(self, name) | def endTagOther(self, name): | def endTagOther(self, name) # XXX parse error?! self.parser.switchInsertionMode("inBody") self.parser.processEndTag(name) |
assert False | pass | def endTagOther(self, name): assert False |
def tagOther(self, name, attributes={}) | def tagOther(self, name, attributes={}): | def tagOther(self, name, attributes={}) self.parser.parseError() |
self.generateImpliedEndTags() if self.parser.openElements[-1].name == "table": self.parser.parseError while self.parser.openElements[-1].name != "table": self.parser.openElements.pop() self.parser.resetInsertionMode() | if self.parser.elementInScope("table", True): self.generateImpliedEndTags() if self.parser.openElements[-1].name == "table": self.parser.parseError() while self.parser.openElements[-1].name != "table": self.parser.openElements.pop() self.parser.resetInsertionMode() else: self.parser.parseError() | def endTagTable(self, name): # XXX no element in scope -> parse error, innerHTML case |
f = open(args[0]) | f = args[0] | def parse(): optParser = getOptParser() opts,args = optParser.parse_args() p = parser.HTMLParser() f = open(args[0]) if opts.profile: import hotshot import hotshot.stats prof = hotshot.Profile('stats.prof') prof.runcall(p.parse, f, False) prof.close() #XXX - We should use a temp file here stats = hotshot.stats.load('s... |
ende=int(time.mktime([int(endday[0:4]), int(endday[4:6]), int(endday[6:8]),23,59,59,0,0,0])) | ende=int(time.mktime([int(endday[0:4]), int(endday[4:6]), int(endday[6:8]),0,0,0,0,0,0])) | def fuegeEin(): #Aggregation der Daten mysql.execute('create table IF NOT EXISTS '+wochentabelle+' (srcIP integer(10) unsigned,\ dstIP integer(10) unsigned,\ srcPort smallint (5) unsigned,\ dstPort smallint (5) unsigned,\ proto tinyint (3)unsigned,\ bytes bigint (20) unsigned,\ pkts bigint (20) unsigned,\ firs... |
tempdata1.link(outname+".matches") tempdata2.link(outname+".runs") def usage(): print >>sys.stderr, "No usage statement yet" print >>sys.stderr, "prog -i inpname -o outname [-j int] [-p string]" def mainTry(): import getopt try: opts, args = getopt.getopt(sys.argv[1:], "hi:o:vj:p:") except getopt.GetoptError: usage... | tempdata1.link("/tmp/"+outname+".matches") tempdata2.link("/tmp/"+outname+".runs") | def main(inpname, outname, maxJump, runIdPrefix): inpfile = open(inpname) tempdata1 = formPerfectRuns(inpfile, MatchRecord.sortInXorderAP, MatchRecord.sortInYorderAP, int(maxJump), runIdPrefix ) tempdata2 = runsAsMatches( tempdata1) tempdata1.link(outname+".matches") tempdata2.link(outname+".runs") |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At uniqueFilter, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At filterByMatchLength, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At trimMatchOverlaps, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At formPerfectRuns, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At onlyKeepLongRuns, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At boxRecovery, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
step += 1 print >>STDERR, 'At step=' + str(step) | step += 1 print >>STDERR, 'At squeezeIntraRunGaps, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
step += 1 print >>STDERR, 'At step=' + str(step) | step += 1 print >>STDERR, 'At TrimMatchOverlaps, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At RunsAsMatches, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At fillIntraRunGaps, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
print >>STDERR, 'At step=' + str(step) | print >>STDERR, 'At TrimMatchOverlaps, step=' + str(step) | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName |
step += 1 print >>STDERR, 'At step=' + str(step) print >>STDERR, 'Time elapsed=' + str(time.time()-t0) if (redo or ((keep < step) and not self.globals.has_key(ckpName))): redo = 1 print >>STDERR, "count the number of substitutions" tempdata = MyFile.myfile() countMisMatches.countMisMatches(self.matches, tempdata, assem... | def runOld(self): self.globals['atacAlgorithmVersion'] = str(17) print >>STDERR, "runName = %s\n" % self.runName | |
IdxStore.createIndexedFasta( assemblyFile2, assemblyId2, 1) if(not os.path.exists(assemblyFile2+".idxStore")): IdxStore.createIndexedFasta( assemblyFile2, assemblyId2, 1) assert(os.path.exists(assemblyFile1+".seqStore")) | IdxStore.createIndexedFasta( assemblyFile2, assemblyId2) | def main(runName): print >>STDERR, "I read the output from MatchExtender.\n"; print >>STDERR, "Start reading checkpoint ...." t0 = time.time() obj = AtacDriver(runName) t1 = time.time() print >>STDERR, "Read checkpoint in %d seconds." % (t1-t0) t0=t1 # The following are required: assert(obj.globals.has_key('assembl... |
assert(os.path.exists(assemblyFile2+".seqStore")) | def main(runName): print >>STDERR, "I read the output from MatchExtender.\n"; print >>STDERR, "Start reading checkpoint ...." t0 = time.time() obj = AtacDriver(runName) t1 = time.time() print >>STDERR, "Read checkpoint in %d seconds." % (t1-t0) t0=t1 # The following are required: assert(obj.globals.has_key('assembl... | |
del obj.globals['inpname'] del obj.globals['outname'] | def main(runName): print >>STDERR, "I read the output from MatchExtender.\n"; print >>STDERR, "Start reading checkpoint ...." t0 = time.time() obj = AtacDriver(runName) t1 = time.time() print >>STDERR, "Read checkpoint in %d seconds." % (t1-t0) t0=t1 # The following are required: assert(obj.globals.has_key('assembl... | |
settingsmenu.add_command(label='Save current settings as user defaults', command=self.__saveCurrentSettingsAsDefaults) settingsmenu.add_command(label='Restore current settings from defaults', command=self.__restoreCurrentSettingsFromDefault) | settingsmenu.add_command(label='Save current settings', command=self.__saveCurrentSettingsAsDefaults) settingsmenu.add_command(label='Load saved settings', command=self.__restoreCurrentSettingsFromDefault) | def __init__(self, master = None): Frame.__init__(self, master) |
self.initialiseWidgets() | def __saveCurrentSettingsAsDefaults(self): """Stores current settings as defaults.""" defaultPrefs.update(userPrefs) save_user_conf(CONFIG_PATH) self.initialiseWidgets() | |
self.key = 'default' | self.key = 'English' | def __init__(self, master=None): """ Setup the dialog """ # refernce to the localization dictionary self.key = 'default' Frame.__init__(self, master) self.grid() self.master.resizable(0, 0) self.master.title('Scribus Calendar Wizard') #define widgets self.statusVar = StringVar() self.statusLabel = Label(self, textvaria... |
for i in localization.keys(): | keys = localization.keys() keys.sort() for i in keys: | def __init__(self, master=None): """ Setup the dialog """ # refernce to the localization dictionary self.key = 'default' Frame.__init__(self, master) self.grid() self.master.resizable(0, 0) self.master.title('Scribus Calendar Wizard') #define widgets self.statusVar = StringVar() self.statusLabel = Label(self, textvaria... |
def languageChange(self, lang='default'): | def languageChange(self, lang='English'): | def languageChange(self, lang='default'): """ Called by Change button. Get language list value and call real re-filling. """ ix = self.langListbox.curselection() if len(ix)==0: self.statusVar.set('Select a language, please') return self.realLangChange(lang=self.langListbox.get(ix[0])) |
def realLangChange(self, lang='default'): | def realLangChange(self, lang='English'): | def realLangChange(self, lang='default'): """ Real widget setup. Ot takes values from localization dictionary. [0] = months, [1] Days """ self.key = lang self.monthListbox.delete(0, END) self.wholeYear.set(0) for i in localization[lang][0]: self.monthListbox.insert(END, i) |
InsertText(text, GetTextLength(self.textbox), self.textbox) | InsertText(unicode(text, self.encoding), GetTextLength(self.textbox), self.textbox) | def append(self, text): InsertText(text, GetTextLength(self.textbox), self.textbox) |
tocstyle.tocRows = 56 | tocstyle.tocRows = 57 | def setPaperSize(paperSize): if paperSize == 1: # A4 - 595 x 842 Points paper.size = scribus.PAPER_A4 paper.width = 595 paper.height = 842 paper.tmargin = 60 paper.bmargin = 50 paper.lmargin = 50 paper.rmargin = 50 paper.binding = 16 tocstyle.tocRows = 56 paper.pagenumvoffset = 16 paper.textwidth = paper.w... |
tocstyle.tocRows = 55 | tocstyle.tocRows = 56 | def setPaperSize(paperSize): if paperSize == 1: # A4 - 595 x 842 Points paper.size = scribus.PAPER_A4 paper.width = 595 paper.height = 842 paper.tmargin = 60 paper.bmargin = 50 paper.lmargin = 50 paper.rmargin = 50 paper.binding = 16 tocstyle.tocRows = 56 paper.pagenumvoffset = 16 paper.textwidth = paper.w... |
yPos = addTocRow(i[0], i[1], yPos, body) rowCount = rowCount + 1 if rowCount > tocstyle.tocRows: | if rowCount == tocstyle.tocRows: | def addToc(tocList): rowCount = 0 yPos = 0 tocPageNum = 1 tocPageCount = 1 scribus.newPage(tocPageNum) isEvenPage = setOddEven(tocPageNum) body = buildTocPageFrames() # create frames for new empty page if isEvenPage == 0: scribus.setTextAlignment(2, body) else: scribus.setTextAlignment(0, body) for i in to... |
setStyle(self.pStyle, cel) | def createMonthCalendar(self, month): cal = calendar.monthcalendar(self.year, month + 1) for i in cal: self.createLayout() self.createHeader(self.months[month]) rowCnt = 1 for j in i: # days cel = createText(self.gmean + self.marginl, self.margint + rowCnt * self.rowSize, self.width - self.gmean, self.rowSize) setStyle... | |
setText(str(j), cel) | self.applyTextToFrame(str(j), cel) | def createMonthCalendar(self, month): cal = calendar.monthcalendar(self.year, month + 1) for i in cal: self.createLayout() self.createHeader(self.months[month]) rowCnt = 1 for j in i: # days cel = createText(self.gmean + self.marginl, self.margint + rowCnt * self.rowSize, self.width - self.gmean, self.rowSize) setStyle... |
setStyle(self.pStyle, cel) setText(monthName, cel) | self.applyTextToFrame(monthName, cel) | def createHeader(self, monthName): cel = createText(self.gmean + self.marginl, self.margint, self.width - self.gmean, self.rowSize) setStyle(self.pStyle, cel) setText(monthName, cel) |
setStyle(self.pStyle, cel) | def createMonthCalendar(self, month): """ Draw one month calendar per page """ cal = calendar.monthcalendar(self.year, month + 1) self.createLayout() self.createHeader(self.months[month]) # weeks rowCnt = 2 for i in cal: colCnt = 0 for j in i: # days cel = createText(self.marginl + colCnt * self.colSize, self.calHeight... | |
setText(str(j), cel) | self.applyTextToFrame(str(j), cel) | def createMonthCalendar(self, month): """ Draw one month calendar per page """ cal = calendar.monthcalendar(self.year, month + 1) self.createLayout() self.createHeader(self.months[month]) # weeks rowCnt = 2 for i in cal: colCnt = 0 for j in i: # days cel = createText(self.marginl + colCnt * self.colSize, self.calHeight... |
setText(monthName, header) | self.applyTextToFrame(monthName, header) | def createHeader(self, monthName): """ Draw calendar header. Month name and days of the week """ header = createText(self.marginl, self.calHeight, self.width, self.rowSize) setText(monthName, header) colCnt = 0 for i in self.dayOrder: cel = createText(self.marginl + colCnt * self.colSize, self.calHeight + self.rowSize,... |
setStyle(self.pStyle, cel) setText(i, cel) | self.applyTextToFrame(i, cel) | def createHeader(self, monthName): """ Draw calendar header. Month name and days of the week """ header = createText(self.marginl, self.calHeight, self.width, self.rowSize) setText(monthName, header) colCnt = 0 for i in self.dayOrder: cel = createText(self.marginl + colCnt * self.colSize, self.calHeight + self.rowSize,... |
setRedraw(True) | def main(): """ Application/Dialog loop with Scribus sauce around """ try: statusMessage('Running script...') progressReset() root = Tk() app = TkCalendar(root) root.mainloop() finally: if haveDoc(): setRedraw(True) redrawAll() statusMessage('Done.') progressReset() | |
msgBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK) | messageBox(TITLE, "No document open", ICON_WARNING, BUTTON_OK) | def quote(textobj): quoted_re = re.compile('"[^"]*"') text = getText(textobj) count = 0 i = 0 selectText(0, 0, textobj) while i < len(text): match = quoted_re.match(text[i:]) if match: end = match.end() selectText(i, 1, textobj) deleteText(textobj) insertText(QUOTE_START, i, textobj) selectText(i + end - 1, 1, textobj)... |
scribus.newDocument(dD['paperSize'], dD['paperMargins'], scribus.PORTRAIT, 1, scribus.UNIT_POINTS, facingPages, scribus.FIRSTPAGERIGHT) | scribus.newDocument(dD['paperSize'], dD['paperMargins'], scribus.PORTRAIT, 1, scribus.UNIT_POINTS, facingPages, scribus.FIRSTPAGERIGHT, 1) | def draw_selection(fontList, getSizeOnly): """Draws the sample blocks onto the Scribus canvas. Measure one font sample block including any horizontal lines and extra vertical spaces. Get the amount of vertical space available for the text area between the top line and top of page number area. Use these two values to c... |
paper.size = scribus.Paper_A4 | paper.size = scribus.PAPER_A4 | def setPaperSize(paperSize): if paperSize == 1: # A4 - 595 x 842 Points paper.size = scribus.Paper_A4 paper.width = 595 paper.height = 842 paper.tmargin = 60 paper.bmargin = 50 paper.lmargin = 50 paper.rmargin = 50 paper.binding = 16 tocstyle.tocRows = 56 paper.pagenumvoffset = 16 paper.textwidth = paper.w... |
paper.size = scribus.Paper_Letter | paper.size = scribus.PAPER_LETTER | def setPaperSize(paperSize): if paperSize == 1: # A4 - 595 x 842 Points paper.size = scribus.Paper_A4 paper.width = 595 paper.height = 842 paper.tmargin = 60 paper.bmargin = 50 paper.lmargin = 50 paper.rmargin = 50 paper.binding = 16 tocstyle.tocRows = 56 paper.pagenumvoffset = 16 paper.textwidth = paper.w... |
if scribus.newDoc(paper.size, paper.margins, scribus.Portrait, 1, scribus.Points, scribus.NoFacingPages, scribus.FirstPageRight): | if scribus.newDoc(paper.size, paper.margins, scribus.PORTRAIT, 1, scribus.UNIT_POINTS, scribus.NOFACINGPAGES, scribus.FIRSTPAGERIGHT): | def useSelection(fontList): tocList = [] yPos = paper.tmargin + 1 pageNum = 1 if scribus.newDoc(paper.size, paper.margins, scribus.Portrait, 1, scribus.Points, scribus.NoFacingPages, scribus.FirstPageRight): # We have a new page by default so set it up first... setOddEven(pageNum) if app.wantPageNum.get() == 1: addPage... |
setTextAlignment(Centered, ob) | setTextAlignment(ALIGN_CENTERED, ob) | def main(): Month = time.localtime()[1] Year = time.localtime()[0] Objects = [] MonthList = ["January","February","March","April","May","June","July","August","September","October","November","December"] DaysList = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"] Xcoor = 10 Ycoor = 30 DayC = 0 Calend = calendar.monthcalenda... |
if newDocument(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT): | if newDocument(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT,1): | def main(): if newDocument(paper, margins, 1, 1, 1, NOFACINGPAGES, FIRSTPAGELEFT): setUnit(1) newPage(-1) gotoPage(1) createLayer("normal") setActiveLayer("normal") a = createText(98.5, 20, 100, 10) setText("CD pochette - front page", a) setFontSize(11, a) setTextAlignment(1, a) b = createText(28.5, 45, 120, 120) setFi... |
(("\0" * 20, "\xff" * 20), 2**160 -1), | (("\0" * 20, "\xff" * 20), 2**160L -1), | def testEndianessLots(self): |
return long(hstr.encode('hex'), 16)) | return long(hstr.encode('hex'), 16) | def intify(hstr): """20 bit hash, big-endian -> long python integer""" assert len(hstr) == 20 return long(hstr.encode('hex'), 16)) |
sender['host'] = conn['host'] | if conn['host']: sender['host'] = conn['host'] | def handleGotNodes(self, args): |
for node in l: | for node in l[:K]: | def schedule(self): |
if not self.queried.has_key(node.id) and node.id != self.table.node.id: | if (not self.queried.has_key(node.id)) and node.id != self.table.node.id: | def schedule(self): |
if self.finished: return | def defaultGotNodes(err, self=self, node=node): self.table.table.nodeFailed(node) if self.finished: return self.outstanding = self.outstanding - 1 self.schedule() | |
for node in l: if not self.queried.has_key(node.id) and node.id != self.table.node.id: | for node in l[:K]: if (not self.queried.has_key(node.id)) and node.id != self.table.node.id: | def schedule(self): |
sender, conn = sender | def _pongHandler(sender, id=node.id, host=node.host, port=node.port, table=self.table): sender, conn = sender if id != 20 * ' ' and id != sender['id'].data: # whoah, got response from different peer than we were expecting pass else: sender['host'] = host sender['port'] = port n = Node().initWithDict(sender) table.inser... | |
df.addCallbacks(cb, lambda: None) | df.addCallbacks(cb, lambda x: None) | def default(err, node=node, table=table): |
d.addCallbacks(callback, errback) | if errback: d.addCallbacks(callback, errback) else: d.addCallback(callback) | def findNode(self, id, callback, errback=None): |
sender['host'] = conn['host'] | if conn['host']: sender['host'] = conn['host'] | def _notStaleNodeHandler(sender, old=old): |
sender = sender[0] | def _pongHandler(sender, id=node.id, host=node.host, port=node.port, table=self.table): sender = sender[0] if id != 20 * ' ' and id != sender['id'].data: # whoah, got response from different peer than we were expecting pass else: sender['host'] = host sender['port'] = port n = Node().initWithDict(sender) table.insertNo... | |
if time.time() - bucket.lastAccessed >= 60 * 60: id = randRange(bucket.min, bucket.max) | if time.time() - bucket.lastAccessed >= const.BUCKET_STALENESS: id = newIDInRange(bucket.min, bucket.max) | def callback(nodes): pass |
time.sleep(.30) | time.sleep(.5) | def test_build_net(quiet=0, peers=24, host='localhost', pause=1): from whrandom import randrange import thread port = 2001 l = [] if not quiet: print "Building %s peer table." % peers for i in xrange(peers): a = Khashmir(host, port + i) l.append(a) thread.start_new_thread(l[0].app.run, ()) time.sleep(1) for peer i... |
time.sleep(1) | time.sleep(10) | def test_build_net(quiet=0, peers=24, host='localhost', pause=1): from whrandom import randrange import thread port = 2001 l = [] if not quiet: print "Building %s peer table." % peers for i in xrange(peers): a = Khashmir(host, port + i) l.append(a) thread.start_new_thread(l[0].app.run, ()) time.sleep(1) for peer i... |
time.sleep(.5) | time.sleep(2) | def test_build_net(quiet=0, peers=24, host='localhost', pause=1): from whrandom import randrange import thread port = 2001 l = [] if not quiet: print "Building %s peer table." % peers for i in xrange(peers): a = Khashmir(host, port + i) l.append(a) thread.start_new_thread(l[0].app.run, ()) time.sleep(1) for peer i... |
time.sleep(2) | time.sleep(10) | def test_build_net(quiet=0, peers=24, host='localhost', pause=1): from whrandom import randrange import thread port = 2001 l = [] if not quiet: print "Building %s peer table." % peers for i in xrange(peers): a = Khashmir(host, port + i) l.append(a) thread.start_new_thread(l[0].app.run, ()) time.sleep(1) for peer i... |
if sender['id'] == old.id: | sender = Node().initWithSenderDict(sender) if sender.id == old.id: | def _notStaleNodeHandler(sender, old=old): |
if id != 20 * ' ' and id != sender['id']: | sender = Node().initWithSenderDict(sender) if id != 20 * ' ' and id != sender.id: | def _pongHandler(sender, id=node.id, host=node.host, port=node.port, table=self.table): if id != 20 * ' ' and id != sender['id']: # whoah, got response from different peer than we were expecting pass else: #print "Got PONG from %s at %s:%s" % (`msg['id']`, t.target.host, t.target.port) sender['host'] = host sender['por... |
if len(nodes) == K: | if len(nodes) >= K: | def sort(a, b, int=int): """ this function is for sorting nodes relative to the ID we are looking for """ x, y = int ^ a.int, int ^ b.int if x > y: return 1 elif x < y: return -1 return 0 |
return nodes | return nodes[:K] | def sort(a, b, int=int): """ this function is for sorting nodes relative to the ID we are looking for """ x, y = int ^ a.int, int ^ b.int if x > y: return 1 elif x < y: return -1 return 0 |
while (len(nodes) < K and (min >= 0 and max < len(self.buckets))): | while (len(nodes) < K and (min >= 0 or max < len(self.buckets))): | def sort(a, b, int=int): """ this function is for sorting nodes relative to the ID we are looking for """ x, y = int ^ a.int, int ^ b.int if x > y: return 1 elif x < y: return -1 return 0 |
min = min - 1 max = max + 1 | def sort(a, b, int=int): """ this function is for sorting nodes relative to the ID we are looking for """ x, y = int ^ a.int, int ^ b.int if x > y: return 1 elif x < y: return -1 return 0 | |
def insertNode(self, node): | def insertNode(self, node, contacted=1): | def insertNode(self, node): |
node.updateLastSeen() del(self.buckets[i].l[it]) self.buckets[i].l.append(node) self.buckets[i].touch() | if contacted: node.updateLastSeen() del(self.buckets[i].l[it]) self.buckets[i].l.append(node) self.buckets[i].touch() | def insertNode(self, node): |
def schedule(self): """ send messages to new peers, if necessary """ if self.finished: return l = self.found.values() l.sort(self.sort) for node in l[:K]: if node.id == self.target: self.finished=1 return self.callback([node]) if (not self.queried.has_key(node.id)) and node.id != self.table.node.id: df = node.findNod... | def schedule(self): """ send messages to new peers, if necessary """ if self.finished: return l = self.found.values() l.sort(self.sort) | def schedule(self): |
def makeMsgFailed(self, node): def defaultGotNodes(err, self=self, node=node): self.table.table.nodeFailed(node) self.outstanding = self.outstanding - 1 self.schedule() return defaultGotNodes | for node in l[:K]: if node.id == self.target: self.finished=1 return self.callback([node]) if (not self.queried.has_key(node.id)) and node.id != self.table.node.id: df = node.findNode(self.target, self.table.node.senderDict()) df.addCallbacks(self.handleGotNodes, self.makeMsgFailed(node)) self.outstanding = self.outst... | def makeMsgFailed(self, node): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.