bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | 35,700 |
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | 35,701 |
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | 35,702 |
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | 35,703 |
def addFmt( type, lang, isMnthOfYear, patterns ): """Add 12 month formats for a specific type ('January','Feb..), for a given language. The function must accept one parameter for the ->int or ->string conversions, just like everywhere else in the formats map. The patterns parameter is a list of 12 elements to be used f... | def addFmt( type, lang, isMnthOfYear, patterns ): """Add 12 month formats for a specific type ('January','Feb..), for a given language. The function must accept one parameter for the ->int or ->string conversions, just like everywhere else in the formats map. The patterns parameter is a list of 12 elements to be used f... | 35,704 |
def addFmt( type, lang, isMnthOfYear, patterns ): """Add 12 month formats for a specific type ('January','Feb..), for a given language. The function must accept one parameter for the ->int or ->string conversions, just like everywhere else in the formats map. The patterns parameter is a list of 12 elements to be used f... | def addFmt( type, lang, isMnthOfYear, patterns ): """Add 12 month formats for a specific type ('January','Feb..), for a given language. The function must accept one parameter for the ->int or ->string conversions, just like everywhere else in the formats map. The patterns parameter is a list of 12 elements to be used f... | 35,705 |
def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param... | def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param... | 35,706 |
def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param... | def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param... | 35,707 |
def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param... | def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param... | 35,708 |
def printMonthArray( lang, pattern, capitalize ): """ """ import wikipedia for s in makeMonthNamedList( lang, pattern, capitalize ): wikipedia.output( s ) | def printMonthArray( lang, pattern, capitalize ): """ """ for s in makeMonthNamedList( lang, pattern, capitalize ): wikipedia.output( s ) | 35,709 |
def testMapEntry( showAll, m, year, testYear ): """This is a test function, to be used interactivelly to test the validity of the above maps. To test, run this function with the map name, year to be tested, and the final year expected. Usage example: run python interpreter >>> import date >>> date.testMapEntry( 'Decade... | def testMapEntry( showAll, m, year, testYear ): """This is a test function, to be used interactivelly to test the validity of the above maps. To test, run this function with the map name, year to be tested, and the final year expected. Usage example: run python interpreter >>> import date >>> date.testMapEntry( 'Decade... | 35,710 |
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages...' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allm... | def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages...' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allm... | 35,711 |
def url2unicode(percentname, site): # Does the input string contain non-ascii characters? In that case, # it is not really an url, and we do not have to unquote it.... for c in percentname: if ord(c)>128: x=percentname break else: # Before removing the % encoding, make sure it is an ASCII string. # unquote doesn't work... | def url2unicode(percentname, site): # Does the input string contain non-ascii characters? In that case, # it is not really an url, and we do not have to unquote it.... for c in percentname: if ord(c)>128: x=percentname break else: # Before removing the % encoding, make sure it is an ASCII string. # unquote doesn't work... | 35,712 |
def url2unicode(percentname, site): # Does the input string contain non-ascii characters? In that case, # it is not really an url, and we do not have to unquote it.... for c in percentname: if ord(c)>128: x=percentname break else: # Before removing the % encoding, make sure it is an ASCII string. # unquote doesn't work... | def url2unicode(percentname, site): # Does the input string contain non-ascii characters? In that case, # it is not really an url, and we do not have to unquote it.... for c in percentname: if ord(c)>128: x=percentname break else: # Before removing the % encoding, make sure it is an ASCII string. # unquote doesn't work... | 35,713 |
def newpages(self, number = 10, repeat = False): """Generator which yields new articles subsequently. It starts with the article created 'number' articles ago (first argument). When these are all yielded it fetches NewPages again. If there is no new page, it blocks until there is one, sleeping between subsequent fetche... | def newpages(self, number = 10, repeat = False): """Generator which yields new articles subsequently. It starts with the article created 'number' articles ago (first argument). When these are all yielded it fetches NewPages again. If there is no new page, it blocks until there is one, sleeping between subsequent fetche... | 35,714 |
def newpages(self, number = 10, repeat = False): """Generator which yields new articles subsequently. It starts with the article created 'number' articles ago (first argument). When these are all yielded it fetches NewPages again. If there is no new page, it blocks until there is one, sleeping between subsequent fetche... | def newpages(self, number = 10, repeat = False): """Generator which yields new articles subsequently. It starts with the article created 'number' articles ago (first argument). When these are all yielded it fetches NewPages again. If there is no new page, it blocks until there is one, sleeping between subsequent fetche... | 35,715 |
def newpages(self, number = 10, repeat = False): """Generator which yields new articles subsequently. It starts with the article created 'number' articles ago (first argument). When these are all yielded it fetches NewPages again. If there is no new page, it blocks until there is one, sleeping between subsequent fetche... | def newpages(self, number = 10, repeat = False): """Generator which yields new articles subsequently. It starts with the article created 'number' articles ago (first argument). When these are all yielded it fetches NewPages again. If there is no new page, it blocks until there is one, sleeping between subsequent fetche... | 35,716 |
def isDisambig(self): if not hasattr(self, '_isDisambig'): defdis = self.site().family.disambig( "_default" ) locdis = self.site().family.disambig( self._site.lang ) | def isDisambig(self): if not hasattr(self, '_isDisambig'): locdis = self.site().family.disambig( self._site.lang ) | 35,717 |
def isDisambig(self): if not hasattr(self, '_isDisambig'): defdis = self.site().family.disambig( "_default" ) locdis = self.site().family.disambig( self._site.lang ) | def isDisambig(self): if not hasattr(self, '_isDisambig'): defdis = self.site().family.disambig( "_default" ) locdis = self.site().family.disambig( self._site.lang ) | 35,718 |
def __init__(self, oldCatTitle, newCatTitle): self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(),msg_change) % oldCat.title()) | def __init__(self, oldCatTitle, newCatTitle): self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(),msg_change) % oldCat.title()) | 35,719 |
def __init__(self): family.Family.__init__(self) self.name = 'wikipedia' | def __init__(self): family.Family.__init__(self) self.name = 'wikipedia' | 35,720 |
def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | 35,721 |
def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | 35,722 |
def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | 35,723 |
def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | 35,724 |
def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | def interwiki(self): """A list of interwiki links in the page. This will retrieve the page text to do its work, so it can raise the same exceptions that are raised by the get() method. | 35,725 |
def run(self): # regular expression to find the original template. # {{msg:vfd}} does the same thing as {{msg:Vfd}}, so both will be found. # The new syntax, {{vfd}}, will also be found. templateR=re.compile(r'\{\{([mM][sS][gG]:)?[' + self.old[0].upper() + self.old[0].lower() + ']' + self.old[1:] + '(?P<sortkey>\|[^}]+... | def run(self): # regular expression to find the original template. # {{msg:vfd}} does the same thing as {{msg:Vfd}}, so both will be found. # The new syntax, {{vfd}}, will also be found. templateR=re.compile(r'\{\{([mM][sS][gG]:)?[' + self.old[0].upper() + self.old[0].lower() + ']' + self.old[1:] + '(?P<sortkey>\|[^}... | 35,726 |
def addEntity(name): """Convert a unicode name into ascii name with entities""" import htmlentitydefs result = '' for c in name: if ord(c) < 128: result += str(c) else: for k, v in htmlentitydefs.entitydefs.iteritems(): if (len(v) == 1 and ord(c) == ord(v)) or v == '&#%d;'%ord(c): result += '&%s;' % k break else: raise... | def addEntity(name): """Convert a unicode name into ascii name with entities""" import htmlentitydefs result = '' for c in name: if ord(c) < 128: result += str(c) else: for k, v in htmlentitydefs.entitydefs.iteritems(): if (len(v) == 1 and ord(c) == ord(v)) or v == '&#%d;'%ord(c): result += '&%s;' % k break else: raise... | 35,727 |
def getreferences(pl): host = wikipedia.langs[pl.code()] url="/w/wiki.phtml?title=Speciaal:Whatlinkshere&target=%s"%(pl.urlname()) txt,charset=wikipedia.getUrl(host,url) Rref=re.compile('<li><a href.* title="([^"]*)"') return Rref.findall(txt) | def getreferences(pl): host = wikipedia.langs[pl.code()] url="/w/wiki.phtml?title=Speciaal:Whatlinkshere&target=%s"%(pl.urlname()) txt,charset=wikipedia.getUrl(host,url) Rref=re.compile('<li><a href.* title="([^"]*)"') return Rref.findall(txt) | 35,728 |
def getreferences(pl): host = wikipedia.langs[pl.code()] url="/w/wiki.phtml?title=Speciaal:Whatlinkshere&target=%s"%(pl.urlname()) txt,charset=wikipedia.getUrl(host,url) Rref=re.compile('<li><a href.* title="([^"]*)"') return Rref.findall(txt) | def getreferences(pl): host = wikipedia.langs[pl.code()] url="/w/wiki.phtml?title=Speciaal:Whatlinkshere&target=%s"%(pl.urlname()) txt,charset=wikipedia.getUrl(host,url) Rref=re.compile('<li><a href.* title="([^"]*)"') return Rref.findall(txt) | 35,729 |
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | 35,730 |
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo... | 35,731 |
def loggedin(self, check = False): if not hasattr(self,'_loggedin'): self._fill() if check: txt = getPage(self, 'Non-existing page', get_edit_page = False) self.loggedin = 'Userlogin' not in txt return self._loggedin | def loggedin(self, check = False): if not hasattr(self,'_loggedin'): self._fill() if check: txt = getPage(self, 'Non-existing page', get_edit_page = False) self._loggedin = 'Userlogin' not in txt return self._loggedin | 35,732 |
def workDone(self, counter): """This is called by a worker to tell us that the promised work was completed as far as possible. The only argument is an instance of a counter class, that has methods minus() and plus() to keep counts of the total work todo.""" # Loop over all the pages that should have been taken care of ... | def workDone(self, counter): """This is called by a worker to tell us that the promised work was completed as far as possible. The only argument is an instance of a counter class, that has methods minus() and plus() to keep counts of the total work todo.""" # Loop over all the pages that should have been taken care of ... | 35,733 |
def createGraph(self): import pydot # create empty graph graph = pydot.Dot() graph.add_node(pydot.Node('start', shape = 'point')) for page in self.foundin.iterkeys(): # a node for each found page node = pydot.Node('"%s:%s"' % (page.site().language(), wikipedia.unicode2html(page.title(), 'ascii')), shape = 'rectangle') ... | def createGraph(self): import pydot # create empty graph graph = pydot.Dot() graph.add_node(pydot.Node('start', shape = 'point')) for page in self.foundin.iterkeys(): # a node for each found page node = pydot.Node('"%s:%s"' % (page.site().language(), wikipedia.unicode2html(page.title(), 'ascii')), shape = 'rectangle') ... | 35,734 |
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the code as key. # Each value will be a list. new = {} for pl in self.done.keys(): code = pl.code() if code == wikipedia.mylang and pl.exists() and not pl.isRedirectPage() and not pl.isEmpty(): if pl != self.... | def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the code as key. # Each value will be a list. new = {} for pl in self.done.keys(): code = pl.code() if code == wikipedia.mylang and pl.exists() and not pl.isRedirectPage() and not pl.isEmpty(): if pl != self.... | 35,735 |
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | 35,736 |
def print_treeview(catname, max_depth = 10): """ Prints the multi-line string generated by treeview or saves it to a file. Parameters: * catname - the title of the category which will be the tree's root * max_depth - the limit beyond which no subcategories will be listed """ # TODO: make max_depth changeable with a pa... | defprint_treeview(catname,max_depth=10):"""Printsthemulti-linestringgeneratedbytreevieworsavesittoafile.Parameters:*catname-thetitleofthecategorywhichwillbethetree'sroot*max_depth-thelimitbeyondwhichnosubcategorieswillbelisted"""#TODO:makemax_depthchangeablewithaparameterorconfigfileentryfilename=wikipedia.input(u'Plea... | 35,737 |
def compareLanguages(old, new): removing = [] adding = [] modifying = [] mysite = wikipedia.getSite() for site in old.keys(): if site not in new: removing.append(site) elif old[site] != new[site]: modifying.append(site) for site2 in new.keys(): if site2 not in old: adding.append(site2) s = "" if adding: s = s + " %s:"... | def compareLanguages(old, new): removing = [] adding = [] modifying = [] mysite = wikipedia.getSite() for site in old.keys(): if site not in new: removing.append(site) elif old[site] != new[site]: modifying.append(site) for site2 in new.keys(): if site2 not in old: adding.append(site2) s = "" if adding: s = s + " %s:"... | 35,738 |
def compareLanguages(old, new): removing = [] adding = [] modifying = [] mysite = wikipedia.getSite() for site in old.keys(): if site not in new: removing.append(site) elif old[site] != new[site]: modifying.append(site) for site2 in new.keys(): if site2 not in old: adding.append(site2) s = "" if adding: s = s + " %s:"... | def compareLanguages(old, new): removing = [] adding = [] modifying = [] mysite = wikipedia.getSite() for site in old.keys(): if site not in new: removing.append(site) elif old[site] != new[site]: modifying.append(site) for site2 in new.keys(): if site2 not in old: adding.append(site2) s = "" if adding: s = s + " %s:"... | 35,739 |
def compareLanguages(old, new): removing = [] adding = [] modifying = [] mysite = wikipedia.getSite() for site in old.keys(): if site not in new: removing.append(site) elif old[site] != new[site]: modifying.append(site) for site2 in new.keys(): if site2 not in old: adding.append(site2) s = "" if adding: s = s + " %s:"... | def compareLanguages(old, new): removing = [] adding = [] modifying = [] mysite = wikipedia.getSite() for site in old.keys(): if site not in new: removing.append(site) elif old[site] != new[site]: modifying.append(site) for site2 in new.keys(): if site2 not in old: adding.append(site2) s = "" if adding: s = s + " %s:"... | 35,740 |
def generateMore(self, number): """Generate more subjects. This is called internally when the list of subjects becomes to small, but only if there is a PageGenerator""" fs = self.firstSubject() if fs: wikipedia.output(u"NOTE: The first unfinished subject is " + fs.pl().aslink()) print "NOTE: Number of pages queued is %... | def generateMore(self, number): """Generate more subjects. This is called internally when the list of subjects becomes to small, but only if there is a PageGenerator""" fs = self.firstSubject() if fs: wikipedia.output(u"NOTE: The first unfinished subject is " + fs.pl().aslink()) print "NOTE: Number of pages queued is %... | 35,741 |
def generateMore(self, number): """Generate more subjects. This is called internally when the list of subjects becomes to small, but only if there is a PageGenerator""" fs = self.firstSubject() if fs: wikipedia.output(u"NOTE: The first unfinished subject is " + fs.pl().aslink()) print "NOTE: Number of pages queued is %... | def generateMore(self, number): """Generate more subjects. This is called internally when the list of subjects becomes to small, but only if there is a PageGenerator""" fs = self.firstSubject() if fs: wikipedia.output(u"NOTE: The first unfinished subject is " + fs.pl().aslink()) print "NOTE: Number of pages queued is %... | 35,742 |
def readWarnfile(filename, sa): import warnfile reader = warnfile.WarnfileReader(filename) # we won't use removeHints (hints, removeHints) = reader.getHints() pages = hints.keys() for page in pages: # The WarnfileReader gives us a list of pagelinks, but titletranslate.py expects a list of strings, so we convert it back... | def readWarnfile(filename, sa): import warnfile reader = warnfile.WarnfileReader(filename) # we won't use removeHints (hints, removeHints) = reader.getHints() pages = hints.keys() for page in pages: # The WarnfileReader gives us a list of pagelinks, but titletranslate.py expects a list of strings, so we convert it back... | 35,743 |
def category_namespaces(code): ns = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages ns.append(mediawiki_messages.get('nstab-category', lang = code)) else: ns.append(category[code]) ns.append(category[code].lower()) if category[code] != category['en']: ... | def category_namespaces(code): namespaces = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages ns.append(mediawiki_messages.get('nstab-category', lang = code)) else: ns.append(category[code]) ns.append(category[code].lower()) if category[code] != category... | 35,744 |
def category_namespaces(code): ns = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages ns.append(mediawiki_messages.get('nstab-category', lang = code)) else: ns.append(category[code]) ns.append(category[code].lower()) if category[code] != category['en']: ... | def category_namespaces(code): ns = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages ns.append(mediawiki_messages.get('nstab-category', lang = code)) else: ns.append(category[code]) ns.append(category[code].lower()) if category[code] != category['en']: ... | 35,745 |
def category_namespaces(code): ns = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages ns.append(mediawiki_messages.get('nstab-category', lang = code)) else: ns.append(category[code]) ns.append(category[code].lower()) if category[code] != category['en']: ... | def category_namespaces(code): ns = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages namespace_title = mediawiki_messages.get('nstab-category', lang = code) else: ns.append(category[code]) ns.append(category[code].lower()) if category[code] != category[... | 35,746 |
def category_namespaces(code): ns = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages ns.append(mediawiki_messages.get('nstab-category', lang = code)) else: ns.append(category[code]) ns.append(category[code].lower()) if category[code] != category['en']: ... | def category_namespaces(code): ns = [] if not category.has_key(code): #print "DBG> No category namespace known for %s" % code import mediawiki_messages ns.append(mediawiki_messages.get('nstab-category', lang = code)) else: namespace_title = category[code] namespaces.append(namespace_title) namespaces.append(namespace_t... | 35,747 |
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | 35,748 |
def removeLanguageLinks(text, site = None): """Given the wiki-text of a page, return that page with all interwiki links removed. If a link to an unknown language is encountered, a warning is printed.""" if site == None: site = getSite() # This regular expression will find every link that is possibly an # interwiki link... | def removeLanguageLinks(text, site = None): """Given the wiki-text of a page, return that page with all interwiki links removed. If a link to an unknown language is encountered, a warning is printed.""" if site == None: site = getSite() # This regular expression will find every link that is possibly an # interwiki link... | 35,749 |
def convert(text): ''' Converts all HTML tables in text to wiki syntax. If text contains wiki tables, tries to beautify them. Returns converted text if page was successfully changed, otherwise returns None. ''' warnings = 0 # this array will contain strings that will be shown in case of possible # errors, before the us... | def convert(text): ''' Converts all HTML tables in text to wiki syntax. If text contains wiki tables, tries to beautify them. Returns converted text if page was successfully changed, otherwise returns None. ''' warnings = 0 # this array will contain strings that will be shown in case of possible # errors, before the us... | 35,750 |
def convert(text): ''' Converts all HTML tables in text to wiki syntax. If text contains wiki tables, tries to beautify them. Returns converted text if page was successfully changed, otherwise returns None. ''' warnings = 0 # this array will contain strings that will be shown in case of possible # errors, before the us... | def convert(text): ''' Converts all HTML tables in text to wiki syntax. If text contains wiki tables, tries to beautify them. Returns converted text if page was successfully changed, otherwise returns None. ''' warnings = 0 # this array will contain strings that will be shown in case of possible # errors, before the us... | 35,751 |
def __init__(self): family.Family.__init__(self) self.name = 'wikipedia' | def __init__(self): family.Family.__init__(self) self.name = 'wikipedia' | 35,752 |
def links(self): # Gives the normal (not-interwiki, non-category) pages the page # directs to, as strings result = [] try: thistxt = removeLanguageLinks(self.get()) except IsRedirectPage: pass try: thistxt = removeCategoryLinks(self.get(), self.code()) except IsRedirectPage: pass w=r'([^\]\|]*)' Rlink = re.compile(r'\[... | def links(self): # Gives the normal (not-interwiki, non-category) pages the page # directs to, as strings result = [] try: thistxt = removeLanguageLinks(self.get()) except IsRedirectPage: return thistxt = removeCategoryLinks(thistxt, self.code()) w=r'([^\]\|]*)' Rlink = re.compile(r'\[\['+w+r'(\|'+w+r')?\]\]') for l in... | 35,753 |
def get(self): return getPage(self.code(),self.urlname()) | def get(self): return getPage(self.code(),self.urlname()) | 35,754 |
def putPage(code, name, text, comment=None): """Upload 'text' on page 'name' to the 'code' language wikipedia.""" import httplib host = langs[code] if host[-4:] == '.com': raise Error("Cannot put pages on a .com wikipedia") address = '/w/wiki.phtml?title=%s&action=submit'%space2underline(name) if comment is None: comme... | def putPage(code, name, text, comment=None): """Upload 'text' on page 'name' to the 'code' language wikipedia.""" import httplib host = langs[code] if host[-4:] == '.com': raise Error("Cannot put pages on a .com wikipedia") address = '/w/wiki.phtml?title=%s&action=submit'%space2underline(name) if comment is None: comme... | 35,755 |
def getUrl(host,address): uo=urllib.FancyURLopener() f=uo.open('http://%s%s'%(host,address)) text=f.read() ct=f.info()['Content-Type'] R=re.compile('charset=([^\'\"]+)') m=R.search(ct) if m: charset=m.group(1) else: charset=None return text,charset | def getUrl(host,address): uo=MyURLopener() f=uo.open('http://%s%s'%(host,address)) text=f.read() ct=f.info()['Content-Type'] R=re.compile('charset=([^\'\"]+)') m=R.search(ct) if m: charset=m.group(1) else: charset=None return text,charset | 35,756 |
def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | 35,757 |
def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | 35,758 |
def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | 35,759 |
def get_image(fn,target,description): # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = file.read() file.close() # Isolate the pure name if '/' in fn: fn = fn.split('/')[-1] if '\\' in fn: fn = fn.split('\\')[-1] print "The filename on wikipedia will default to:",fn newfn = raw_input("Bette... | def get_image(fn,target,description): # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = file.read() file.close() # Isolate the pure name if '/' in fn: fn = fn.split('/')[-1] if '\\' in fn: fn = fn.split('\\')[-1] print "The filename on wikipedia will default to:",fn newfn = raw_input("Bette... | 35,760 |
def generate(self): while True: i = 0 pls = [] for pl in wikipedia.allpages(start = self.start): pls.append(pl) i += 1 if i >= 60: self.start = pl.urlname() + '!' break wikipedia.getall(wikipedia.getSite(), pls) for pl in pls: if not pl.isRedirectPage(): yield pl.linkname(), pl.get() | def generate(self): while True: i = 0 pls = [] for pl in wikipedia.allpages(start = self.start): pls.append(pl) i += 1 if i >= 60: self.start = pl.urlname() + '!' break wikipedia.getall(wikipedia.getSite(), pls) for pl in pls: if not pl.isRedirectPage(): yield pl.linkname(), pl.get() | 35,761 |
def run(self): """ Starts the robot. """ # Run the generator which will yield PageLinks to pages which might need to be # changed. for pl in self.generator(): print '' try: # Load the page's text from the wiki original_text = pl.get() except wikipedia.NoPage: wikipedia.output(u'Page %s not found' % pl.linkname()) conti... | def run(self): """ Starts the robot. """ # Run the generator which will yield PageLinks to pages which might need to be # changed. for pl in self.generator(): print '' try: # Load the page's text from the wiki original_text = pl.get() except wikipedia.NoPage: wikipedia.output(u'Page %s not found' % pl.linkname()) conti... | 35,762 |
def convertTable(self, table): ''' Converts an HTML table to wiki syntax. If the table already is a wiki table or contains a nested wiki table, tries to beautify it. Returns the converted table, the number of warnings that occured and a list containing these warnings. | def convertTable(self, table): ''' Converts an HTML table to wiki syntax. If the table already is a wiki table or contains a nested wiki table, tries to beautify it. Returns the converted table, the number of warnings that occured and a list containing these warnings. | 35,763 |
def generator(source, replacements, exceptions, regex, namespace, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by ... | def generator(source, replacements, exceptions, regex, namespace, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by ... | 35,764 |
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | 35,765 |
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | 35,766 |
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | 35,767 |
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.code]) % d, language = self.code) | 35,768 |
def log(self, url, error, containingPage): """ Logs an error report to a text file in the deadlinks subdirectory. """ site = wikipedia.getSite() errorReport = u'* %s\n' % url for (pageTitle, date, error) in self.historyDict[url]: # ISO 8601 formulation isoDate = time.strftime('%Y-%m-%d %H:%M:%S', date) errorReport += "... | def log(self, url, error, containingPage): """ Logs an error report to a text file in the deadlinks subdirectory. """ site = wikipedia.getSite() errorReport = u'* %s\n' % url for (pageTitle, date, error) in self.historyDict[url]: # ISO 8601 formulation isoDate = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(date)) err... | 35,769 |
def sametranslate(pl, arr, same): site = pl.site() for newcode in site.family.seriouslangs: # Put as suggestion into array newname = pl.linkname() if newcode in ['eo','cs'] and same == 'name': newname = newname.split(' ') newname[-1] = newname[-1].upper() newname = ' '.join(newname) x=wikipedia.PageLink(wikipedia.getSi... | def sametranslate(pl, arr, same): site = pl.site() for newcode in site.family.seriouslangs: # Put as suggestion into array newname = pl.linkname() if newcode in ['eo','cs'] and same == 'name': newname = newname.split(' ') newname[-1] = newname[-1].upper() newname = ' '.join(newname) x=wikipedia.PageLink(wikipedia.getSi... | 35,770 |
def main(): start = None pageTitle = [] for arg in sys.argv[1:]: arg = wikipedia.argHandler(arg, 'weblinkchecker') if arg: if arg.startswith('-start:'): start = arg[7:] else: pageTitle.append(arg) if start: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikipedia.Page(wi... | def main(): start = u'!' pageTitle = [] for arg in sys.argv[1:]: arg = wikipedia.argHandler(arg, 'weblinkchecker') if arg: if arg.startswith('-start:'): start = arg[7:] else: pageTitle.append(arg) if start: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikipedia.Page(wi... | 35,771 |
def main(): start = None pageTitle = [] for arg in sys.argv[1:]: arg = wikipedia.argHandler(arg, 'weblinkchecker') if arg: if arg.startswith('-start:'): start = arg[7:] else: pageTitle.append(arg) if start: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikipedia.Page(wi... | def main(): start = None pageTitle = [] for arg in sys.argv[1:]: arg = wikipedia.argHandler(arg, 'weblinkchecker') if arg: if arg.startswith('-start:'): start = arg[7:] else: pageTitle.append(arg) if pageTitle == []: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikiped... | 35,772 |
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | 35,773 |
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | 35,774 |
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | 35,775 |
def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' # TODO: Malconfigured HTTP servers might give a redirect loop. A # recursion counter and limit would help. conn = httplib.HTTPConnection(self.host... | def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' # TODO: Malconfigured HTTP servers might give a redirect loop. A # recursion counter and limit would help. conn = httplib.HTTPConnection(self.host... | 35,776 |
def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' # TODO: Malconfigured HTTP servers might give a redirect loop. A # recursion counter and limit would help. conn = httplib.HTTPConnection(self.host... | defnewURL = None resolveRedirect(self):newURL = None '''newURL = None RequestsnewURL = None thenewURL = None headernewURL = None fromnewURL = None thenewURL = None server.newURL = None IfnewURL = None thenewURL = None pagenewURL = None isnewURL = None annewURL = None HTTPnewURL = None redirect,newURL = None returnsnewU... | 35,777 |
def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' # TODO: Malconfigured HTTP servers might give a redirect loop. A # recursion counter and limit would help. conn = httplib.HTTPConnection(self.host... | def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' # TODO: Malconfigured HTTP servers might give a redirect loop. A # recursion counter and limit would help. conn = httplib.HTTPConnection(self.host... | 35,778 |
def translate(page, hints = None, auto = True): """ Please comment your source code! --Daniel Does some magic stuff. Returns a list of pages. """ result = {} site = page.site() if hints: for h in hints: if h.find(':') == -1: # argument given as -hint:xy where xy is a language code codes = h newname = '' else: codes, n... | def translate(page, hints = None, auto = True): """ Please comment your source code! --Daniel Does some magic stuff. Returns a list of pages. """ result = [] site = page.site() if hints: for h in hints: if h.find(':') == -1: # argument given as -hint:xy where xy is a language code codes = h newname = '' else: codes, n... | 35,779 |
def replaceCategoryLinks(oldtext, new, site = None): """Replace the category links given in the wikitext given in oldtext by the new links given in new. 'new' should be a list of Category objects. """ if site is None: site = getSite() # first remove interwiki links and add them later, so that # interwiki tags appear b... | def replaceCategoryLinks(oldtext, new, site = None): """Replace the category links given in the wikitext given in oldtext by the new links given in new. 'new' should be a list of Category objects. """ if site is None: site = getSite() # first remove interwiki links and add them later, so that # interwiki tags appear b... | 35,780 |
def treat(self, refPage, disambPage): """ Parameters: disambPage - The disambiguation page or redirect we don't want anything to link on refPage - A page linking to disambPage Returns False if the user pressed q to completely quit the program. Otherwise, returns True. """ # TODO: break this function up into subroutines... | def treat(self, refPage, disambPage): """ Parameters: disambPage - The disambiguation page or redirect we don't want anything to link on refPage - A page linking to disambPage Returns False if the user pressed q to completely quit the program. Otherwise, returns True. """ # TODO: break this function up into subroutines... | 35,781 |
def get(site = None): if site is None: site = wikipedia.getSite() if cache.has_key(site): # Use cached copy if it exists. dictionary = cache[site] else: fn = 'watchlists/watchlist-%s-%s.dat' % (site.family.name, site.lang) try: # find out how old our saved dump is (in seconds) file_age = time.time() - os.path.getmtime(... | def get(site = None): if site is None: site = wikipedia.getSite() if cache.has_key(site): # Use cached copy if it exists. watchlist = cache[site] else: fn = 'watchlists/watchlist-%s-%s.dat' % (site.family.name, site.lang) try: # find out how old our saved dump is (in seconds) file_age = time.time() - os.path.getmtime(f... | 35,782 |
def refresh(site): # get watchlist special page's URL path = site.watchlist_address() print 'Retrieving watchlist for %s' % repr(site) #wikipedia.put_throttle() # It actually is a get, but a heavy one. watchlistHTML = wikipedia.getUrl(site, path) print 'Parsing watchlist' watchlist = [] itemR = re.compile(r'<input typ... | def refresh(site): # get watchlist special page's URL path = site.watchlist_address() print 'Retrieving watchlist for %s' % repr(site) #wikipedia.put_throttle() # It actually is a get, but a heavy one. watchlistHTML = wikipedia.getUrl(site, path) print 'Parsing watchlist' watchlist = [] itemR = re.compile(r'<input typ... | 35,783 |
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe... | 35,784 |
def retrieve_broken_redirects(self): if self.source == None: # retrieve information from the live wiki's maintenance page mysite = wikipedia.getSite() # broken redirect maintenance page's URL path = mysite.broken_redirects_address(default_limit = False) print 'Retrieving special page...' maintenance_txt = wikipedia.get... | def retrieve_broken_redirects(self): if self.source == None: # retrieve information from the live wiki's maintenance page mysite = wikipedia.getSite() # broken redirect maintenance page's URL path = mysite.broken_redirects_address(default_limit = False) print 'Retrieving special page...' maintenance_txt = wikipedia.get... | 35,785 |
def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page. This will raise an exception if the home language does not have a translation of 'Special' listed above.""" import sys start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, '%s:All... | def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page. This will raise an exception if the home language does not have a translation of 'Special' listed above.""" import sys start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, '%s:All... | 35,786 |
def getReferences(pl): host = langs[pl.code()] url = "/w/wiki.phtml?title=%s:Whatlinkshere&target=%s"%(special[mylang], pl.urlname()) txt, charset = getUrl(host,url) Rref = re.compile('<li><a href.* title="([^"]*)"') x = Rref.findall(txt) x.sort() # Remove duplicates for i in range(len(x)-1, 0, -1): if x[i] == x[i-1]: ... | def getReferences(pl): host = langs[pl.code()] url = "/w/wiki.phtml?title=%s:Whatlinkshere&target=%s"%(special[mylang], pl.urlname()) txt, charset = getUrl(host,url) Rref = re.compile('<li><a href.*="([^"]*)"') x = Rref.findall(txt) x.sort() # Remove duplicates for i in range(len(x)-1, 0, -1): if x[i] == x[i-1]: del x[... | 35,787 |
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i... | def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i... | 35,788 |
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i... | def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i... | 35,789 |
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i... | def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i... | 35,790 |
def finish(self, sa = None): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty. | def updatedSites = [] finish(self, updatedSites = [] sa updatedSites = [] = updatedSites = [] None): updatedSites = [] """Round updatedSites = [] up updatedSites = [] the updatedSites = [] subject, updatedSites = [] making updatedSites = [] any updatedSites = [] necessary updatedSites = [] changes. updatedSites = [] Th... | 35,791 |
def finish(self, sa = None): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty. | def finish(self, sa = None): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty. | 35,792 |
def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | 35,793 |
def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | 35,794 |
def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | 35,795 |
def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | 35,796 |
def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | def replaceLinks(self, pl, new, sa): wikipedia.output(u"Updating links on page %s." % pl.aslink(forceInterwiki = True)) | 35,797 |
def reportBacklinks(self, new): """Report missing back links. This will be called from finish() if needed.""" try: for site in new.keys(): pl = new[site] if not pl.section(): shouldlink = new.values() + [self.inpl] linked = pl.interwiki() for xpl in shouldlink: if xpl != pl and not xpl in linked: for l in linked: if l.... | def reportBacklinks(self, new): """Report missing back links. This will be called from finish() if needed.""" try: for site, page in new.iteritems(): if not page.section(): shouldlink = new.values() + [self.inpl] linked = pl.interwiki() for xpl in shouldlink: if xpl != pl and not xpl in linked: for l in linked: if l.si... | 35,798 |
def reportBacklinks(self, new): """Report missing back links. This will be called from finish() if needed.""" try: for site in new.keys(): pl = new[site] if not pl.section(): shouldlink = new.values() + [self.inpl] linked = pl.interwiki() for xpl in shouldlink: if xpl != pl and not xpl in linked: for l in linked: if l.... | def reportBacklinks(self, new): """Report missing back links. This will be called from finish() if needed.""" try: for site in new.keys(): pl = new[site] if not pl.section(): shouldlink = new.values() + [self.inpl] linked = page.interwiki() for xpage in shouldlink: if xpage != page and not xpage in linked: for l in lin... | 35,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.