bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
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... | 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: wikipedia.output(u"ERROR: couldn't find %s" % ... | 35,500 |
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... | 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... | 35,501 |
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... | 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... | 35,502 |
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 | 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 | 35,503 |
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... | 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... | 35,504 |
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... | 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... | 35,505 |
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... | 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... | 35,506 |
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... | 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... | 35,507 |
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... | 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... | 35,508 |
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... | defself.foundin = {self.inpl:[]} __init__(self,self.foundin = {self.inpl:[]} pl,self.foundin = {self.inpl:[]} hintsself.foundin = {self.inpl:[]} =self.foundin = {self.inpl:[]} None):self.foundin = {self.inpl:[]} """Constructor.self.foundin = {self.inpl:[]} Takesself.foundin = {self.inpl:[]} asself.foundin = {se... | 35,509 |
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... | def conditionalAdd(self, pl, counter, foundin): """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>... | 35,510 |
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... | 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 self.foundin.has_key(pl): self.foundin[pl].append(foundin) return False else: self.foundin[pl]=[foundin] self.todo[pl] = pl.code() counter.plus(... | 35,511 |
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... | 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... | 35,512 |
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,513 |
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,514 |
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... | def assemble(self): 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 elif pl.exists() and ... | 35,515 |
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... | 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: self.problem("Found link to %s"%pl.asasciilink()) for pl2 in self.foundin[pl]: print " ",pl2.asasciilink() nerr... | 35,516 |
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... | 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... | 35,517 |
def finish(self, sa = None): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty. | def finish(self, sa = None): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty. | 35,518 |
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... | 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... | 35,519 |
def validLanguageLinks(self): langlist = [] for language in self.languages(): if not language in self.namespaces(): langlist += language return langlist | def validLanguageLinks(self): langlist = [] for language in self.languages(): if not language in self.namespaces(): langlist += [language] return langlist | 35,520 |
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, ... | 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, ... | 35,521 |
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... | 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... | 35,522 |
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... | def getReferences(pl): refs = wikipedia.getReferences(pl, follow_redirects = False) print "Found %d references" % len(refs) # 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, ... | 35,523 |
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... | 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(refs)-1, -1, -1)... | 35,524 |
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: | 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: | 35,525 |
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 | def getImagePageContents(self): if not self._imagePageContents: path = self.site().get_address(self.urlname()) output(u'Getting http://%s%s' % (self.site().hostname(), path)) self._imagePageContents = self.site().getUrl(path) return self._imagePageContents | 35,526 |
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... | 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: print self.getImagePageContent... | 35,527 |
def isOnCommons(self): return self.fileUrl().startswith(u'http://upload.wikimedia.org/wikipedia/commons/') | def fileIsOnCommons(self): return self.fileUrl().startswith(u'http://upload.wikimedia.org/wikipedia/commons/') | 35,528 |
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... | 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... | 35,529 |
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... | 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... | 35,530 |
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... | def treat(to_pl): try: to_text = to_pl.get() interwikis = to_pl.interwiki() except wikipedia.IsRedirectPage: print "Can't work on redirect page." return 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.... | 35,531 |
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... | 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." return from_text = from_pl.get() wiki... | 35,532 |
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... | 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... | 35,533 |
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... | 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... | 35,534 |
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... | 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... | 35,535 |
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... | 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... | 35,536 |
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... | 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... | 35,537 |
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... | 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... | 35,538 |
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... | def get_table(text): pos = 0 # find first start tag first_start_tag = re.search(startR, text) if not first_start_tag: return 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 != 0: remaining_text = text[po... | 35,539 |
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... | 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... | 35,540 |
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... | 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... | 35,541 |
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... | 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... | 35,542 |
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... | 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... | 35,543 |
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... | 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... | 35,544 |
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... | 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... | 35,545 |
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... | 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... | 35,546 |
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... | 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... | 35,547 |
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... | 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... | 35,548 |
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... | 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... | 35,549 |
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... | 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... | 35,550 |
def parseFile(filename): | def parseFile(filename): | 35,551 |
def parseFile(filename): | def parseFile(filename): | 35,552 |
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) + '... | 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(): if self.namespace() == 1: return Page(self.site(), self.ti... | 35,553 |
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,554 |
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,555 |
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... | 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... | 35,556 |
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,557 |
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 | 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 | 35,558 |
def __init__(self): | def __init__(self): | 35,559 |
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... | 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... | 35,560 |
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... | 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... | 35,561 |
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... | 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... | 35,562 |
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) | def change_category(article, old_cat, new_cat): cats = article.categories() 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... | 35,563 |
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... | def rename_category(): 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: ') # get edit summary message wikipedia.setAction(msg_change[wikipedia.chooselang(wikipedia.mylang,ms... | 35,564 |
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... | 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... | 35,565 |
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... | 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... | 35,566 |
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... | 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... | 35,567 |
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... | 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... | 35,568 |
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... | 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... | 35,569 |
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 ... | def remove_category(): old_cat_title = wikipedia.input('Please enter the name of the category that should be removed: ') old_cat = catlib.CatLink(old_cat_title) # get edit summary message wikipedia.setAction(msg_remove[wikipedia.chooselang(wikipedia.mylang,msg_remove)] % old_title) articles = old_cat.articles(recurse ... | 35,570 |
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 ... | 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_cat_title) articles = old_cat.articles(recurse = 0)... | 35,571 |
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 ... | 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 ... | 35,572 |
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 ... | 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 ... | 35,573 |
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 ... | 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 ... | 35,574 |
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 ... | 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 ... | 35,575 |
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 ... | 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 ... | 35,576 |
def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | def getPage(code, name, do_edit=1, do_quote=1): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] if host[-4:]=='.com': # Old algorithm name = re.sub('_', ' ', name) n=[] for x in name.split(): n.append(x[0].capitalize()+x[1:]) name='_'.join(n) #print name else: name = re.sub('... | 35,577 |
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' | 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','he','hu']: return 'utf-8' return 'iso-8859-1' | 35,578 |
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=... | 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=... | 35,579 |
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=... | 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=... | 35,580 |
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... | 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, s... | 35,581 |
def finish(self, sa = None): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty. | def finish(self, sa = None): """Round up the subject, making any necessary changes. This method should be called exactly once after the todo list has gone empty. | 35,582 |
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... | 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.ap... | 35,583 |
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... | 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... | 35,584 |
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... | 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... | 35,585 |
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:' | 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:' | 35,586 |
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:' | 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:' | 35,587 |
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:' | 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:' | 35,588 |
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:' | 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:' | 35,589 |
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:' | 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:' | 35,590 |
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:' | 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:' | 35,591 |
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:' | 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:' | 35,592 |
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... | def __init__(self, args): for arg in args: arg = wikipedia.argHandler(arg, 'casechecker') if arg: if arg.startswith('-from'): if arg.startswith('-from:'): self.apfrom = arg[6:] else: self.apfrom = wikipedia.input(u'Which page to start from: ') elif arg.startswith('-reqsize:'): self.aplimit = int(arg[9:]) elif arg == '... | 35,593 |
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... | 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... | 35,594 |
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... | 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... | 35,595 |
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... | 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... | 35,596 |
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... | def Run(self): try: count = 0 for namespace in self.namespaces: self.params['apnamespace'] = namespace 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'] except: self.apfrom = None ... | 35,597 |
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... | 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... | 35,598 |
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... | 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... | 35,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.