bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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,600
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,601
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,602
def treat(refpl, thispl): try: reftxt=refpl.get() except wikipedia.IsRedirectPage: pass else: n = 0 curpos = 0 while 1: m=linkR.search(reftxt, pos = curpos) if not m: if n == 0: print "Not found in %s"%refpl elif not debug: refpl.put(reftxt) return True # Make sure that next time around we will not find this same hit. ...
def treat(refpl, thispl): try: reftxt=refpl.get() except wikipedia.IsRedirectPage: pass else: n = 0 curpos = 0 while 1: m=linkR.search(reftxt, pos = curpos) if not m: if n == 0: print "Not found in %s"%refpl elif not debug: refpl.put(reftxt) return True # Make sure that next time around we will not find this same hit. ...
35,603
def checkExceptions(self, original_text): """ If one of the exceptions applies for the given text, returns the substring. which matches the exception. Otherwise it returns None. """ for exception in self.exceptions: if self.regex: exception = re.compile(exception, re.UNICODE) hit = exception.search(original_text) if hi...
def checkExceptions(self, original_text): """ If one of the exceptions applies for the given text, returns the substring which matches the exception. Otherwise it returns None. """ for exception in self.exceptions: if self.regex: exception = re.compile(exception, re.UNICODE) hit = exception.search(original_text) if hit...
35,604
def allowedbot(site): """Checks whether the bot is listed on Wikipedia:bots""" pl = wikipedia.PageLink(site, "Wikipedia:Bots") text = pl.get() return "[[User:%s" % username in text
def allowedbot(username, site): """Checks whether the bot is listed on Wikipedia:bots""" pl = wikipedia.PageLink(site, "Wikipedia:Bots") text = pl.get() return "[[User:%s" % username in text
35,605
def allowedbot(site): """Checks whether the bot is listed on Wikipedia:bots""" pl = wikipedia.PageLink(site, "Wikipedia:Bots") text = pl.get() return "[[User:%s" % username in text
def allowedbot(site): """Checks whether the bot is listed on Wikipedia:bots""" pl = wikipedia.PageLink(site, "Wikipedia:Bots") text = pl.get() return "[[user:%s" % username in text.lower()
35,606
def main(args): username = password = None for arg in args:#sys.argv[1:]: arg = wikipedia.argHandler(arg) if arg is None: continue if arg.startswith("-user:"): username = arg[6:] elif arg.startswith("-pass:"): # not recommended password = arg[6:] else: sys.exit("Unknown argument: %s" % arg) mysite = wikipedia.getSite...
def main(args): username = password = None for arg in args:#sys.argv[1:]: arg = wikipedia.argHandler(arg) if arg is None: continue if arg.startswith("-user:"): username = arg[6:] elif arg.startswith("-pass:"): # not recommended password = arg[6:] else: sys.exit("Unknown argument: %s" % arg) mysite = wikipedia.getSite...
35,607
def read_pages_from_sql_dump(sqlfilename, replacements, exceptions, regex, namespace): ''' Generator which will yield PageLinks to pages that might contain text to replace. These pages will be retrieved from a local sql dump file (cur table). Arguments: * sqlfilename - the dump's path, either absolute or relative * r...
def read_pages_from_sql_dump(sqlfilename, replacements, exceptions, regex, namespace): ''' Generator which will yield PageLinks to pages that might contain text to replace. These pages will be retrieved from a local sql dump file (cur table). Arguments: * sqlfilename - the dump's path, either absolute or relative * r...
35,608
def getFileVersionHistory(self): result = [] history = re.search('(?s)<ul class="special">.+?</ul>', self.getImagePageContents()).group() lineR = re.compile('<li> \(.+?\) \(.+?\) <a href=".+?" title=".+?">(?P<datetime>.+?)</a> . . <a href=".+?" title=".+?">(?P<username>.+?)</a> \(<a href=".+?" title=".+?">.+?</a>\) . ....
def getFileVersionHistory(self): result = [] history = re.search('(?s)<ul class="special">.+?</ul>', self.getImagePageContents()).group() lineR = re.compile('<li> \(.+?\) \(.+?\) <a href=".+?" title=".+?">(?P<datetime>.+?)</a> . . <a href=".+?" title=".+?">(?P<username>.+?)</a> \(<a href=".+?" title=".+?">.+?</a>\) . ....
35,609
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,610
def isInterwikiLink(self, s): """ Try to check whether s is in the form "foo:bar" or ":foo:bar" where foo is a known language code or family. In such a case we are dealing with an interwiki link. """ s = s.lstrip(":") if not ':' in s: return False first, rest = s.split(':',1) # interwiki codes are case-insensitive firs...
def isInterwikiLink(self, s): """ Try to check whether s is in the form "foo:bar" or ":foo:bar" where foo is a known language code or family. In such a case we are dealing with an interwiki link. """ s = s.lstrip(":") if not ':' in s: return False first, rest = s.split(':',1) # interwiki codes are case-insensitive firs...
35,611
def isInterwikiLink(self, s): """ Try to check whether s is in the form "foo:bar" or ":foo:bar" where foo is a known language code or family. In such a case we are dealing with an interwiki link. """ s = s.lstrip(":") if not ':' in s: return False first, rest = s.split(':',1) # interwiki codes are case-insensitive firs...
def isInterwikiLink(self, s): """ Try to check whether s is in the form "foo:bar" or ":foo:bar" where foo is a known language code or family. In such a case we are dealing with an interwiki link. """ s = s.lstrip(":") if not ':' in s: return self.isInterwikiLink(rest) first, rest = s.split(':',1) # interwiki codes are ...
35,612
def getCookie(self, remember=True): """Login to wikipedia. remember Remember login (default: True) Returns cookie data if succesful, None otherwise.""" data = {"wpName": self.username, "wpPassword": self.password, "wpLoginattempt": "Aanmelden & Inschrijven", # dutch button label seems to work for all wikis "wpRem...
def getCookie(self, remember=True): """Login to wikipedia. remember Remember login (default: True) Returns cookie data if succesful, None otherwise.""" data = {"wpName": self.username.encode(self.site.encoding()), "wpPassword": self.password, "wpLoginattempt": "Aanmelden & Inschrijven", # dutch button label seems...
35,613
def __init__(self, code, fam=None, user=None): """Constructor takes three arguments:
def __init__(self, code, fam=None, user=None): """Constructor takes three arguments:
35,614
def getSite(code = None, fam = None, user=None): if code == None: code = default_code if fam == None: fam = default_family # if we got an outdated code, use the new one instead. family = Family(fam) if code in family.obsolete and family.obsolete[code]: code = family.obsolete[code] key = '%s:%s'%(fam,code) if not _sites...
def getSite(code = None, fam = None, user=None): if code == None: code = default_code if fam == None: fam = default_family # if we got an outdated code, use the new one instead.key = '%s:%s'%(fam,code) if not _sites.has_key(key): _sites[key] = Site(code=code, fam=fam, user=user) return _sites[key]
35,615
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 o...
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 o...
35,616
def run(self): if self.main_only: if ignore_title.has_key(self.mylang): ignore_title[self.mylang] += self.mysite.namespaces() else: ignore_title[self.mylang] = self.mysite.namespaces() for disambTitle in self.page_list: # when run with -redir argument, there's another summary message if self.solve_redirect: wikipedia....
def run(self): if self.main_only: if ignore_title.has_key(self.mylang): ignore_title[self.mylang] += self.mysite.namespaces() else: ignore_title[self.mylang] = self.mysite.namespaces() for disambTitle in self.page_list: # when run with -redir argument, there's another summary message if self.solve_redirect: wikipedia....
35,617
def run(self): # regular expression to find the original template. # {{msg:vfd}} does the same thing as {{msg:Vfd}}, so both will be found. # The new syntax, {{vfd}}, will also be found. # The group 'parameters' will either match the parameters, or an # empty string if there are none. if not wikipedia.getSite().nocapit...
def run(self): # regular expression to find the original template. # {{msg:vfd}} does the same thing as {{msg:Vfd}}, so both will be found. # The new syntax, {{vfd}}, will also be found. # The group 'parameters' will either match the parameters, or an # empty string if there are none. if not wikipedia.getSite().nocapit...
35,618
def __init__(self, oldCatTitle, newCatTitle): self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(),msg_change) % oldCatTitle)
def __init__(self, oldCatTitle, newCatTitle): self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(),msg_change) % oldCatTitle)
35,619
def read_pages_from_sql_dump(sqlfilename, replacements, exceptions, regex): ''' Generator which will yield PageLinks to pages that might contain text to replace. These pages will be retrieved from a local sql dump file (cur table). Arguments: * sqlfilename - the dump's path, either absolute or relative * replacements...
def read_pages_from_sql_dump(sqlfilename, replacements, exceptions, regex, namespace): ''' Generator which will yield PageLinks to pages that might contain text to replace. These pages will be retrieved from a local sql dump file (cur table). Arguments: * sqlfilename - the dump's path, either absolute or relative * r...
35,620
def read_pages_from_sql_dump(sqlfilename, replacements, exceptions, regex): ''' Generator which will yield PageLinks to pages that might contain text to replace. These pages will be retrieved from a local sql dump file (cur table). Arguments: * sqlfilename - the dump's path, either absolute or relative * replacements...
def read_pages_from_sql_dump(sqlfilename, replacements, exceptions, regex): ''' Generator which will yield PageLinks to pages that might contain text to replace. These pages will be retrieved from a local sql dump file (cur table). Arguments: * sqlfilename - the dump's path, either absolute or relative * replacements...
35,621
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
def generator(source, replacements, exceptions, regex, namespace, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by ...
35,622
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
35,623
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
def namespace = -1 generator(source, namespace = -1 replacements, namespace = -1 exceptions, namespace = -1 regex, namespace = -1 textfilename namespace = -1 = namespace = -1 None, namespace = -1 sqlfilename namespace = -1 = namespace = -1 None, namespace = -1 pagenames namespace = -1 = namespace = -1 None...
35,624
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
defwikipedia.setAction(wikipedia.translate(wikipedia.mylang, msg)+change) generator(source,wikipedia.setAction(wikipedia.translate(wikipedia.mylang, msg)+change) replacements,wikipedia.setAction(wikipedia.translate(wikipedia.mylang, msg)+change) exceptions,wikipedia.setAction(wikipedia.translate(wikipedia.mylang, msg)+...
35,625
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
35,626
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
def generator(source, replacements, exceptions, regex, textfilename = None, sqlfilename = None, pagenames = None): ''' Generator which will yield PageLinks for pages that might contain text to replace. These pages might be retrieved from a local SQL dump file or a text file, or as a list of pages entered by the user. ...
35,627
def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' if self.scheme == 'http': conn = httplib.HTTPConnection(self.host) elif self.scheme == 'https': conn = httplib.HTTPSConnection(self.host) conn.req...
def resolveRedirect(self, useHEAD = True): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' if self.scheme == 'http': conn = httplib.HTTPConnection(self.host) elif self.scheme == 'https': conn = httplib.HTTPSConnection(sel...
35,628
def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' if self.scheme == 'http': conn = httplib.HTTPConnection(self.host) elif self.scheme == 'https': conn = httplib.HTTPSConnection(self.host) conn.req...
def resolveRedirect(self): ''' Requests the header from the server. If the page is an HTTP redirect, returns the redirect target URL as a string. Otherwise returns None. ''' if self.scheme == 'http': conn = httplib.HTTPConnection(self.host) elif self.scheme == 'https': conn = httplib.HTTPSConnection(self.host) try: if ...
35,629
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the code as key. # Each value will be a list. new = {} for pl in self.done.keys(): code = pl.code() if code == wikipedia.mylang and pl.exists() and not pl.isRedirectPage() and not pl.isEmpty(): if pl != self....
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the code as key. # Each value will be a list. new = {} for pl in self.done.keys(): code = pl.code() if code == wikipedia.mylang and pl.exists() and not pl.isRedirectPage() and not pl.isEmpty(): if pl != self....
35,630
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,631
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,632
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,633
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i...
def assemble(self): # No errors have been seen so far nerr = 0 # Build up a dictionary of all links found, with the site as key. # Each value will be a list. mysite = wikipedia.getSite() new = {} for pl in self.done.keys(): site = pl.site() if site == mysite and pl.exists() and not pl.isRedirectPage(): if pl != self.i...
35,634
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,635
def readWarnfile(filename, sa): import warnfile reader = warnfile.WarnfileReader(filename) # we won't use removeHints (hints, removeHints) = reader.getHints() for pagename in hints.iterkeys(): pl = wikipedia.Page(wikipedia.getSite(), pagename) # The WarnfileReader gives us a list of pagelinks, but titletranslate.py exp...
def readWarnfile(filename, sa): import warnfile reader = warnfile.WarnfileReader(filename) # we won't use removeHints (hints, removeHints) = reader.getHints() for pagename in hints.iterkeys(): pl = wikipedia.Page(wikipedia.getSite(), pagename) # The WarnfileReader gives us a list of pagelinks, but titletranslate.py exp...
35,636
def readWarnfile(filename, sa): import warnfile reader = warnfile.WarnfileReader(filename) # we won't use removeHints (hints, removeHints) = reader.getHints() for pagename in hints.iterkeys(): pl = wikipedia.Page(wikipedia.getSite(), pagename) # The WarnfileReader gives us a list of pagelinks, but titletranslate.py exp...
def readWarnfile(filename, sa): import warnfile reader = warnfile.WarnfileReader(filename) # we won't use removeHints (hints, removeHints) = reader.getHints() for pagename in hints.iterkeys(): pl = wikipedia.Page(wikipedia.getSite(), pagename) # The WarnfileReader gives us a list of pagelinks, but titletranslate.py exp...
35,637
def treesearch(pl): arr = {pl:None} # First make one step based on the language itself try: n = treestep(arr, pl, abort_on_redirect = 1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n == 0 and not arr[pl]: print "Mother doesn't exist" return if untranslated: if len(arr) > 1: print "Already has tr...
def treesearch(pl): arr = {pl:None} # First make one step based on the language itself try: n = treestep(arr, pl, abort_on_redirect = 1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n == 0 and not arr[pl]: print "Mother doesn't exist" return if untranslated: if len(arr) > 1: print "Already has tr...
35,638
def __init__(self):
def __init__(self):
35,639
def category_namespaces(self, code): namespaces = [] namespace_title = self.namespace(code, 14) namespaces.append(namespace_title) namespaces.append(namespace_title.lower()) default_namespace_title = self.namespace('_default', 14) if namespace_title != default_namespace_title: namespaces.append(default_namespace_title)...
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,640
def category_namespaces(self, code): namespaces = [] namespace_title = self.namespace(code, 14) namespaces.append(namespace_title) namespaces.append(namespace_title.lower()) default_namespace_title = self.namespace('_default', 14) if namespace_title != default_namespace_title: namespaces.append(default_namespace_title)...
def category_namespaces(self, code): namespaces = [] namespace_title = self.namespace(code, 14) namespaces.append(namespace_title) namespaces.append(namespace_title.lower()) default_namespace_title = self.namespace('_default', 14) if namespace_title != default_namespace_title: namespaces.append(default_namespace_title)...
35,641
def move_to_category(article, original_cat, current_cat): print wikipedia.output(u'Treating page %s, currently in category %s' % (article.linkname(), current_cat.linkname())) subcatlist = get_subcats(current_cat) supercatlist = get_supercats(current_cat) print if len(subcatlist) == 0: print 'This category has no subcat...
def move_to_category(article, original_cat, current_cat): print wikipedia.output(u'Treating page %s, currently in category %s' % (article.linkname(), current_cat.linkname())) subcatlist = get_subcats(current_cat) supercatlist = get_supercats(current_cat) print if len(subcatlist) == 0: print 'This category has no subcat...
35,642
def check(self, useHEAD = True): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect(useHEAD = useHEAD) except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % ar...
def check(self, useHEAD = True): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect(useHEAD = useHEAD) except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % ar...
35,643
def checkLinksIn(self, page): try: text = page.get() except wikipedia.NoPage: wikipedia.output(u'%s does not exist.' % page.title()) return # RFC 2396 says that URLs may only contain certain characters. # For this regex we also accept non-allowed characters, so that the bot # will later show these links as broken ('Non...
def checkLinksIn(self, page): try: text = page.get() except wikipedia.NoPage: wikipedia.output(u'%s does not exist.' % page.title()) return # RFC 2396 says that URLs may only contain certain characters. # For this regex we also accept non-allowed characters, so that the bot # will later show these links as broken ('Non...
35,644
def checkLinksIn(self, page): try: text = page.get() except wikipedia.NoPage: wikipedia.output(u'%s does not exist.' % page.title()) return # RFC 2396 says that URLs may only contain certain characters. # For this regex we also accept non-allowed characters, so that the bot # will later show these links as broken ('Non...
def checkLinksIn(self, page): try: text = page.get() except wikipedia.NoPage: wikipedia.output(u'%s does not exist.' % page.title()) return # RFC 2396 says that URLs may only contain certain characters. # For this regex we also accept non-allowed characters, so that the bot # will later show these links as broken ('Non...
35,645
def reportBacklinks(self, new): """Report missing back links. This will be called from finish() if needed.""" for site in new.keys(): pl = new[site] if not unequal.bigger(self.inpl, pl) and not pl.hashname(): shouldlink = new.values() + [self.inpl] linked = pl.interwiki() for xpl in shouldlink: if xpl != pl and not xpl...
def reportBacklinks(self, new): """Report missing back links. This will be called from finish() if needed.""" for site in new.keys(): pl = new[site] if not unequal.bigger(self.inpl, pl) and not pl.hashname(): shouldlink = new.values() + [self.inpl] linked = pl.interwiki() for xpl in shouldlink: if xpl != pl and not xpl...
35,646
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.site.lang]) % d, site = self.site)
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.site.lang]) % d, site = self.site)
35,647
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.site.lang]) % d, site = self.site)
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.site.lang]) % d, site = self.site)
35,648
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.site.lang]) % d, site = self.site)
def __call__(self, m, d): import wikipedia return wikipedia.html2unicode((date_format[m][self.site.lang]) % d, site = self.site)
35,649
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,650
def assemble(self, returnonquestion = False, askall = False): if globalvar.bell: sys.stdout.write('\07') 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: if returnonquestion: return None self.problem('...
def assemble(self, returnonquestion = False, askall = False): 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: if returnonquestion: return None self.problem('Someone refers to %s with us' % pl.asasciil...
35,651
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
35,652
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
35,653
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
defformdata = {} formdata["wpUploadDescription"] = description if wikipedia.version() >= '1.4': formdata["wpUploadCopyStatus"] = wikipedia.input(u"Copyright status: ") formdata["wpUploadSource"] = wikipedia.input(u"Source of image: ") else: formdata["wpUploadAffirm"] = "1" formdata["wpUpload"] = "upload bestand" formda...
35,654
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
35,655
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
defget_image(original_url,source_wiki,original_description,keep=False,debug=False):#workwithacopyofargumentvariablessowecanreusethe#originalonesiftheuploadfailsfn=original_urldescription=original_description#Getfilecontentsuo=wikipedia.MyURLopener()file=uo.open(fn)contents=file.read()ifcontents.find("TherequestedURLwas...
35,656
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
def get_image(original_url, source_wiki, original_description, keep=False, debug=False): # work with a copy of argument variables so we can reuse the # original ones if the upload fails fn = original_url description = original_description # Get file contents uo = wikipedia.MyURLopener() file = uo.open(fn) contents = fi...
35,657
def getData(self): import httplib try: addr = self.addr%special[self.code] except KeyError: print "BUG: Can not find name of Special in %s:" % self.code raise pagenames = u'\r\n'.join([x.hashfreeLinkname() for x in self.pages]) pagenames = forCode(pagenames, self.code) data = urlencode(( ('action', 'submit'), ('pages',...
def getData(self): import httplib try: addr = self.addr%special[self.code] except KeyError: print "BUG: Can not find name of Special in %s:" % self.code raise pagenames = u'\r\n'.join([x.hashfreeLinkname() for x in self.pages]) pagenames = forCode(pagenames, self.code) data = urlencode(( ('action', 'submit'), ('pages',...
35,658
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
def check(self, useHEAD = True): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeE...
35,659
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect(useHEAD = useHEAD) except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except Unicode...
35,660
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
defcheck(self):"""ReturnsTrueandtheserverstatusmessageifthepageisalive.Otherwisereturnsfalse"""try:wasRedirected=self.resolveRedirect()excepthttplib.error,arg:returnFalse,u'HTTPError:%s'%argexceptsocket.error,arg:returnFalse,u'SocketError:%s'%argexceptUnicodeEncodeError,arg:returnFalse,u'Non-ASCIICharactersinURL:%s'%ar...
35,661
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
35,662
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
35,663
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
def check(self): """ Returns True and the server status message if the page is alive. Otherwise returns false """ try: wasRedirected = self.resolveRedirect() except httplib.error, arg: return False, u'HTTP Error: %s' % arg except socket.error, arg: return False, u'Socket Error: %s' % arg except UnicodeEncodeError, arg:...
35,664
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe...
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe...
35,665
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe...
def add_category(sort_by_last_name = False): ''' A robot to mass-add a category to a list of pages. ''' print "This bot has two modes: you can add a category link to all" print "pages mentioned in a List that is now in another wikipedia page" print "or you can add a category link to all pages that link to a" print "spe...
35,666
def treeview(cat, max_depth, current_depth = 0, parent = None): ''' Returns a multi-line string which contains a tree view of all subcategories of cat, up to level max_depth. Parameters: * cat - a CatLink which will be the tree's root * current_depth - the current level in the tree (for recursion) * parent - the CatLi...
def treeview(cat, max_depth, current_depth = 0, parent = None): ''' Returns a multi-line string which contains a tree view of all subcategories of cat, up to level max_depth. Parameters: * cat - a CatLink which will be the tree's root * current_depth - the current level in the tree (for recursion) * parent - the CatLi...
35,667
def compareLanguages(old,new): removing=[] adding=[] modifying=[] for code,name in old.iteritems(): if not new.has_key(code): removing.append(code) elif old[code]!=new[code]: oo=wikipedia.url2link(wikipedia.link2url(old[code])) nn=wikipedia.url2link(wikipedia.link2url(old[code])) if oo!=nn: modifying.append(code) for c...
def compareLanguages(old,new): removing=[] adding=[] modifying=[] for code,name in old.iteritems(): if not new.has_key(code): removing.append(code) elif old[code]!=new[code]: oo=wikipedia.url2link(wikipedia.link2url(old[code])) nn=wikipedia.url2link(wikipedia.link2url(new[code])) if oo!=nn: modifying.append(code) for c...
35,668
def treesearch(code,name): arr={(code,name):None} # First make one step based on the language itself try: n=treestep(arr,code,name,abort_on_redirect=1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n==0 and not arr[code,name]: print "Mother doesn't exist" return # Then add translations if we survi...
def treesearch(code,name): arr={(code,name):None} # First make one step based on the language itself try: n=treestep(arr,code,name,abort_on_redirect=1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n==0 and not arr[code,name]: print "Mother doesn't exist" return # Then add translations if we survi...
35,669
def treesearch(code,name): arr={(code,name):None} # First make one step based on the language itself try: n=treestep(arr,code,name,abort_on_redirect=1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n==0 and not arr[code,name]: print "Mother doesn't exist" return # Then add translations if we survi...
def treesearch(code,name): arr={(code,name):None} # First make one step based on the language itself try: n=treestep(arr,code,name,abort_on_redirect=1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n==0 and not arr[code,name]: print "Mother doesn't exist" return # Then add translations if we survi...
35,670
def treesearch(code,name): arr={(code,name):None} # First make one step based on the language itself try: n=treestep(arr,code,name,abort_on_redirect=1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n==0 and not arr[code,name]: print "Mother doesn't exist" return # Then add translations if we survi...
def treesearch(code,name): arr={(code,name):None} # First make one step based on the language itself try: n=treestep(arr,code,name,abort_on_redirect=1) except wikipedia.IsRedirectPage: print "Is redirect page" return if n==0 and not arr[code,name]: print "Mother doesn't exist" return # Then add translations if we survi...
35,671
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, "Non-existing page").get(force = True, sysop = sysop) except Error: pass if sysop: if not s...
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, "Wikipedia:Sandbox").get(force = True, sysop = sysop) except Error: pass if sysop: if not s...
35,672
def put(self, newtext, comment=None, watchArticle = None, minorEdit = True): """Replace the new page with the contents of the first argument. The second argument is a string that is to be used as the summary for the modification
def put(self, newtext, comment=None, watchArticle = None, minorEdit = True): """Replace the new page with the contents of the first argument. The second argument is a string that is to be used as the summary for the modification
35,673
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
def move_to_category(self, article, original_cat, current_cat): ''' Given an article which is in category original_cat, ask the user if it should be moved to one of original_cat's subcategories. Recursively run through subcategories' subcategories. NOTE: current_cat is only used for internal recursion. You should alway...
35,674
def run(self): catlink = catlib.Category(wikipedia.getSite(), 'Category:' + self.catTitle) # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), msg_change) % self.catTitle) articles = catlink.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in ca...
def run(self): cat = catlib.Category(wikipedia.getSite(), 'Category:' + self.catTitle) # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), msg_change) % self.catTitle) articles = catlink.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in catego...
35,675
def run(self): catlink = catlib.Category(wikipedia.getSite(), 'Category:' + self.catTitle) # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), msg_change) % self.catTitle) articles = catlink.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in ca...
def run(self): catlink = catlib.Category(wikipedia.getSite(), 'Category:' + self.catTitle) # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), msg_change) % cat.title()) articles = cat.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in category...
35,676
def run(self): catlink = catlib.Category(wikipedia.getSite(), 'Category:' + self.catTitle) # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), msg_change) % self.catTitle) articles = catlink.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in ca...
def run(self): catlink = catlib.Category(wikipedia.getSite(), 'Category:' + self.catTitle) # get edit summary message wikipedia.setAction(wikipedia.translate(wikipedia.getSite(), msg_change) % self.catTitle) articles = catlink.articles(recurse = 0) if len(articles) == 0: wikipedia.output(u'There are no articles in ca...
35,677
def __init__(self): family.Family.__init__(self) self.name = 'wikiquote' self.langs = { 'minnan':'zh-min-nan.wikiquote.org', 'nb':'no.wikiquote.org', 'zh-cn':'zh.wikiquote.org', 'zh-tw':'zh.wikiquote.org' } for lang in self.knownlanguages: self.langs[lang] = lang+'.wikiquote.org'
def __init__(self): family.Family.__init__(self) self.name = 'wikiquote' self.langs = { 'minnan':'zh-min-nan.wikiquote.org', 'nb':'no.wikiquote.org', 'zh-cn':'zh.wikiquote.org', 'zh-tw':'zh.wikiquote.org' } for lang in self.knownlanguages: self.langs[lang] = lang+'.wikiquote.org'
35,678
def post_multipart(host, selector, fields, files, cookies): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page...
def post_multipart(host, selector, fields, files, cookies): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page...
35,679
def post_multipart(host, selector, fields, files, cookies): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page...
def post_multipart(host, selector, fields, files, cookies): """ Post fields and files to an http host as multipart/form-data. fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be uploaded as files Return the server's response page...
35,680
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
35,681
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
35,682
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
35,683
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
35,684
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
35,685
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
def upload_image(self, debug=False): """Gets the image at URL self.url, and uploads it to the target wiki. Returns the filename which was used to upload the image. If the upload fails, the user is asked whether to try again or not. If the user chooses not to retry, returns null. """ if not self.urlEncoding: # URL is a ...
35,686
def cleanUpLinks(self, text): trailR = re.compile(self.site.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 lab...
def cleanUpLinks(self, text): trailR = re.compile(self.site.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 lab...
35,687
def __init__(self, site, title, insite = None, tosite = None, defaultNamespace = 0): """ Constructor. Normally called with two arguments: Parameters: 1) The wikimedia site on which the page resides 2) The title of the page as a unicode string
def __init__(self, site, title, insite = None, tosite = None, defaultNamespace = 0): """ Constructor. Normally called with two arguments: Parameters: 1) The wikimedia site on which the page resides 2) The title of the page as a unicode string
35,688
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
35,689
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
35,690
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
def linkedPages(self): """Gives the normal (not-interwiki, non-category) pages the page links to, as a list of Page objects """ result = [] try: thistxt = removeLanguageLinks(self.get()) except NoPage: return [] except IsRedirectPage: raise thistxt = removeCategoryLinks(thistxt, self.site())
35,691
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,692
def _make_catlist(self, recurse = False, purge = False, site = None): """Make a list of all articles and categories that are in this category. If recurse is set to True, articles and subcategories of any subcategories are also retrieved.
def _make_catlist(self, recurse = False, purge = False, site = None): """Make a list of all articles and categories that are in this category. If recurse is set to True, articles and subcategories of any subcategories are also retrieved.
35,693
def _make_catlist(self, recurse = False, purge = False, site = None): """Make a list of all articles and categories that are in this category. If recurse is set to True, articles and subcategories of any subcategories are also retrieved.
def _make_catlist(self, recurse = False, purge = False, site = None): """Make a list of all articles and categories that are in this category. If recurse is set to True, articles and subcategories of any subcategories are also retrieved.
35,694
def dh_singVal( value, match ): """This function helps with matching a single value. formats['CurrEvents']['en'](0) => u'Current Events' formats['CurrEvents']['en'](u'Current Events') => 0""" if type(value) is int: if value == 0: return match else: raise ValueError("unknown value %d" % value) else: if value == match: r...
def dh_singVal( value, match ): """This function helps with matching a single value. formats['CurrEvents']['en'](0) => u'Current Events' formats['CurrEvents']['en'](u'Current Events') => 0""" if type(value) is int: if value == 0: return match else: raise ValueError("unknown value %d" % value) else: if value == match: r...
35,695
def monthName(lang,ind): return formats['MonthName'][lang](ind)
def monthName(lang,ind): return formats['MonthName'][lang](ind)
35,696
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
35,697
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
35,698
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
35,699