rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
print "ERROR: couldn't find " + page_title | wikipedia.output(u"ERROR: couldn't find %s" % pl.linkname()) | def treat(self, pl): ''' Loads a page, converts all HTML tables in its text to wiki syntax, and saves the converted text. Returns True if the converted table was successfully saved, otherwise returns False. ''' site = pl.site() try: text = pl.get() except wikipedia.NoPage: print "ERROR: couldn't find " + page_title ret... | b20bfa660ba49b13d1f2197a71b2d54fe6ac6aa4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b20bfa660ba49b13d1f2197a71b2d54fe6ac6aa4/table2wiki.py |
wikipedia.output(u'Skipping locked page %s' % page_title) | wikipedia.output(u'Skipping locked page %s' % pl.linkname()) | def treat(self, pl): ''' Loads a page, converts all HTML tables in its text to wiki syntax, and saves the converted text. Returns True if the converted table was successfully saved, otherwise returns False. ''' site = pl.site() try: text = pl.get() except wikipedia.NoPage: print "ERROR: couldn't find " + page_title ret... | b20bfa660ba49b13d1f2197a71b2d54fe6ac6aa4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b20bfa660ba49b13d1f2197a71b2d54fe6ac6aa4/table2wiki.py |
wikipedia.output(u'Skipping redirect %s' % page_title) | wikipedia.output(u'Skipping redirect %s' % pl.linkname()) | def treat(self, pl): ''' Loads a page, converts all HTML tables in its text to wiki syntax, and saves the converted text. Returns True if the converted table was successfully saved, otherwise returns False. ''' site = pl.site() try: text = pl.get() except wikipedia.NoPage: print "ERROR: couldn't find " + page_title ret... | b20bfa660ba49b13d1f2197a71b2d54fe6ac6aa4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b20bfa660ba49b13d1f2197a71b2d54fe6ac6aa4/table2wiki.py |
wikipedia.setAction(msg[msglang]+wrd) | wikipedia.setAction(msg[msglang]+': '+wrd) | def getReferences(pl): x = wikipedia.getReferences(pl) # Remove ignorables if ignore.has_key(pl.code()): ig=ignore[pl.code()] for i in range(len(x)-1, -1, -1): if x[i] in ig: del x[i] return x | e84589978467023a76bd48120cc04470c6dfad5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/e84589978467023a76bd48120cc04470c6dfad5b/solve_disambiguation.py |
+ "\s*<a href=.+?>.+?<\/a><br \/>\n" + "\s*.*?<a href=.+?>.+?<\/a>\n" | + "\s*<a href=.+?>(.+?)<\/a><br \/>\n" + "\s*<a href=.+?>.+?<\/a>\n" | def refresh_messages(lang): host = wikipedia.family.hostname(lang) # get 'all messages' special page's URL url = wikipedia.family.allmessages_address(lang) print 'Retrieving MediaWiki messages for %s' % lang allmessages, charset = wikipedia.getUrl(host,url) print 'Parsing MediaWiki messages' # First group is MediaWiki... | 03b1fc3dda8055c3b6745c0ca54e5a489474e619 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/03b1fc3dda8055c3b6745c0ca54e5a489474e619/mediawiki_messages.py |
+ "\s*.+?\n" | + "\s*(.+?)\n" | def refresh_messages(lang): host = wikipedia.family.hostname(lang) # get 'all messages' special page's URL url = wikipedia.family.allmessages_address(lang) print 'Retrieving MediaWiki messages for %s' % lang allmessages, charset = wikipedia.getUrl(host,url) print 'Parsing MediaWiki messages' # First group is MediaWiki... | 03b1fc3dda8055c3b6745c0ca54e5a489474e619 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/03b1fc3dda8055c3b6745c0ca54e5a489474e619/mediawiki_messages.py |
regex = fix['exceptions'] | exceptions = fix['exceptions'] | def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagename = None): if source == 'sqldump': for pl in read_pages_from_sql_dump(sqlfilename, replacements, exceptions, regex): yield pl elif source == 'textfile': for pl in read_pages_from_text_file(textfilename): yield pl elif... | b3ad97abb158f9418a92cd57ec8dd8ff43c7963d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b3ad97abb158f9418a92cd57ec8dd8ff43c7963d/replace.py |
title = title.split(':') | title = link2url(title, site = self._site, insite = insite) title = title.split('%3A') | def __init__(self, site, title = None, insite = None, tosite = None): """ 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 The argument insite can be specified to help decode the name; it is the wikimedia site wher... | 2c1e47de7bb4ff957d88762e0ab3c377cace86c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/2c1e47de7bb4ff957d88762e0ab3c377cace86c3/wikipedia.py |
title = ':'.join(title) self._urlname = link2url(title, site = self._site, insite = insite) | title[0] = link2url (title[0], site = self._site, insite = insite) title = '%3A'.join(title) self._urlname = title | def __init__(self, site, title = None, insite = None, tosite = None): """ 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 The argument insite can be specified to help decode the name; it is the wikimedia site wher... | 2c1e47de7bb4ff957d88762e0ab3c377cace86c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/2c1e47de7bb4ff957d88762e0ab3c377cace86c3/wikipedia.py |
self.foundin = {self.inpl:[]} | def __init__(self, pl, hints = None): """Constructor. Takes as arguments the PageLink on the home wikipedia plus optionally a list of hints for translation""" # Remember the "origin page" self.inpl = pl # Mark the origin page as todo. self.todo = {pl:pl.code()} # Nothing has been done yet self.done = {} # Add the trans... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py | |
def conditionalAdd(self, pl, counter): | def conditionalAdd(self, pl, counter, foundin): | def conditionalAdd(self, pl, counter): """Add the pagelink given to the todo list, but only if we didn't know it before. If it is added, update the counter accordingly.""" if (pl not in self.done and pl not in self.todo and pl not in self.pending): self.todo[pl] = pl.code() counter.plus(pl.code()) #print "DBG> Found ne... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
if (pl not in self.done and pl not in self.todo and pl not in self.pending): | if self.foundin.has_key(pl): self.foundin[pl].append(foundin) return False else: self.foundin[pl]=[foundin] | def conditionalAdd(self, pl, counter): """Add the pagelink given to the todo list, but only if we didn't know it before. If it is added, update the counter accordingly.""" if (pl not in self.done and pl not in self.todo and pl not in self.pending): self.todo[pl] = pl.code() counter.plus(pl.code()) #print "DBG> Found ne... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
return False | def conditionalAdd(self, pl, counter): """Add the pagelink given to the todo list, but only if we didn't know it before. If it is added, update the counter accordingly.""" if (pl not in self.done and pl not in self.todo and pl not in self.pending): self.todo[pl] = pl.code() counter.plus(pl.code()) #print "DBG> Found ne... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py | |
if self.conditionalAdd(pl3, counter): | if self.conditionalAdd(pl3, counter, pl): | 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 ... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
if self.conditionalAdd(pl2, counter): | if self.conditionalAdd(pl2, counter, pl): | 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 ... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
def assemblefirstrun(self): temp = {} | def assemble(self): | def assemblefirstrun(self): temp = {} 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.inpl: err = 'Someone refers to %s with us' % pl.asasciilink() self.problem(err) if globalvar.autonomous: return None eli... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
err = 'Someone refers to %s with us' % pl.asasciilink() self.problem(err) if globalvar.autonomous: | self.problem("Found link to %s"%pl.asasciilink()) for pl2 in self.foundin[pl]: print " ",pl2.asasciilink() nerr += 1 elif pl.exists() and not pl.isRedirectPage(): if code in new: new[code].append(pl) else: new[code] = [pl] if 'zh-cn' in new or 'zh-tw' in new: if 'zh' in new: del new[zh] print "Ignoring links to zh i... | def assemblefirstrun(self): temp = {} 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.inpl: err = 'Someone refers to %s with us' % pl.asasciilink() self.problem(err) if globalvar.autonomous: return None eli... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
elif pl.exists() and not pl.isRedirectPage(): if new.has_key(code) and new[code] is None: print "NOTE: Ignoring %s"%(pl.asasciilink()) elif temp.has_key(code) and temp[code] is None: if globalvar.autonomous: return None answer = ' ' while answer not in 'yng': answer = raw_input('%s y(es)/n(o)/g(ive up)? '%pl.asasciilin... | answer = int(answer) result[k] = v[answer-1] else: result[k] = v[0] if globalvar.autonomous and nerr>0: return None return result | def assemblefirstrun(self): temp = {} 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.inpl: err = 'Someone refers to %s with us' % pl.asasciilink() self.problem(err) if globalvar.autonomous: return None eli... | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
if globalvar.autonomous: new = self.assemblefirstrun() if new == None: return else: new = self.assemblesecondrun(new) else: new = self.assemblefirstrun() if new == None: return new = self.assemblesecondrun(new, self.problemfound) if new == None: return | new = self.assemble() if new == None: return | 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. | b5b807b46b22efa6e85db531b0ff45ffef67e5ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b5b807b46b22efa6e85db531b0ff45ffef67e5ed/interwiki.py |
choice = wikipedia.inputChoice(u'What shall be done with this selflink?', ['unlink', 'make bold', 'skip'], ['U', 'b', 's'], 'u') | choice = wikipedia.inputChoice(u'What shall be done with this selflink?', ['unlink', 'make bold', 'skip', 'context?'], ['U', 'b', 's', '?'], 'u') | def run(self): linktrail = wikipedia.getSite().linktrail() # The regular expression which finds links. Results consist of four groups: # group title is the target page title, that is, everything before | or ]. # group section is the page section. It'll include the # to make life easier for us. # group label is the alte... | 49a9bc66736bc65c5d8310233ae1819c1ebe8397 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/49a9bc66736bc65c5d8310233ae1819c1ebe8397/selflink.py |
langlist += language | langlist += [language] | def validLanguageLinks(self): langlist = [] for language in self.languages(): if not language in self.namespaces(): langlist += language return langlist | 3b791a6780bfe4e1455358b5e0028a287a67999c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/3b791a6780bfe4e1455358b5e0028a287a67999c/wikipedia.py |
raise | pass | def getToken(self, getalways = True, getagain = False, sysop = False): if getagain or (getalways and ((sysop and not self._sysoptoken) or (not sysop and not self._token))): output(u"Getting page to get a token.") try: Page(self, "%s:Sandbox" % self.family.namespace(self.lang, 4)).get(force = True, get_redirect = True, ... | 3b791a6780bfe4e1455358b5e0028a287a67999c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/3b791a6780bfe4e1455358b5e0028a287a67999c/wikipedia.py |
answer = self.ask(askit,pl) | def assemblefirstrun(self): temp = {} 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.inpl: err = 'Someone refers to %s with us' % pl.asasciilink() self.problem(err) if globalvar.autonomous: return None eli... | 39be14125a7247ee5054239cc49a023d4f37a71d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/39be14125a7247ee5054239cc49a023d4f37a71d/interwiki.py | |
x = wikipedia.getReferences(pl, follow_redirects = False) print "Found %d references" % len(x) | refs = wikipedia.getReferences(pl, follow_redirects = False) print "Found %d references" % len(refs) | def getReferences(pl): x = wikipedia.getReferences(pl, follow_redirects = False) print "Found %d references" % len(x) # Remove ignorables if ignore.has_key(pl.code()): ignore_regexes =[] for ig in ignore[pl.code()]: ignore_regexes.append(re.compile(ig)) for Rignore in ignore_regexes: for i in range(len(x)-1, -1, -1): i... | da84a129586e6c22514be3a82a93251d4457a41f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/da84a129586e6c22514be3a82a93251d4457a41f/solve_disambiguation.py |
for i in range(len(x)-1, -1, -1): if Rignore.match(x[i]): wikipedia.output('Ignoring page ' + x[i], wikipedia.myencoding()) del x[i] return x | for i in range(len(refs)-1, -1, -1): if Rignore.match(refs[i]): wikipedia.output('Ignoring page ' + refs[i], wikipedia.myencoding()) del refs[i] return refs | def getReferences(pl): x = wikipedia.getReferences(pl, follow_redirects = False) print "Found %d references" % len(x) # Remove ignorables if ignore.has_key(pl.code()): ignore_regexes =[] for ig in ignore[pl.code()]: ignore_regexes.append(re.compile(ig)) for Rignore in ignore_regexes: for i in range(len(x)-1, -1, -1): i... | da84a129586e6c22514be3a82a93251d4457a41f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/da84a129586e6c22514be3a82a93251d4457a41f/solve_disambiguation.py |
titleWithSection = titleWithSection.replace('_', ' ') | def get(self, force = False, get_redirect=False, throttle = True, sysop = False): """The wiki-text of the page. This will retrieve the page if it has not been retrieved yet. This can raise the following exceptions that should be caught by the calling code: | 5bad4ba25a594144bf359054541156ff335a499e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/5bad4ba25a594144bf359054541156ff335a499e/wikipedia.py | |
output(u'Getting %s...' % path) | output(u'Getting http://%s%s' % (self.site().hostname(), path)) | def getImagePageContents(self): if not self._imagePageContents: path = self.site().get_address(self.urlname()) output(u'Getting %s...' % path) self._imagePageContents = self.site().getUrl(path) return self._imagePageContents | 5bad4ba25a594144bf359054541156ff335a499e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/5bad4ba25a594144bf359054541156ff335a499e/wikipedia.py |
url = m.group('url1') or m.group('url2') print url | try: url = m.group('url1') or m.group('url2') except AttributeError: print self.getImagePageContents() raise NoPage(u'Image page %s not found.' % self.title()) | 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()) url = m.group('url1') or m.group('url2') print url return url #filename = self.titleWithoutNamespac... | 5bad4ba25a594144bf359054541156ff335a499e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/5bad4ba25a594144bf359054541156ff335a499e/wikipedia.py |
def isOnCommons(self): | def fileIsOnCommons(self): | def isOnCommons(self): return self.fileUrl().startswith(u'http://upload.wikimedia.org/wikipedia/commons/') | 5bad4ba25a594144bf359054541156ff335a499e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/5bad4ba25a594144bf359054541156ff335a499e/wikipedia.py |
print "Logging in to ",wikipedia.family.hostname(wikipedia.mylang) | wikipedia.output(u"Logging in to %s" % wikipedia.family.hostname(wikipedia.mylang)) | def makepath(path): """ creates missing directories for the given path and returns a normalized absolute version of the path. - if the given path already exists in the filesystem the filesystem is not modified. - otherwise makepath creates directories along the given path using the dirname() of the path. You may appe... | de7ac1fc3d130507a8966d1c128c0ffaebf52900 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/de7ac1fc3d130507a8966d1c128c0ffaebf52900/login.py |
username=raw_input('username: ') password=getpass.getpass('password: ') | username = wikipedia.input(u'username:', encode = True) password = getpass.getpass(u'password: ') password = unicode(password, config.console_encoding) password = password.encode(wikipedia.myencoding()) | def makepath(path): """ creates missing directories for the given path and returns a normalized absolute version of the path. - if the given path already exists in the filesystem the filesystem is not modified. - otherwise makepath creates directories along the given path using the dirname() of the path. You may appe... | de7ac1fc3d130507a8966d1c128c0ffaebf52900 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/de7ac1fc3d130507a8966d1c128c0ffaebf52900/login.py |
pass from_pl = '' | print "Can't work on redirect page." return from_pl = "" | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not found.') try: interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass | if from_pl == "": print "Interwiki link to " + from_lang + " not found." return | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
wikipedia.setAction(msg[msglang] + from_lang + ':' + from_pl.linkname()) | wikipedia.setAction(msg[msglang] + from_lang + ":" + from_pl.linkname()) | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
table = translate(table) | if not table: print "No table found in %s." % from_lang + ":" + from_pl.linkname() return table = translate(table, type) if not table: print "Could not translate table." return | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
to_text = table + '\n\n' + to_text | to_text = table + "\n\n" + to_text | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
print 'Changing page %s' % (to_pl) | print "Changing page %s" % (to_pl) | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
startR = re.compile(r'<table|\{\|') | startR = re.compile(r"<table|\{\|") | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
endR = re.compile(r'</table>|\|\}') | endR = re.compile(r"</table>|\|\}") | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: pass from_pl = '' for interwiki in interwikis: if interwiki.code() == from_lang: from_pl = interwiki if from_pl == '': print 'Interwiki link to ' + from_lang + ' not found.' raise NoInterwiki('Interwiki link not... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if debug: print 'No table found' pass | return | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: if debug: print 'No table found' pass else: if debug: print 'First start tag found at ' + str(first_start_tag.start()) pos = first_start_tag.end() table_level = 1 remaining_text = text while table_level... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if debug: print 'First start tag found at ' + str(first_start_tag.start()) | if debug: print "First start tag found at " + str(first_start_tag.start()) | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: if debug: print 'No table found' pass else: if debug: print 'First start tag found at ' + str(first_start_tag.start()) pos = first_start_tag.end() table_level = 1 remaining_text = text while table_level... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if debug: print 'Error: missing end tag' | if debug: print "Error: missing end tag" | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: if debug: print 'No table found' pass else: if debug: print 'First start tag found at ' + str(first_start_tag.start()) pos = first_start_tag.end() table_level = 1 remaining_text = text while table_level... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if debug: print 'Next start tag found at ' + str(pos + next_start_tag.start()) | if debug: print "Next start tag found at " + str(pos + next_start_tag.start()) | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: if debug: print 'No table found' pass else: if debug: print 'First start tag found at ' + str(first_start_tag.start()) pos = first_start_tag.end() table_level = 1 remaining_text = text while table_level... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if debug: print 'Table level is ' + str(table_level) | if debug: print "Table level is " + str(table_level) | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: if debug: print 'No table found' pass else: if debug: print 'First start tag found at ' + str(first_start_tag.start()) pos = first_start_tag.end() table_level = 1 remaining_text = text while table_level... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if debug: print 'Next end tag found at ' + str(pos + next_end_tag.start()) | if debug: print "Next end tag found at " + str(pos + next_end_tag.start()) | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: if debug: print 'No table found' pass else: if debug: print 'First start tag found at ' + str(first_start_tag.start()) pos = first_start_tag.end() table_level = 1 remaining_text = text while table_level... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if debug: print 'Table level is ' + str(table_level) if debug: print 'Table starts at ' + str(first_start_tag.start()) + ' and ends at ' + str(pos) | if debug: print "Table level is " + str(table_level) if debug: print "Table starts at " + str(first_start_tag.start()) + " and ends at " + str(pos) | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: if debug: print 'No table found' pass else: if debug: print 'First start tag found at ' + str(first_start_tag.start()) pos = first_start_tag.end() table_level = 1 remaining_text = text while table_level... | 4fdfce26072f0411d6e124ab82fef024a3154034 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/4fdfce26072f0411d6e124ab82fef024a3154034/copy_table.py |
if self.oldCat.copyTo(newCatTitle): if batchMode == False: if self.oldCat.isEmpty(): reason = wikipedia.translate(wikipedia.getSite(), deletion_reason_move) % newCatTitle self.oldCat.delete(reason) | if self.oldCat.copyAndKeep(newCatTitle, wikipedia.translate(wikipedia.getSite(), cfd_templates)): if self.oldCat.isEmpty(): reason = wikipedia.translate(wikipedia.getSite(), deletion_reason_move) % newCatTitle if batchMode == True: self.oldCat.delete(reason, False) | def run(self): newCat = catlib.Category(wikipedia.getSite(), 'Category:' + self.newCatTitle) gen = pagegenerators.CategorizedPageGenerator(self.oldCat, recurse = False) preloadingGen = pagegenerators.PreloadingGenerator(gen) for article in preloadingGen: catlib.change_category(article, self.oldCat, newCat) # TODO: cre... | af1a5b1dfeebebec2e5f8af7476b07b0423be7ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/af1a5b1dfeebebec2e5f8af7476b07b0423be7ae/category.py |
wikipedia.output('Couldn\'t copy contents of %s because %s already exists.' % (self.oldCatTitle, self.newCatTitle)) | self.oldCat.delete(reason, True) else: wikipedia.output('Couldn\'t copy contents of %s because %s already exists.' % (self.oldCatTitle, self.newCatTitle)) | def run(self): newCat = catlib.Category(wikipedia.getSite(), 'Category:' + self.newCatTitle) gen = pagegenerators.CategorizedPageGenerator(self.oldCat, recurse = False) preloadingGen = pagegenerators.PreloadingGenerator(gen) for article in preloadingGen: catlib.change_category(article, self.oldCat, newCat) # TODO: cre... | af1a5b1dfeebebec2e5f8af7476b07b0423be7ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/af1a5b1dfeebebec2e5f8af7476b07b0423be7ae/category.py |
if self.cat.exists() and self.cat.isEmpty() and batchMode == False: | if self.cat.exists() and self.cat.isEmpty(): | def run(self): articles = self.cat.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in category %s' % self.cat.title()) else: for article in articles: catlib.change_category(article, self.cat, None) # Also removes the category tag from subcategories' pages subcategories = self.cat.s... | af1a5b1dfeebebec2e5f8af7476b07b0423be7ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/af1a5b1dfeebebec2e5f8af7476b07b0423be7ae/category.py |
self.cat.delete(reason) | if batchMode == True: self.cat.delete(reason, False) else: self.cat.delete(reason, True) | def run(self): articles = self.cat.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in category %s' % self.cat.title()) else: for article in articles: catlib.change_category(article, self.cat, None) # Also removes the category tag from subcategories' pages subcategories = self.cat.s... | af1a5b1dfeebebec2e5f8af7476b07b0423be7ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/af1a5b1dfeebebec2e5f8af7476b07b0423be7ae/category.py |
+ "\s*(?:<script[^<>]+>[^<>]+<[^<>]+script>)?[^+<a href=.+?>(?P<key>.+?)<\/a><br \/>\n" | + "\s*<a href=.+?>(?P<key>.+?)<\/a><br \/>\n" | def refresh_messages(site = None): site = site or wikipedia.getSite() # get 'all messages' special page's path path = site.allmessages_address() print 'Retrieving MediaWiki messages for %s' % repr(site) wikipedia.put_throttle() # It actually is a get, but a heavy one. allmessages = site.getUrl(path) print 'Parsing Med... | 9d0634ae0fb3aab8781b3fc5b1703d25984ae333 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/9d0634ae0fb3aab8781b3fc5b1703d25984ae333/mediawiki_messages.py |
print "Search string is:\n",textsearch print "Replace string is:\n",textsubst | def parseFile(filename): | bb49f86471e0b555280b4b68ec962ef3148fcec1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/bb49f86471e0b555280b4b68ec962ef3148fcec1/replace.py | |
print newtext | def parseFile(filename): | bb49f86471e0b555280b4b68ec962ef3148fcec1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/bb49f86471e0b555280b4b68ec962ef3148fcec1/replace.py | |
return Page(self.site(), self.site().namespace(ns - 1) + ':' + self.titleWithoutNamespace()) | if self.namespace() == 1: return Page(self.site(), self.titleWithoutNamespace()) else: return Page(self.site(), self.site().namespace(ns - 1) + ':' + self.titleWithoutNamespace()) | def switchTalkPage(self): """ If self is a talk page, returns the associated content page; otherwise, returns the associated talk page. Returns None if self is a special page. """ ns = self.namespace() if ns < 0: # Special page return None if self.isTalkPage(): return Page(self.site(), self.site().namespace(ns - 1) + '... | cb6540629726415fa0c49c09abaa0d3f10792755 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/cb6540629726415fa0c49c09abaa0d3f10792755/wikipedia.py |
if self.primaryIgnoreManager.isIgnored(refpl2): | if not self.primaryIgnoreManager.isIgnored(refpl2): | 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... | c8d0e89850a0512c45c7c00743da22d7bea1cfc5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/c8d0e89850a0512c45c7c00743da22d7bea1cfc5/solve_disambiguation.py |
if not self.treat(refpl2, disambPl): | if not self.treat(refpl2, refpl): | 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... | c8d0e89850a0512c45c7c00743da22d7bea1cfc5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/c8d0e89850a0512c45c7c00743da22d7bea1cfc5/solve_disambiguation.py |
if not debug: refpl.put(reftxt) | if not debug: refpl.put(reftxt) | def treat(refpl): try: reftxt=refpl.get() except wikipedia.IsRedirectPage: pass else: n = 0 while 1: for Rthis in exps: m=Rthis.search(reftxt) if m: break else: if n == 0: print "Not found in %s"%refpl elif not debug: refpl.put(reftxt) return n += 1 context = 30 while 1: print "== %s =="%(refpl) print reftxt[max(0,m.st... | 6b9e4615d27dc20f3b3dcab8a92ca0ced1838bef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/6b9e4615d27dc20f3b3dcab8a92ca0ced1838bef/solve_disambiguation.py |
wikipedia.output(u'Skiping: %s is auto entry %s(%s)' % (page,dictName,year)) | wikipedia.output(u'Skiping: %s is auto entry %s(%s)' % (page.title(),dictName,year)) | 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... | 2ac3a893d2f09cbc61b6f4bc0c2e04cde1e739b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/2ac3a893d2f09cbc61b6f4bc0c2e04cde1e739b9/interwiki.py |
'ro': (LINKS, u"Wikipedia:Articole de calitate"), | 'ro': (LINKS, u"Wikipedia:Articole fructuoase"), | def LINKS(site,name, ignore=[]): p=wikipedia.Page(site, name) links=p.linkedPages() for n in links[:]: if n.titleWithoutNamespace() in ignore: links.remove(n) links.sort() return links | 7f473e09b13ec209337900043f5d3de6b5bfd9fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/7f473e09b13ec209337900043f5d3de6b5bfd9fc/featured.py |
'he' : [u'disambiguationafter', u'פירושונים'], | 'he' : [u'disambiguationAfter', u'פירושונים'], | def __init__(self): | b501bef1f3a329c8dc7fe6c7125088152bfe34d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/b501bef1f3a329c8dc7fe6c7125088152bfe34d1/family.py |
'sr': [u'СТРАНИЦА'] | 'sr': [u'СТРАНИЦА'], | def category_namespaces(self, code): namespaces = [] namespace_title = self.namespace(code, 14) namespaces.append(namespace_title) if namespace_title != namespace_title.lower(): namespaces.append(namespace_title.lower()) default_namespace_title = self.namespace('_default', 14) if namespace_title != default_namespace_ti... | d1d9f9293729b04481fc32a7f8524434dc147bf3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d1d9f9293729b04481fc32a7f8524434dc147bf3/family.py |
'ru': [u'НАЗВАНИЕСТРАНИЦЫ2'] | 'ru': [u'НАЗВАНИЕСТРАНИЦЫ2'], | def category_namespaces(self, code): namespaces = [] namespace_title = self.namespace(code, 14) namespaces.append(namespace_title) if namespace_title != namespace_title.lower(): namespaces.append(namespace_title.lower()) default_namespace_title = self.namespace('_default', 14) if namespace_title != default_namespace_ti... | d1d9f9293729b04481fc32a7f8524434dc147bf3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d1d9f9293729b04481fc32a7f8524434dc147bf3/family.py |
def change_category(article, old_cat, new_cat): | def change_category(article, old_cat_title, new_cat_title): | def add_category(sort_by_last_name = False): 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" p... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
cats.remove(old_cat) if new_cat != None: | sort_key = '' for cat in cats: ns = wikipedia.family.category_namespaces(wikipedia.mylang)[0].encode(wikipedia.code2encoding(wikipedia.mylang)) if cat.linkname() == ns + ':' + old_cat_title: cats.remove(cat) elif cat.linkname().startswith(ns + ':' + old_cat_title + '|'): sort_key = cat.linkname().split('|', 1)[1] ca... | def change_category(article, old_cat, new_cat): cats = article.categories() cats.remove(old_cat) if new_cat != None: cats.append(new_cat) text = article.get() text = wikipedia.replaceCategoryLinks(text, cats) article.put(text) | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
old_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_title) new_title = wikipedia.input('Please enter the new name of the category: ') new_cat = catlib.CatLink(new_title) | old_cat_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_cat_title) new_cat_title = wikipedia.input('Please enter the new name of the category: ') | def rename_category(): old_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_title) new_title = wikipedia.input('Please enter the new name of the category: ') new_cat = catlib.CatLink(new_title) # get edit summary message wikipedia.setAction(msg_change[wikipedia.choose... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
wikipedia.setAction(msg_change[wikipedia.chooselang(wikipedia.mylang,msg_change)] % old_title) | wikipedia.setAction(msg_change[wikipedia.chooselang(wikipedia.mylang,msg_change)] % old_cat_title) | def rename_category(): old_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_title) new_title = wikipedia.input('Please enter the new name of the category: ') new_cat = catlib.CatLink(new_title) # get edit summary message wikipedia.setAction(msg_change[wikipedia.choose... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
print 'There are no articles in category ' + old_title | print 'There are no articles in category ' + old_cat_title | def rename_category(): old_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_title) new_title = wikipedia.input('Please enter the new name of the category: ') new_cat = catlib.CatLink(new_title) # get edit summary message wikipedia.setAction(msg_change[wikipedia.choose... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
change_category(article, old_cat, new_cat) | change_category(article, old_cat_title, new_cat_title) | def rename_category(): old_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_title) new_title = wikipedia.input('Please enter the new name of the category: ') new_cat = catlib.CatLink(new_title) # get edit summary message wikipedia.setAction(msg_change[wikipedia.choose... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
print 'There are no subcategories in category ' + old_title | print 'There are no subcategories in category ' + old_cat_title | def rename_category(): old_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_title) new_title = wikipedia.input('Please enter the new name of the category: ') new_cat = catlib.CatLink(new_title) # get edit summary message wikipedia.setAction(msg_change[wikipedia.choose... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
change_category(subcategory, old_cat, new_cat) | change_category(subcategory, old_cat_title, new_cat_title) | def rename_category(): old_title = wikipedia.input('Please enter the old name of the category: ') old_cat = catlib.CatLink(old_title) new_title = wikipedia.input('Please enter the new name of the category: ') new_cat = catlib.CatLink(new_title) # get edit summary message wikipedia.setAction(msg_change[wikipedia.choose... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) | old_cat_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_cat_title) | def remove_category(): old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse = 0) if ... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) | wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_cat_title) | def remove_category(): old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse = 0) if ... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
print 'There are no articles in category ' + old_title | print 'There are no articles in category ' + old_cat_title | def remove_category(): old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse = 0) if ... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
change_category(article, old_cat, None) | change_category(article, old_cat_title, None) | def remove_category(): old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse = 0) if ... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
print 'There are no subcategories in category ' + old_title | print 'There are no subcategories in category ' + old_cat_title | def remove_category(): old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse = 0) if ... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
change_category(subcategory, old_cat, None) | change_category(subcategory, old_cat_title, None) | def remove_category(): old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse = 0) if ... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py |
* every category page must contain some text; otherwise an edit box will be displayed instead of an article list, and the bot won't work | def remove_category(): old_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse = 0) if ... | 8fe4e1817561eb473c4b424b96ecd3c166227672 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/8fe4e1817561eb473c4b424b96ecd3c166227672/category.py | |
x,l=decode_func(x) | try: x,l=decode_func(x) except UnicodeError: print code,name print repr(x) raise | 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('... | 23883301cafa4cf49f9c4cf5bac74fc791399cdb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/23883301cafa4cf49f9c4cf5bac74fc791399cdb/wikipedia.py |
if code in ['meta','eo','ja','zh','hi']: | if code in ['meta','eo','ja','zh','hi','he','hu']: | def code2encoding(code): if code=='ru': return 'iso-8859-5' if code=='pl': return 'iso-8859-2' if code in ['meta','eo','ja','zh','hi']: return 'utf-8' return 'iso-8859-1' | 23883301cafa4cf49f9c4cf5bac74fc791399cdb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/23883301cafa4cf49f9c4cf5bac74fc791399cdb/wikipedia.py |
result=str(name.encode('latin1')) | result=str(name.encode(code2encoding(code))) | def link2url(name,code='nl',incode='nl'): """Convert a interwiki link name of a page to the proper name to be used in a URL for that page. code should specify the language for the link, incode the language of the page the link is in.""" import urllib name=name[0].upper()+name[1:] name=name.strip() if '%' in name: name=... | 23883301cafa4cf49f9c4cf5bac74fc791399cdb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/23883301cafa4cf49f9c4cf5bac74fc791399cdb/wikipedia.py |
result=str(name.encode('utf-8')) | try: result=str(name.encode('latin1')) except UnicodeError: result=str(name.encode('utf-8')) | def link2url(name,code='nl',incode='nl'): """Convert a interwiki link name of a page to the proper name to be used in a URL for that page. code should specify the language for the link, incode the language of the page the link is in.""" import urllib name=name[0].upper()+name[1:] name=name.strip() if '%' in name: name=... | 23883301cafa4cf49f9c4cf5bac74fc791399cdb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/23883301cafa4cf49f9c4cf5bac74fc791399cdb/wikipedia.py |
def newpages(number=10, onlyonce=False site=None, throttle=True): | def newpages(number=10, onlyonce=False, site=None, throttle=True): | def newpages(number=10, onlyonce=False site=None, throttle=True): """Generator which yields new articles subsequently. It starts with the article created 'number' articles ago (first argument). When these are all yielded (as PageLinks) it fetches NewPages again. If there is no new page, it blocks until there is one, sl... | 96bfdb2c027a2e0a1da4c4dad2ef8a5ae1f2b950 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/96bfdb2c027a2e0a1da4c4dad2ef8a5ae1f2b950/wikipedia.py |
if wikipedia.getSite('nn') in new or self.inpl.language() == 'nn': | if wikipedia.getSite('nn') in new or self.inpl.site().lang == 'nn': | 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. | 3174feebc2a11ce33ba0a2680d2545f2d88b15f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/3174feebc2a11ce33ba0a2680d2545f2d88b15f9/interwiki.py |
insite.getSite() | insite = getSite() | def categoryFormat(links, insite = None): """Create a suitable string encoding all category links for a wikipedia page. 'links' should be a list of category pagelink objects. The string is formatted for inclusion in insite. """ if not links: return '' if insite is None: insite.getSite() s = [] for pl in links: s.appe... | a9af4a1d0963947cdca2cd4339618934a0771fcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/a9af4a1d0963947cdca2cd4339618934a0771fcc/wikipedia.py |
if Site(default_code).category_on_one_line(): | if insite.category_on_one_line(): | def categoryFormat(links, insite = None): """Create a suitable string encoding all category links for a wikipedia page. 'links' should be a list of category pagelink objects. The string is formatted for inclusion in insite. """ if not links: return '' if insite is None: insite.getSite() s = [] for pl in links: s.appe... | a9af4a1d0963947cdca2cd4339618934a0771fcc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/a9af4a1d0963947cdca2cd4339618934a0771fcc/wikipedia.py |
wikipedia.output(u'TitleTranslate: %s was recognized as %s with value %d' % (pl.linkname(),dictName,year)) | wikipedia.output(u'TitleTranslate: %s was recognized as %s with value %d' % (pl.title(),dictName,year)) | def translate(pl, arr, same = False, hints = None, auto = True): site = pl.site() if same: return sametranslate(pl, arr, same) 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, newname = h.split(':', 1) if newname == '': # if giv... | 15778bb05b65d91b7bb5cc6bd81452959ce89802 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/15778bb05b65d91b7bb5cc6bd81452959ce89802/titletranslate.py |
'exceptions': [u'Zемфира', u'KoЯn', u'Deadушки', u'ENTERМУЗЫКА', u'Юz', u'Lюк', u'Яndex'], | def SetColor(color): try: import win32console stdout=win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) stdout.SetConsoleTextAttribute(color) except: if color == FOREGROUND_BLUE: print '(b:' if color == FOREGROUND_GREEN: print '(g:' if color == FOREGROUND_RED: print '(r:' | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py | |
'localsuspects': u'АаВЕеКкМНОоРрСсТуХх', 'latinsuspects': u'AaBEeKkMHOoPpCcTyXx', | 'localsuspects': u'АаВЕеКкМНОопРрСсТуХх', 'latinsuspects': u'AaBEeKkMHOonPpCcTyXx', | def SetColor(color): try: import win32console stdout=win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) stdout.SetConsoleTextAttribute(color) except: if color == FOREGROUND_BLUE: print '(b:' if color == FOREGROUND_GREEN: print '(g:' if color == FOREGROUND_RED: print '(r:' | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
'exceptions': [], | def SetColor(color): try: import win32console stdout=win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) stdout.SetConsoleTextAttribute(color) except: if color == FOREGROUND_BLUE: print '(b:' if color == FOREGROUND_GREEN: print '(g:' if color == FOREGROUND_RED: print '(r:' | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py | |
'localsuspects': u'АаВЕеІіКкМНОоРрСсТУуХх', 'latinsuspects': u'AaBEeIiKkMHOoPpCcTYyXx', | 'localsuspects': u'АаВЕеІіКкМНОопРрСсТУуХх', 'latinsuspects': u'AaBEeIiKkMHOonPpCcTYyXx', | def SetColor(color): try: import win32console stdout=win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) stdout.SetConsoleTextAttribute(color) except: if color == FOREGROUND_BLUE: print '(b:' if color == FOREGROUND_GREEN: print '(g:' if color == FOREGROUND_RED: print '(r:' | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
'exceptions': [], | def SetColor(color): try: import win32console stdout=win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) stdout.SetConsoleTextAttribute(color) except: if color == FOREGROUND_BLUE: print '(b:' if color == FOREGROUND_GREEN: print '(g:' if color == FOREGROUND_RED: print '(r:' | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py | |
'localsuspects': u'АаВЕеКкМНОоРрСсТуХх', 'latinsuspects': u'AaBEeKkMHOoPpCcTyXx', | 'localsuspects': u'АаВЕеКкМНОопРрСсТуХх', 'latinsuspects': u'AaBEeKkMHOonPpCcTyXx', }, 'be': { 'alphabet' : u'АаБбВвГ㥴ДдЖжЗзЕеЁёЖжЗзІіЙйКкЛлМмНнОоПпРрСсТтУуЎўФфХхЦцЧчШшЫыЬьЭэЮюЯя', 'localsuspects': u'АаВЕеІіКкМНОопРрСсТуХх', 'latinsuspects': u'AaBEeIiKkMHOonPpCcTyXx', | def SetColor(color): try: import win32console stdout=win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) stdout.SetConsoleTextAttribute(color) except: if color == FOREGROUND_BLUE: print '(b:' if color == FOREGROUND_GREEN: print '(g:' if color == FOREGROUND_RED: print '(r:' | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
namespaces = [0, 10, 12, 14] | namespaces = [] | def SetColor(color): try: import win32console stdout=win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) stdout.SetConsoleTextAttribute(color) except: if color == FOREGROUND_BLUE: print '(b:' if color == FOREGROUND_GREEN: print '(g:' if color == FOREGROUND_RED: print '(r:' | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
if arg.startswith('-from:'): self.apfrom = arg[6:] elif arg.startswith('-from'): self.apfrom = wikipedia.input(u'Which page to start from: ') | if arg.startswith('-from'): if arg.startswith('-from:'): self.apfrom = arg[6:] else: self.apfrom = wikipedia.input(u'Which page to start from: ') | def __init__(self, args): for arg in args: arg = wikipedia.argHandler(arg, 'casechecker') if arg: if arg.startswith('-from:'): self.apfrom = arg[6:] elif arg.startswith('-from'): self.apfrom = wikipedia.input(u'Which page to start from: ') elif arg.startswith('-reqsize:'): self.aplimit = int(arg[9:]) elif arg == '-lin... | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
elif arg.startswith('-namespace:'): self.namespaces = [int(arg[11:])] | elif arg.startswith('-ns:'): self.namespaces.append( int(arg[4:]) ) | def __init__(self, args): for arg in args: arg = wikipedia.argHandler(arg, 'casechecker') if arg: if arg.startswith('-from:'): self.apfrom = arg[6:] elif arg.startswith('-from'): self.apfrom = wikipedia.input(u'Which page to start from: ') elif arg.startswith('-reqsize:'): self.aplimit = int(arg[9:]) elif arg == '-lin... | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
self.params['what'] += '|links'; | self.params['what'] += '|links|categories'; | def __init__(self, args): for arg in args: arg = wikipedia.argHandler(arg, 'casechecker') if arg: if arg.startswith('-from:'): self.apfrom = arg[6:] elif arg.startswith('-from'): self.apfrom = wikipedia.input(u'Which page to start from: ') elif arg.startswith('-reqsize:'): self.aplimit = int(arg[9:]) elif arg == '-lin... | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
self.knownWords = set(l['exceptions']) | def __init__(self, args): for arg in args: arg = wikipedia.argHandler(arg, 'casechecker') if arg: if arg.startswith('-from:'): self.apfrom = arg[6:] elif arg.startswith('-from'): self.apfrom = wikipedia.input(u'Which page to start from: ') elif arg.startswith('-reqsize:'): self.aplimit = int(arg[9:]) elif arg == '-lin... | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py | |
self.apfrom = self.apfrom | def Run(self): try: count = 0 for namespace in self.namespaces: self.params['apnamespace'] = namespace self.apfrom = self.apfrom title = None while True: # Get data self.params['apfrom'] = self.apfrom data = query.GetData(self.site.lang, self.params, self.verbose) try: self.apfrom = data['query']['allpages']['next'] e... | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py | |
changed = False if self.replace and namespace != 14: newTitle = self.PickTarget(False, title, err[1]) if newTitle: src = wikipedia.Page(self.site, title) src.move( newTitle, u'mixed case rename') changed = True if not changed: self.WikiLog(u"* " + err[0]) printed = True | if page['ns'] == 14: self.WikiLog(u"* Move category content: " + err[0]) else: changed = False if self.replace: newTitle = self.PickTarget(False, title, err[1]) if newTitle: src = wikipedia.Page(self.site, title) src.move( newTitle, u'mixed case rename') changed = True if not changed: self.WikiLog(u"* " + err[0]) prin... | def Run(self): try: count = 0 for namespace in self.namespaces: self.params['apnamespace'] = namespace self.apfrom = self.apfrom title = None while True: # Get data self.params['apfrom'] = self.apfrom data = query.GetData(self.site.lang, self.params, self.verbose) try: self.apfrom = data['query']['allpages']['next'] e... | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
for l in page['links']: | for l in allLinks: | def Run(self): try: count = 0 for namespace in self.namespaces: self.params['apnamespace'] = namespace self.apfrom = self.apfrom title = None while True: # Get data self.params['apfrom'] = self.apfrom data = query.GetData(self.site.lang, self.params, self.verbose) try: self.apfrom = data['query']['allpages']['next'] e... | d7ae8d783a650481e56e5f8027b09cf5b7a199dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4404/d7ae8d783a650481e56e5f8027b09cf5b7a199dc/casechecker.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.