bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def treat(self, refpl, disambPl): """ Parameters: disambPl - The disambiguation page or redirect we don't want anything to link on refpl - A page linking to disambPl Returns False if the user pressed q to completely quit the program. Otherwise, returns True. """
def treat(self, refpl, disambPl): """ Parameters: disambPl - The disambiguation page or redirect we don't want anything to link on refpl - A page linking to disambPl Returns False if the user pressed q to completely quit the program. Otherwise, returns True. """
35,400
def generateMore(self, number): """Generate more subjects. This is called internally when the list of subjects becomes too 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(forceInterwiki = True)) print "NOTE: Numbe...
def generateMore(self, number): """Generate more subjects. This is called internally when the list of subjects becomes too 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(forceInterwiki = True)) print "NOTE: Numbe...
35,401
def getReferences(self, follow_redirects=True, withTemplateInclusion = True, onlyTemplateInclusion = False): """ Return a list of pages that link to the page. Parameters: * follow_redirects - if True, also returns pages that link to a redirect pointing to the page. * withTemplateInclusion - if True, also returns ...
def getReferences(self, follow_redirects=True, withTemplateInclusion = True, onlyTemplateInclusion = False): """ Return a list of pages that link to the page. Parameters: * follow_redirects - if True, also returns pages that link to a redirect pointing to the page. * withTemplateInclusion - if True, also returns ...
35,402
def getReferences(self, follow_redirects=True, withTemplateInclusion = True, onlyTemplateInclusion = False): """ Return a list of pages that link to the page. Parameters: * follow_redirects - if True, also returns pages that link to a redirect pointing to the page. * withTemplateInclusion - if True, also returns ...
def getReferences(self, follow_redirects=True, withTemplateInclusion = True, onlyTemplateInclusion = False): """ Return a list of pages that link to the page. Parameters: * follow_redirects - if True, also returns pages that link to a redirect pointing to the page. * withTemplateInclusion - if True, also returns ...
35,403
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: arg = wikipedia.argHandler(arg) if arg: print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(descripti...
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: if wikipedia.argHandler(arg): print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(description) bot = ...
35,404
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: arg = wikipedia.argHandler(arg) if arg: print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(descripti...
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: arg = wikipedia.argHandler(arg) if arg: print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(descripti...
35,405
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: arg = wikipedia.argHandler(arg) if arg: print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(descripti...
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: arg = wikipedia.argHandler(arg) if arg: print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(descripti...
35,406
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: arg = wikipedia.argHandler(arg) if arg: print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(descripti...
def main(args): filename = '' description = [] keep = False wiki = '' for arg in args: arg = wikipedia.argHandler(arg) if arg: print arg if arg.startswith('-keep'): keep = True elif arg.startswith('-wiki:'): wiki=arg[6:] elif filename == '': filename = arg else: description.append(arg) description = ' '.join(descripti...
35,407
def getReferences(self): refs = wikipedia.getReferences(self.disambPl, follow_redirects = False) print "Found %d references" % len(refs) # Remove ignorables if ignore_title.has_key(self.disambPl.site().lang): ignore_title_regexes = [] for ig in ignore_title[self.disambPl.site().lang]: ig = ig.encode(wikipedia.myencodin...
def getReferences(self): refs = wikipedia.getReferences(self.disambPl, follow_redirects = False) wikipedia.output(u"Found %d references." % len(refs)) # Remove ignorables if ignore_title.has_key(self.disambPl.site().lang): ignore_title_regexes = [] for ig in ignore_title[self.disambPl.site().lang]: ig = ig.encode(wikip...
35,408
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 pageTitle == []: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikiped...
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 pageTitle == []: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikiped...
35,409
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 pageTitle == []: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikiped...
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 pageTitle == []: gen = pagegenerators.AllpagesPageGenerator(start) else: pageTitle = ' '.join(pageTitle) page = wikiped...
35,410
def __init__(self, url): self.url = url # we ignore the fragment self.scheme, self.host, self.path, self.query, self.fragment = urlparse.urlsplit(self.url) if not self.path: self.path = '/' if self.query: self.query = '?' + self.query #header = {'User-agent': 'PythonWikipediaBot/1.0'} # we fake being Opera because some...
def __init__(self, url, redirectList = []): """ redirectList is a list of redirects which were resolved by resolveRedirect(). This is needed to detect redirect loops. """ self.url = url # we ignore the fragment self.scheme, self.host, self.path, self.query, self.fragment = urlparse.urlsplit(self.url) if not self.path: ...
35,411
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,412
def check(self): try: url = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg: return False, u'Non-ASCII Characters in URL' if url: redirChecker = LinkChecker(url) return redirChecker.c...
def check(self): try: url = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg: return False, u'Non-ASCII Characters in URL' if url: if url in self.redirectList: self.redirectList.append...
35,413
def get_subcats(supercat): ''' For a given supercategory, return a list of CatLinks for all its subcategories. Saves this list in a temporary database so that it won't be loaded from the server next time it's required. ''' # if we already know which subcategories exist here if catContentDB.has_key(supercat): return cat...
def get_subcats(supercat): ''' For a given supercategory, return a list of CatLinks for all its subcategories. Saves this list in a temporary database so that it won't be loaded from the server next time it's required. ''' # if we already know which subcategories exist here if catContentDB.has_key(supercat): return cat...
35,414
def replaceLanguageLinks(oldtext, new): """Replace the interwiki language links given in the wikitext given in oldtext by the new links given in new. 'new' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. """ s = interwikiFormat(new, incode =...
def replaceLanguageLinks(oldtext, new): """Replace the interwiki language links given in the wikitext given in oldtext by the new links given in new. 'new' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. """ s = interwikiFormat(new) s2 = rem...
35,415
def interwikiFormat(links, incode): """Create a suitable string encoding all interwiki links for a wikipedia page. 'links' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. 'incode' should be the name of the wikipedia language that is the tar...
def interwikiFormat(links): """Create a suitable string encoding all interwiki links for a wikipedia page. 'links' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. 'incode' should be the name of the wikipedia language that is the target of t...
35,416
def interwikiFormat(links, incode): """Create a suitable string encoding all interwiki links for a wikipedia page. 'links' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. 'incode' should be the name of the wikipedia language that is the tar...
def interwikiFormat(links, incode): """Create a suitable string encoding all interwiki links for a wikipedia page. 'links' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. The string is formatted for inclusion in mylang. """ if not links: re...
35,417
def interwikiFormat(links, incode): """Create a suitable string encoding all interwiki links for a wikipedia page. 'links' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. 'incode' should be the name of the wikipedia language that is the tar...
def interwikiFormat(links, incode): """Create a suitable string encoding all interwiki links for a wikipedia page. 'links' should be a dictionary with the language names as keys, and either PageLink objects or the link-names of the pages as values. 'incode' should be the name of the wikipedia language that is the tar...
35,418
def url2link(percentname,incode,code): """Convert a url-name of a page into a proper name for an interwiki link the argument 'incode' specifies the encoding of the target wikipedia """ result = underline2space(percentname) x = url2unicode(result, language = code) if code2encoding(incode) == code2encoding(code): #print ...
def url2link(percentname,incode,code): """Convert a url-name of a page into a proper name for an interwiki link the argument 'incode' specifies the encoding of the target wikipedia """ result = underline2space(percentname) x = url2unicode(result, language = code) if code2encoding(incode) == 'utf-8': return x elif code...
35,419
def allpages(self, start = '!', namespace = 0, throttle = True): """Generator which yields all articles in the home language in alphanumerical order, starting at a given page. By default, it starts at '!', so it should yield all pages.
def allpages(self, start = '!', namespace = 0, throttle = True): """Generator which yields all articles in the home language in alphanumerical order, starting at a given page. By default, it starts at '!', so it should yield all pages.
35,420
def __init__(self, always, alternatives, getAlternatives, solve_redirect, page_list, primary, main_only): self.always = always self.alternatives = alternatives self.getAlternatives = getAlternatives self.solve_redirect = solve_redirect self.page_list = page_list self.primary = primary self.main_only = main_only
def __init__(self, always, alternatives, getAlternatives, solve_redirect, page_list, primary, main_only): self.always = always self.alternatives = alternatives self.getAlternatives = getAlternatives self.solve_redirect = solve_redirect self.page_list = page_list self.primary = primary self.ma...
35,421
def ignoredBecauseOfContents(self, text): for ig in self.ignore_contents_regexes: match = ig.search(text) if match: return match.group() return False
def checkContents(self, text): ''' For a given text, returns False if none of the regular expressions given in the dictionary at the top of this class matches a substring of the text. Otherwise returns the substring which is matched by one of the regular expressions. ''' for ig in self.ignore_contents_regexes: match = ...
35,422
def ignoredBecauseOfContents(self, text): for ig in self.ignore_contents_regexes: match = ig.search(text) if match: return match.group() return False
def ignoredBecauseOfContents(self, text): for ig in self.ignore_contents_regexes: match = ig.search(text) if match: return match.group() return None
35,423
def treat(self, refpl, disambPl): """ Parameters: disambPl - The disambiguation page or redirect we don't want anything to link on refpl - A page linking to disambPl Returns False if the user pressed q to completely quit the program. Otherwise, returns True. """ if self.mylang in link_trail: linktrail=link_trail[self.m...
def treat(self, refpl, disambPl): """ Parameters: disambPl - The disambiguation page or redirect we don't want anything to link on refpl - A page linking to disambPl Returns False if the user pressed q to completely quit the program. Otherwise, returns True. """ if self.mylang in link_trail: linktrail=link_trail[self.m...
35,424
def run(self): if self.main_only: if ignore.has_key(self.mylang): ignore[self.mylang] += self.mysite.namespaces() else: ignore[self.mylang] = self.mysite.namespaces() for disambTitle in self.page_list: # when run with -redir argument, there's another summary message if self.solve_redirect: wikipedia.setAction(wikipedi...
def run(self): if self.main_only: if ignore_title.has_key(self.mylang): ignore_title[self.mylang] += self.mysite.namespaces() else: ignore[self.mylang] = self.mysite.namespaces() for disambTitle in self.page_list: # when run with -redir argument, there's another summary message if self.solve_redirect: wikipedia.setAct...
35,425
def run(self): if self.main_only: if ignore.has_key(self.mylang): ignore[self.mylang] += self.mysite.namespaces() else: ignore[self.mylang] = self.mysite.namespaces() for disambTitle in self.page_list: # when run with -redir argument, there's another summary message if self.solve_redirect: wikipedia.setAction(wikipedi...
def run(self): if self.main_only: if ignore.has_key(self.mylang): ignore[self.mylang] += self.mysite.namespaces() else: ignore_title[self.mylang] = self.mysite.namespaces() for disambTitle in self.page_list: # when run with -redir argument, there's another summary message if self.solve_redirect: wikipedia.setAction(wi...
35,426
def articles(self, recurse = 0): ns = wikipedia.family.category_namespaces(wikipedia.mylang) articles = [] titles = self.catlist(recurse) for title in titles: for ins in ns: # if the current link points to a subcategory if title.startswith(ins + ':'): # don't return this link titles.remove(title) for title in titles: n...
def articles(self, recurse = 0): articles = [] titles = self.catlist(recurse) for title in titles: for ins in ns: # if the current link points to a subcategory if title.startswith(ins + ':'): # don't return this link titles.remove(title) for title in titles: npage = wikipedia.PageLink(self.code(), title) articles.appen...
35,427
def articles(self, recurse = 0): ns = wikipedia.family.category_namespaces(wikipedia.mylang) articles = [] titles = self.catlist(recurse) for title in titles: for ins in ns: # if the current link points to a subcategory if title.startswith(ins + ':'): # don't return this link titles.remove(title) for title in titles: n...
def articles(self, recurse = 0): ns = wikipedia.family.category_namespaces(wikipedia.mylang) articles = [] titles = self.catlist(recurse) for title in titles: is_category = False for namespace in wikipedia.family.category_namespaces(wikipedia.mylang): # if the current link points to a subcategory if title.startswith(in...
35,428
def articles(self, recurse = 0): ns = wikipedia.family.category_namespaces(wikipedia.mylang) articles = [] titles = self.catlist(recurse) for title in titles: for ins in ns: # if the current link points to a subcategory if title.startswith(ins + ':'): # don't return this link titles.remove(title) for title in titles: n...
def articles(self, recurse = 0): ns = wikipedia.family.category_namespaces(wikipedia.mylang) articles = [] titles = self.catlist(recurse) for title in titles: for ins in ns: # if the current link points to a subcategory if title.startswith(ins + ':'): # don't return this link titles.remove(title) for title in titles: n...
35,429
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
35,430
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
35,431
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
35,432
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
35,433
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
35,434
def get_image(fn, target, description, debug=False): # 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 = r...
def get_image(fn, target, description, debug=False): # 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 = r...
35,435
def fileUrl(self): urlR = re.compile(r'<div class="fullImageLink" id="file"><a href="(?P<url1>.+?)">|<div class="fullImageLink" id="file"><img border="0" src="(?P<url2>.+?)"') m = urlR.search(self.getImagePageContents()) try: url = m.group('url1') or m.group('url2') except AttributeError: raise NoPage(u'Image page %s n...
def fileUrl(self): urlR = re.compile(r'<div class="fullImageLink" id="file">.+?\n.*?<a href="(?P<url>.+?)"', re.DOTALL) m = urlR.search(self.getImagePageContents()) try: url = m.group('url1') or m.group('url2') except AttributeError: raise NoPage(u'Image page %s not found.' % self.aslink(forceInterwiki = True)) re...
35,436
def fileUrl(self): urlR = re.compile(r'<div class="fullImageLink" id="file"><a href="(?P<url1>.+?)">|<div class="fullImageLink" id="file"><img border="0" src="(?P<url2>.+?)"') m = urlR.search(self.getImagePageContents()) try: url = m.group('url1') or m.group('url2') except AttributeError: raise NoPage(u'Image page %s n...
def fileUrl(self): urlR = re.compile(r'<div class="fullImageLink" id="file"><a href="(?P<url1>.+?)">|<div class="fullImageLink" id="file"><img border="0" src="(?P<url2>.+?)"') m = urlR.search(self.getImagePageContents()) try: url = m.group('url') except AttributeError: raise NoPage(u'Image page %s not found.' % self.as...
35,437
def getVersionHistory(self, forceReload = False): """ Loads the version history page and returns a list of tuples, where each tuple represents one edit and is built of edit date/time, user name, and edit summary. """ site = self.site() path = site.family.version_history_address(site, self.urlname())
def getVersionHistory(self, forceReload = False): """ Loads the version history page and returns a list of tuples, where each tuple represents one edit and is built of edit date/time, user name, and edit summary. """ site = self.site() path = site.family.version_history_address(site, self.urlname())
35,438
def getVersionHistory(self, forceReload = False): """ Loads the version history page and returns a list of tuples, where each tuple represents one edit and is built of edit date/time, user name, and edit summary. """ site = self.site() path = site.family.version_history_address(site, self.urlname())
def getVersionHistory(self, forceReload = False): """ Loads the version history page and returns a list of tuples, where each tuple represents one edit and is built of edit date/time, user name, and edit summary. """ site = self.site() path = site.family.version_history_address(site, self.urlname())
35,439
def transferImage(self, sourceImagePage, debug=False): """Gets a wikilink to an image, downloads it and its description, and uploads it to another wikipedia. Returns the filename which was used to upload the image This function is used by imagetransfer.py and by copy_table.py """ sourceSite = sourceImagePage.site() if ...
def transferImage(self, sourceImagePage, debug=False): """Gets a wikilink to an image, downloads it and its description, and uploads it to another wikipedia. Returns the filename which was used to upload the image This function is used by imagetransfer.py and by copy_table.py """ sourceSite = sourceImagePage.site() if ...
35,440
def main(): import re 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 "specific page. If you want the second, please give an empty" print "answer to the fir...
def main(): import re 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 "specific page. If you want the second, please give an empty" print "answer to the fir...
35,441
def extractArticle(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rPagestats = re.compile('.*(\<span id\=(\"|\')pagestats(\"|\')\>.*\<\/span\>)...
def extractArticle(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rPagestats = re.compile('.*(\<span id\=(\"|\')pagestats(\"|\')\>.*\<\/span\>)...
35,442
def extractArticle(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rPagestats = re.compile('.*(\<span id\=(\"|\')pagestats(\"|\')\>.*\<\/span\>)...
def extractArticle(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rPagestats = re.compile('.*(\<span id\=(\"|\')pagestats(\"|\')\>.*\<\/span\>)...
35,443
def extractArticle(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rPagestats = re.compile('.*(\<span id\=(\"|\')pagestats(\"|\')\>.*\<\/span\>)...
def extractArticle(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rPagestats = re.compile('.*(\<span id\=(\"|\')pagestats(\"|\')\>.*\<\/span\>)...
35,444
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*<a href="/wiki/.*?:(.*?)".*?[\n]*?.*?class="internal"'...
35,445
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
35,446
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
35,447
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
35,448
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
def extractImages(data): """ takes a string with the complete HTML-file and returns the article which is contained in <div id='article'> and the pagestats which contain information on last change """ images = [] s = StringIO.StringIO(data) rImage = re.compile('.*?<a href=\"\/wiki\/[^:]*:([^"]*)" class="image"') rThu...
35,449
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): f=open(arg[6:], 'r') R=re.compile(r'.*\[\[([^\]]*)\]\].*') m = False for lin...
35,450
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
35,451
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
defprint " done" main():print " done" mysiteprint " done" =print " done" wikipedia.getSite()print " done" saprint " done" =print " done" []print " done" output_directoryprint " done" =print " done" ""print " done" save_imagesprint " done" =print " done" Falseprint " done" overwrite_imagesprint " done" =print " done" Fa...
35,452
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
35,453
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
35,454
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
35,455
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
def main(): mysite = wikipedia.getSite() sa = [] output_directory = "" save_images = False overwrite_images = False overwrite_articles = False for arg in sys.argv[1:]: if arg.startswith("-lang:"): lang = arg[6:] elif arg.startswith("-file:"): for pl in wikipedia.PageLinksFromFile(arg[6:]): sa.append(pl) elif arg.start...
35,456
def main(): # the option that's always selected when the bot wonders what to do with # a link. If it's None, the user is prompted (default behaviour). always = None alternatives = [] getAlternatives = True solve_redirect = False # if the -file argument is used, page titles are dumped in this array. # otherwise it will ...
def main(): # the option that's always selected when the bot wonders what to do with # a link. If it's None, the user is prompted (default behaviour). always = None alternatives = [] getAlternatives = True solve_redirect = False # if the -file argument is used, page titles are dumped in this array. # otherwise it will ...
35,457
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, newPages, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,458
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,459
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,460
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
defreplaceLinks(self,pl,new,bot):"""ReturnsTrueifsavingwassuccessful."""ifglobalvar.localonly:#InthiscaseonlycontinueonthePagewestartedwithifpl!=self.pl():returnFalse
35,461
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,462
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,463
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,464
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,465
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
def replaceLinks(self, pl, new, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if pl != self.pl(): return False
35,466
def isInterwikiLink(self, s): """ Try to check whether s is in the form "foo:bar" where foo is a known language code or family. In such a case we are dealing with an interwiki link. """ if not ':' in s: return False first, rest = s.split(':',1) # interwiki codes are case-insensitive first = first.lower() if first in se...
def isInterwikiLink(self, s): """ Try to check whether s is in the form "foo:bar" where foo is a known language code or family. In such a case we are dealing with an interwiki link. """ if not ':' in s: return False first, rest = s.split(':',1) # interwiki codes are case-insensitive first = first.lower() if first in se...
35,467
def __init__(self, site, title, insite = None, tosite = None, defaultNamespace = 0): """ Constructor. Normally called with two arguments: Parameters: 1) The wikimedia site on which the page resides 2) The title of the page as a unicode string
def __init__(self, site, title, insite = None, tosite = None, defaultNamespace = 0): """ Constructor. Normally called with two arguments: Parameters: 1) The wikimedia site on which the page resides 2) The title of the page as a unicode string
35,468
def getFileLinks(self): """ Yield all pages that link to the page. If you need a full list of referring pages, use this:
def getFileLinks(self): """ Yield all pages that link to the page. If you need a full list of referring pages, use this:
35,469
def getFileLinks(self): """ Yield all pages that link to the page. If you need a full list of referring pages, use this:
def getFileLinks(self): """ Yield all pages that link to the page. If you need a full list of referring pages, use this:
35,470
def getFileLinks(self): """ Yield all pages that link to the page. If you need a full list of referring pages, use this:
def getFileLinks(self): """ Yield all pages that link to the page. If you need a full list of referring pages, use this:
35,471
def hostname(self, code): return self.langs[code]
def hostname(self, code): return 'dvd.wikidev.net'
35,472
def main(): # read command line parameters # what the bot should do (either resolve double redirs, or delete broken redirs) action = None # where the bot should get his infos from (either None to load the maintenance # special page from the live wiki, or the filename of a local XML dump file) xmlFilename = None # Which...
def main(): # read command line parameters # what the bot should do (either resolve double redirs, or delete broken redirs) action = None # where the bot should get his infos from (either None to load the maintenance # special page from the live wiki, or the filename of a local XML dump file) xmlFilename = None # Which...
35,473
def __init__(self, oldCatTitle, newCatTitle, batchMode = False, editSummary = '', inPlace = False, moveCatPage = True): self.editSummary = editSummary self.inPlace = inPlace self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle self.inPlace = inPlace self.moveCatPa...
def __init__(self, oldCatTitle, newCatTitle, batchMode = False, editSummary = '', inPlace = False, moveCatPage = True): self.editSummary = editSummary self.inPlace = inPlace self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle self.inPlace = inPlace self.moveCatPa...
35,474
def ReadWarnfile(fn, sa): import re R=re.compile(r'WARNING: ([^\[]*):\[\[([^\[]+)\]\]([^\[]+)\[\[([^\[]+):([^\[]+)\]\]') f=open(fn) hints={} for line in f.readlines(): m=R.search(line) if m: #print "DBG>",line if m.group(1)==wikipedia.mylang: #print m.group(1), m.group(2), m.group(3), m.group(4), m.group(5) if not hint...
def ReadWarnfile(fn, sa): import re R=re.compile(r'WARNING: ([^\[]*):\[\[([^\[]+)\]\]([^\[]+)\[\[([^\[]+):([^\[]+)\]\]') f=open(fn) hints={} for line in f.readlines(): m=R.search(line) if m: #print "DBG>",line if m.group(1)==wikipedia.mylang: #print m.group(1), m.group(2), m.group(3), m.group(4), m.group(5) if not hint...
35,475
def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page.""" start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, family.allpagesname(mylang, start), do_quote=0, do_edit=0) #print text if family.version(mylang)=="1.2": R = re.compile('/w...
def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page.""" start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, family.allpagesname(mylang, start), do_quote=0, do_edit=0) #print text if family.version(mylang)=="1.2": R = re.compile('/w...
35,476
def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page.""" start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, family.allpagesname(mylang, start), do_quote=0, do_edit=0) #print text if family.version(mylang)=="1.2": R = re.compile('/w...
def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page.""" start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, family.allpagesname(mylang, start), do_quote=0, do_edit=0) #print text if family.version(mylang)=="1.2": R = re.compile('/w...
35,477
def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page.""" start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, family.allpagesname(mylang, start), do_quote=0, do_edit=0) #print text if family.version(mylang)=="1.2": R = re.compile('/w...
def allpages(start = '%21%200'): """Iterate over all Wikipedia pages in the home language, starting at the given page.""" start = link2url(start, code = mylang) m=0 while 1: text = getPage(mylang, family.allpagesname(mylang, start), do_quote=0, do_edit=0) #print text if family.version(mylang)=="1.2": R = re.compile('/w...
35,478
def treat(refpl, thispl): try: reftxt=refpl.get() except wikipedia.IsRedirectPage: wikipedia.output(u'%s is a redirect to %s' % (refpl.linkname(), thispl.linkname())) choice = wikipedia.input(u'Do you want to work on pages linking to %s? [y|N]' % refpl.linkname()) if choice == 'y': for ref_redir in getReferences(refpl)...
def treat(refpl, thispl): try: reftxt=refpl.get() except wikipedia.IsRedirectPage: wikipedia.output(u'%s is a redirect to %s' % (refpl.linkname(), thispl.linkname())) choice = wikipedia.input(u'Do you want to work on pages linking to %s? [y|N]' % refpl.linkname()) if choice == 'y': for ref_redir in getReferences(refpl)...
35,479
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
35,480
def getData(self): if not self.pages: return addr = self.site.export_address() # In the next line, we assume that what we got for eo: is NOT in x-convention # but SHOULD be. This is worst-case; to avoid not getting what we need, if we # find nothing, we will retry the normal way with an unadapted form. pagenames = u'\r...
def getData(self): if not self.pages: return addr = self.site.export_address() # In the next line, we assume that what we got for eo: is NOT in x-convention # but SHOULD be. This is worst-case; to avoid not getting what we need, if we # find nothing, we will retry the normal way with an unadapted form. pagenames = u'\r...
35,481
def isdate(s): """returns true iff s is a date or year """ dict,val = getDictionaryYear( wikipedia.mylang, s ) return dict != None
def isdate(s): """returns true iff s is a date or year """ dict,val = date.getDictionaryYear( wikipedia.getSite().language(), s ) return dict != None
35,482
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,483
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,484
def finish(self): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty.""" if self.inpl.isRedirectPage(): return if not self.isDone(): raise "Bugcheck: finish called before done" print "======Post-processing %s======"%(self.inpl.asasciilink(...
def finish(self): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty.""" if self.inpl.isRedirectPage(): return if not self.isDone(): raise "Bugcheck: finish called before done" print "======Post-processing %s======"%(self.inpl.asasciilink(...
35,485
def getEditPage(site, name, read_only = False, do_quote = True, get_redirect=False, throttle = True): """ Get the contents of page 'name' from the 'site' wiki Do not use this directly; for 99% of the possible ideas you can use the Page object instead. Arguments: site - the wiki site name - the page n...
def getEditPage(site, name, read_only = False, do_quote = True, get_redirect=False, throttle = True): """ Get the contents of page 'name' from the 'site' wiki Do not use this directly; for 99% of the possible ideas you can use the Page object instead. Arguments: site - the wiki site name - the page n...
35,486
def output(self, text, urgency = 1, colors = None, newline = True): """ urgency levels: 0 - Debug output. Won't be shown in normal mode. 1 - Will be shown in log window. 2 - Will be shown in error box.
def output(self, text, urgency = 1, colors = None, newline = True): """ urgency levels: 0 - Debug output. Won't be shown in normal mode. 1 - Will be shown in log window. 2 - Will be shown in error box.
35,487
def inputChoice(self, question, options, hotkeys, default = None):
def inputChoice(self, question, options, hotkeys, default = None):
35,488
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,489
def getFoundNonDisambig(self,site): """ If we found a non-disambiguation on the given site while working on the subject, this method returns it. If several ones have been found, the first one will be returned. Otherwise, None will be returned. """ for page in self.done + self.pending: if page.site() == site: if page.ex...
def getFoundNonDisambig(self,site): """ If we found a non-disambiguation on the given site while working on the subject, this method returns it. If several ones have been found, the first one will be returned. Otherwise, None will be returned. """ for page in self.done + self.pending: if page.site() == site: if page.ex...
35,490
def readWarnfile(filename, bot): 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 bac...
def readWarnfile(filename, bot): 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 bac...
35,491
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wikipe...
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: contents = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wi...
35,492
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wikipe...
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: contents = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wi...
35,493
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wikipe...
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''", contents).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = w...
35,494
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wikipe...
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: page = wiki...
35,495
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wikipe...
def findpage(t): try: location = re.search(starttext+"([^\Z]*?)"+endtext,t) if include: page = location.group() else: page = location.group(1) except AttributeError: return try: title = re.search("'''(.*?)'''",page).group(1) except AttributeError: wikipedia.output(u"No title found - skipping a page.") else: pl = wikipe...
35,496
def main(): text = [] if utf: f=codecs.open(filename,'rb',encoding='utf-8') else: f=open(filename,'r') for line in f.readlines(): text.append(line) text=''.join(text) findpage(text)
def main(): text = [] f = codecs.open(filename,'r', encoding = config.textfile_encoding) text = f.read() findpage(text)
35,497
def main(): text = [] if utf: f=codecs.open(filename,'rb',encoding='utf-8') else: f=open(filename,'r') for line in f.readlines(): text.append(line) text=''.join(text) findpage(text)
def main(): text = [] if utf: f=codecs.open(filename,'rb',encoding='utf-8') else: f=open(filename,'r') for line in f.readlines(): text.append(line) text=''.join(text) findpage(text)
35,498
def __init__(self): family.Family.__init__(self) self.name = 'wikisource' for lang in self.knownlanguages: self.langs[lang] = lang+'.wikisource.org'
def __init__(self): family.Family.__init__(self) self.name = 'wikisource' for lang in self.knownlanguages: self.langs[lang] = lang+'.wikisource.org'
35,499