bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
def dh_knYearConverter( value ): if type(value) is int: # Encode an integer value into a textual form. return unicode(value).translate(_knDigitsToLocal) else: # First make sure there are no real digits in the string tmp = value.translate(_knDigitsToLocal) # Test if tmp == value: tmp = value.translate(_knLocalTo...
35,900
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,901
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,902
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,903
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,904
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,905
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'pt' : lambda v: slh( v, [u'Primeiro milénio a.C.', u'Segundo milénio a.C.', u'Terceiro milénio a.C.', u'Quarto milénio a.C.'] ), dh_knYearConverter('pt' : lambda v: slh( v, [u'Primeiro milénio a.C.', u'Segundo milénio a.C.', u'Terceiro milénio a.C.', u'Quarto milénio a.C.'] ), value'pt' : lambda v: s...
35,906
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,907
def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param...
def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param...
35,908
def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param...
def makeMonthNamedList( lang, pattern, makeUpperCase = None ): """Creates a list of 12 elements based on the name of the month. The language-dependent month name is used as a formating argument to the pattern. The pattern must be have one %s that will be replaced by the localized month name. Use %%d for any other param...
35,909
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,910
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. """ # Get file contents if '://' in self...
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. """ # Get file contents if '://' in self...
35,911
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. """ # Get file contents if '://' in self...
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. """ # Get file contents if '://' in self...
35,912
def formatPl(self, pl): if hasattr(pl, '_contents'): #TODO: UGLY! need pl.isLoaded() if pl.isDisambig(): return "*" + pl.aslink() else: return pl.aslink() else: return "?" + pl.aslink()
def formatPl(self, pl): if hasattr(pl, '_contents'): #TODO: UGLY! need pl.isLoaded() if pl.isDisambig(): return "*" + pl.aslink(othersite = None) else: return pl.aslink() else: return "?" + pl.aslink()
35,913
def formatPl(self, pl): if hasattr(pl, '_contents'): #TODO: UGLY! need pl.isLoaded() if pl.isDisambig(): return "*" + pl.aslink() else: return pl.aslink() else: return "?" + pl.aslink()
def formatPl(self, pl): if hasattr(pl, '_contents'): #TODO: UGLY! need pl.isLoaded() if pl.isDisambig(): return "*" + pl.aslink() else: return pl.aslink(othersite = None) else: return "?" + pl.aslink()
35,914
def formatPl(self, pl): if hasattr(pl, '_contents'): #TODO: UGLY! need pl.isLoaded() if pl.isDisambig(): return "*" + pl.aslink() else: return pl.aslink() else: return "?" + pl.aslink()
def formatPl(self, pl): if hasattr(pl, '_contents'): #TODO: UGLY! need pl.isLoaded() if pl.isDisambig(): return "*" + pl.aslink() else: return pl.aslink() else: return "?" + pl.aslink()
35,915
def getCategoryLinks(text, site): import catlib """Returns a list of category links. in the form {code:pagename}. Do not call this routine directly, use Page objects instead""" result = [] # Ignore interwiki links within nowiki tags and HTML comments nowikiOrHtmlCommentR = re.compile(r'<nowiki>.*?</nowiki>|<!--.*?-->',...
def getCategoryLinks(text, site): import catlib """Returns a list of category links. in the form {code:pagename}. Do not call this routine directly, use Page objects instead""" result = [] # Ignore interwiki links within nowiki tags and HTML comments nowikiOrHtmlCommentR = re.compile(r'<nowiki>.*?</nowiki>|<!--.*?-->',...
35,916
def get(key): try: # find out how old our saved dump is (in seconds) file_age = time.time() - os.path.getmtime('mediawiki-messages/mediawiki-messages-%s.dat' % wikipedia.mylang) # if it's older than 7 days, reload it if file_age > 7 * 24 * 60 * 60: print 'Current MediaWiki message dump is outdated, reloading' refresh_m...
def get(key): try: # find out how old our saved dump is (in seconds) file_age = time.time() - os.path.getmtime('mediawiki-messages/mediawiki-messages-%s.dat' % wikipedia.mylang) # if it's older than 7 days, reload it if file_age > 30 * 24 * 60 * 60: print 'Current MediaWiki message dump is outdated, reloading' refresh_...
35,917
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
35,918
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
35,919
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
35,920
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
35,921
def refresh_messages(): host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.allmessages_address(wikipedia.mylang) print 'Retrieving MediaWiki messages' allmessages, charset = wikipedia.getUrl(host,url) #f=open('/home/daniel/allmessages.html', 'r') #allmess...
defif debug: print get('successfulupload') refresh_messages():if debug: print get('successfulupload') hostif debug: print get('successfulupload') =if debug: print get('successfulupload') wikipedia.family.hostname(wikipedia.mylang)if debug: print get('successfulupload') #if debug: print get('successfulupload') brokenif ...
35,922
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,923
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,924
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,925
def oneDone(self, title, timestamp, text): #print "DBG>", repr(title), timestamp, len(text) pl = PageLink(self.code, title) for pl2 in self.pages: #print "DBG>", pl, pl2, pl2.hashfreeLinkname() if PageLink(self.code, pl2.hashfreeLinkname()) == pl: if not hasattr(pl2,'_contents') and not hasattr(pl2,'_getexception'): br...
def oneDone(self, title, timestamp, text): #print "DBG>", repr(title), timestamp, len(text) pl = PageLink(self.code, title) for pl2 in self.pages: #print "DBG>", pl, pl2, pl2.hashfreeLinkname() if PageLink(self.code, pl2.hashfreeLinkname()) == pl: if not hasattr(pl2,'_contents') and not hasattr(pl2,'_getexception'): br...
35,926
def getData(self): import httplib addr = self.addr%special[self.code] pagenames = u'\r\n'.join([x.hashfreeLinkname() for x in self.pages]) data = urlencode(( ('action', 'submit'), ('pages', pagenames), ('curonly', 'True'), )) headers = {"Content-type": "application/x-www-form-urlencoded", "User-agent": "RobHooftWikiRob...
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]) data = urlencode(( ('action', 'submit'), ('pages', pagenames), ('curonly', 'True'), )) heade...
35,927
def __init__(self,term,definition='',etymology='',synonyms=[],translations={},label='',concisedef='',examples=[]): """ Constructor Generally called with one parameter: - The Term object we are describing
def __init__(self,term,definition='',etymology='',synonyms=[],translations={},label='',concisedef='',examples=[]): """ Constructor Generally called with one parameter: - The Term object we are describing
35,928
def __init__(self,lang,term,relatedwords=[],label=''): """ Constructor Generally called with two parameters: - The language of the term - The term (string)
def __init__(self,lang,term,relatedwords=[]): """ Constructor Generally called with two parameters: - The language of the term - The term (string)
35,929
def __init__(self,lang,term,relatedwords=[],label=''): """ Constructor Generally called with two parameters: - The language of the term - The term (string)
def __init__(self,lang,term,relatedwords=[],label=''): """ Constructor Generally called with two parameters: - The language of the term - The term (string)
35,930
def setLabel(self,label): self.label=label.replace('<!--','').replace('-->','')
def setLabel(self,label): self.label=label.replace('<!--','').replace('-->','')
35,931
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure. It returns a list of dictionaries. Each dictionary contains a header object and the textual content found under that header. Only relevant content is stored. Empty lines and lin...
35,932
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,933
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,934
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,935
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,936
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,937
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,938
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,939
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,940
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,941
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,942
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,943
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,944
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,945
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,946
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
def parseWikiPage(ofn,wikilang,pagetopic): '''This function will parse the content of a Wiktionary page and read it into our object structure''' apage = WiktionaryPage(wikilang,pagetopic) templist = [] context = {} content = open(ofn).readlines() splitcontent=[] for line in content: # Let's get rid of line breaks an...
35,947
def interwikiFormat(links, incode): """Create a suitable string to start a wikipedia page consisting of interwikilinks given as a dictionary of code:pagename in the argument. """ s = [] ar = links.keys() ar.sort() if mylang in config.interwiki_englishfirst: if 'en' in ar: del ar[ar.index('en')] ar[:0]=['en'] for code i...
def interwikiFormat(links, incode): """Create a suitable string to start a wikipedia page consisting of interwikilinks given as a dictionary of code:pagename in the argument. """ s = [] ar = links.keys() ar.sort() if mylang in config.interwiki_englishfirst: if 'en' in ar: del ar[ar.index('en')] ar[:0]=['en'] for code i...
35,948
def isEmpty(self): """ True if the page except for language links and category links has less than 4 characters, False otherwise. Can raise the same exceptions as get() """ txt = self.get() txt = removeLanguageLinks(txt) txt = removeCategoryLinks(txt, site = self.site()) if len(txt) < 4: return True else: return False
def isEmpty(self): """ True if the page has less than 4 characters, except for language links and category links, False otherwise. Can raise the same exceptions as get() """ txt = self.get() txt = removeLanguageLinks(txt) txt = removeCategoryLinks(txt, site = self.site()) if len(txt) < 4: return True else: return False
35,949
def isDisambig(self): defdis = self.site().family.disambig( "_default" ) locdis = self.site().family.disambig( self._site.lang )
def isDisambig(self): defdis = self.site().family.disambig( "_default" ) locdis = self.site().family.disambig( self._site.lang )
35,950
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
35,951
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
35,952
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
35,953
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
def getReferences(self, follow_redirects = True, offset = 0): """ Returns a list of pages that link to the page. If follow_redirects is True, also returns pages that link to a redirect pointing to the page. If offset is non-zero, skips that many references before loading. """ site = self.site() path = site.references_a...
35,954
def exceptionApplies(self, original_text): """ Returns True iff one of the exceptions applies for the given text. """ for exception in self.exceptions: if self.regex: exception = re.compile(exception) hit = exception.search(original_text) if hit: wikipedia.output(u'Skipping %s because it contains %s' % (pl.linkname(), ...
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) hit = exception.search(original_text) if hit: wikipedia...
35,955
def exceptionApplies(self, original_text): """ Returns True iff one of the exceptions applies for the given text. """ for exception in self.exceptions: if self.regex: exception = re.compile(exception) hit = exception.search(original_text) if hit: wikipedia.output(u'Skipping %s because it contains %s' % (pl.linkname(), ...
def exceptionApplies(self, original_text): """ Returns True iff one of the exceptions applies for the given text. """ for exception in self.exceptions: if self.regex: exception = re.compile(exception) hit = exception.search(original_text) if hit: return hit.group(0) else: hit = original_text.find(exception) if hit != -...
35,956
def exceptionApplies(self, original_text): """ Returns True iff one of the exceptions applies for the given text. """ for exception in self.exceptions: if self.regex: exception = re.compile(exception) hit = exception.search(original_text) if hit: wikipedia.output(u'Skipping %s because it contains %s' % (pl.linkname(), ...
def exceptionApplies(self, original_text): """ Returns True iff one of the exceptions applies for the given text. """ for exception in self.exceptions: if self.regex: exception = re.compile(exception) hit = exception.search(original_text) if hit: wikipedia.output(u'Skipping %s because it contains %s' % (pl.linkname(), ...
35,957
def run(self): """ Starts the robot. """ # Run the generator which will yield PageLinks to pages which might need to be # changed. for pl in self.generator.generate(): print '' try: # Load the page's text from the wiki original_text = pl.get() except wikipedia.NoPage: wikipedia.output(u'Page %s not found' % pl.linkname...
defmatch = self.checkExceptions(original_text) run(self):match = self.checkExceptions(original_text) """match = self.checkExceptions(original_text) Startsmatch = self.checkExceptions(original_text) thematch = self.checkExceptions(original_text) robot.match = self.checkExceptions(original_text) """match = self.checkExce...
35,958
def run(self): """ Starts the robot. """ # Run the generator which will yield PageLinks to pages which might need to be # changed. for pl in self.generator.generate(): print '' try: # Load the page's text from the wiki original_text = pl.get() except wikipedia.NoPage: wikipedia.output(u'Page %s not found' % pl.linkname...
def run(self): """ Starts the robot. """ # Run the generator which will yield PageLinks to pages which might need to be # changed. for pl in self.generator.generate(): print '' try: # Load the page's text from the wiki original_text = pl.get() except wikipedia.NoPage: wikipedia.output(u'Page %s not found' % pl.linkname...
35,959
def getPage(code, name): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] name = re.sub(' ', '_', name) if not '%' in name: # It should not have been done yet if name!=urllib.quote(name): print "DBG> quoting",name name = urllib.quote(name) if host[-4:] == '.org': # New softwar...
def getPage(code, name): """Get the contents of page 'name' from the 'code' language wikipedia""" host = langs[code] name = re.sub(' ', '_', name) if not '%' in name: # It should not have been done yet if name!=urllib.quote(name): print "DBG> quoting",name name = urllib.quote(name) if host[-4:] == '.org': # New softwar...
35,960
def getLanguageLinks(text): """Returns a dictionary of other language links mentioned in the text in the form {code:pagename}""" result = {} for code in langs: m=re.search(r'\[\['+code+':([^\]]*)\]\]', text) if m: result[code] = m.group(1) return result
def getLanguageLinks(text): """Returns a dictionary of other language links mentioned in the text in the form {code:pagename}""" result = {} for code in langs: m=re.search(r'\[\['+code+':([^\]]*)\]\]', text) if m: if m.group(1): result[code] = m.group(1) else: print "ERROR: empty link to %s:"%(code) return result
35,961
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,962
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,963
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,964
def run(self): commons = wikipedia.Site('commons', 'commons') comment = wikipedia.translate(self.site, nowCommonsMessage) for page in self.getPageGenerator(): wikipedia.output(u'\n\n>> %s <<\n' % page.title()) try: localImagePage = wikipedia.ImagePage(self.site, page.title()) if localImagePage.fileIsOnCommons(): wikipe...
def run(self): commons = wikipedia.Site('commons', 'commons') comment = wikipedia.translate(self.site, nowCommonsMessage) for page in self.getPageGenerator(): wikipedia.output(u'\n\n>> %s <<\n' % page.title()) try: localImagePage = wikipedia.ImagePage(self.site, page.title()) if localImagePage.fileIsOnCommons(): wikipe...
35,965
def edit(self, text, search = None): """ Calls the editor and thus allows the user to change the text. Returns the modified text. Halts the thread's operation until the editor is closed. Returns None if the user didn't save the text file in his text editor. """ if config.editor: tempFilename = '%s.%s' % (tempfile.mkte...
def edit(self, text, search = None): """ Calls the editor and thus allows the user to change the text. Returns the modified text. Halts the thread's operation until the editor is closed. Returns None if the user didn't save the text file in his text editor. """ if config.editor: tempFilename = '%s.%s' % (tempfile.mkte...
35,966
def edit(self, text, search = None): """ Calls the editor and thus allows the user to change the text. Returns the modified text. Halts the thread's operation until the editor is closed. Returns None if the user didn't save the text file in his text editor. """ if config.editor: tempFilename = '%s.%s' % (tempfile.mkte...
def edit(self, text, search = None): """ Calls the editor and thus allows the user to change the text. Returns the modified text. Halts the thread's operation until the editor is closed. Returns None if the user didn't save the text file in his text editor. """ if config.editor: tempFilename = '%s.%s' % (tempfile.mkte...
35,967
def edit(self, text, search = None): """ Calls the editor and thus allows the user to change the text. Returns the modified text. Halts the thread's operation until the editor is closed. Returns None if the user didn't save the text file in his text editor. """ if config.editor: tempFilename = '%s.%s' % (tempfile.mkte...
def edit(self, text, search = None): """ Calls the editor and thus allows the user to change the text. Returns the modified text. Halts the thread's operation until the editor is closed. Returns None if the user didn't save the text file in his text editor. """ if config.editor: tempFilename = '%s.%s' % (tempfile.mkte...
35,968
def __init__(self, args): """Takes one argument, usually this is sys.argv[1:]""" self.all_args = args self.set_options() self.site = wikipedia.getSite()
def __init__(self, args): """Takes one argument, usually this is sys.argv[1:]""" self.all_args = args self.set_options() self.site = wikipedia.getSite()
35,969
def setpage(self, new): """Sets page and pagelink""" pageTitle = self.options.page or wikipedia.input(u"Page to edit:") self.page = wikipedia.Page(self.site, pageTitle) if not self.options.edit_redirect and self.page.isRedirectPage(): self.page = wikipedia.Page(self.site, self.page.getRedirectTarget())
def setpage(self): """Sets page and page title""" site = wikipedia.getSite() pageTitle = self.options.page or wikipedia.input(u"Page to edit:") self.page = wikipedia.Page(self.site, pageTitle) if not self.options.edit_redirect and self.page.isRedirectPage(): self.page = wikipedia.Page(self.site, self.page.getRedirectTa...
35,970
def setpage(self, new): """Sets page and pagelink""" pageTitle = self.options.page or wikipedia.input(u"Page to edit:") self.page = wikipedia.Page(self.site, pageTitle) if not self.options.edit_redirect and self.page.isRedirectPage(): self.page = wikipedia.Page(self.site, self.page.getRedirectTarget())
def setpage(self, new): """Sets page and pagelink""" pageTitle = self.options.page or wikipedia.input(u"Page to edit:") self.page = wikipedia.Page(site, pageTitle) if not self.options.edit_redirect and self.page.isRedirectPage(): self.page = wikipedia.Page(self.site, self.page.getRedirectTarget())
35,971
def setpage(self, new): """Sets page and pagelink""" pageTitle = self.options.page or wikipedia.input(u"Page to edit:") self.page = wikipedia.Page(self.site, pageTitle) if not self.options.edit_redirect and self.page.isRedirectPage(): self.page = wikipedia.Page(self.site, self.page.getRedirectTarget())
def setpage(self, new): """Sets page and pagelink""" pageTitle = self.options.page or wikipedia.input(u"Page to edit:") self.page = wikipedia.Page(self.site, pageTitle) if not self.options.edit_redirect and self.page.isRedirectPage(): self.page = wikipedia.Page(self.site, self.page.getRedirectTarget())
35,972
def run(self): self.initialise_data() try: old = self.page.get(get_redirect = self.options.edit_redirect) except wikipedia.NoPage: old = "" textEditor = TextEditor(self.options) new = textEditor.edit(old) if new and old != new: new = self.repair(new) wikipedia.showDiff(old, new) comment = wikipedia.input(u"What did you...
def run(self): try: old = self.page.get(get_redirect = self.options.edit_redirect) except wikipedia.NoPage: old = "" textEditor = TextEditor(self.options) new = textEditor.edit(old) if new and old != new: new = self.repair(new) wikipedia.showDiff(old, new) comment = wikipedia.input(u"What did you change? ") + sig try: ...
35,973
def run(self): self.initialise_data() try: old = self.page.get(get_redirect = self.options.edit_redirect) except wikipedia.NoPage: old = "" textEditor = TextEditor(self.options) new = textEditor.edit(old) if new and old != new: new = self.repair(new) wikipedia.showDiff(old, new) comment = wikipedia.input(u"What did you...
def run(self): self.initialise_data() try: old = self.page.get(get_redirect = self.options.edit_redirect) except wikipedia.NoPage: old = "" textEditor = TextEditor() new = textEditor.edit(old) if new and old != new: new = self.repair(new) wikipedia.showDiff(old, new) comment = wikipedia.input(u"What did you change? ") ...
35,974
def link2url(name, code, incode = None): """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""" if '%' in name: name = url2unicode(name, language = code) else: name = html2unicode(name, language = code, altlanguage = incode) #pri...
def link2url(name, code, incode = None): """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""" if '%' in name: try: name = url2unicode(name, language = code) except UnicodeEncodeError: name = html2unicode(name, language = code, ...
35,975
def setDelay(self, delay = config.minthrottle, absolute = False): if absolute: self.mindelay = delay self.maxdelay = delay self.delay = delay # Don't count the time we already waited as part of our waiting time :-0 self.now = time.time()
def setDelay(self, delay = config.minthrottle, absolute = False): if absolute: self.mindelay = delay self.delay = delay # Don't count the time we already waited as part of our waiting time :-0 self.now = time.time()
35,976
def run(self): dt=15 while True: try: data = self.getData() except (socket.error, httplib.BadStatusLine): # Print the traceback of the caught exception print ''.join(traceback.format_exception(*sys.exc_info())) output(u'DBG> got network error in GetAll.run. Sleeping for %d seconds'%dt) time.sleep(dt) if dt <= 60: dt +=...
def run(self): dt=15 while True: try: data = self.getData() except (socket.error, httplib.BadStatusLine): # Print the traceback of the caught exception print ''.join(traceback.format_exception(*sys.exc_info())) output(u'DBG> got network error in GetAll.run. Sleeping for %d seconds'%dt) time.sleep(dt) if dt <= 60: dt +=...
35,977
def run(self): dt=15 while True: try: data = self.getData() except (socket.error, httplib.BadStatusLine): # Print the traceback of the caught exception print ''.join(traceback.format_exception(*sys.exc_info())) output(u'DBG> got network error in GetAll.run. Sleeping for %d seconds'%dt) time.sleep(dt) if dt <= 60: dt +=...
def run(self): dt=15 while True: try: data = self.getData() except (socket.error, httplib.BadStatusLine): # Print the traceback of the caught exception print ''.join(traceback.format_exception(*sys.exc_info())) output(u'DBG> got network error in GetAll.run. Sleeping for %d seconds'%dt) time.sleep(dt) if dt <= 60: dt +=...
35,978
def include(pl,checklinks=True,realinclude=True,linkterm=None): cl = checklinks if realinclude: try: text = pl.get() except wikipedia.NoPage: pass except wikipedia.IsRedirectPage: cl = True pass else: cats = pl.categories() if not workingcat in cats: cats = pl.categories(withSortKeys = True) for c in cats: if rawtoclea...
def include(pl,checklinks=True,realinclude=True,linkterm=None): cl = checklinks if realinclude: try: text = pl.get() except wikipedia.NoPage: pass except wikipedia.IsRedirectPage: cl = True pass else: cats = pl.categories() if not workingcat in cats: cats = pl.categories() for c in cats: if rawtoclean(c) in parentcats:...
35,979
def include(pl,checklinks=True,realinclude=True,linkterm=None): cl = checklinks if realinclude: try: text = pl.get() except wikipedia.NoPage: pass except wikipedia.IsRedirectPage: cl = True pass else: cats = pl.categories() if not workingcat in cats: cats = pl.categories(withSortKeys = True) for c in cats: if rawtoclea...
def include(pl,checklinks=True,realinclude=True,linkterm=None): cl = checklinks if realinclude: try: text = pl.get() except wikipedia.NoPage: pass except wikipedia.IsRedirectPage: cl = True pass else: cats = pl.categories() if not workingcat in cats: cats = pl.categories(withSortKeys = True) for c in cats: if c in pare...
35,980
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 wikipedia.output(u'') wikipedia.output(u"==%s=="%pl.title()) while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = w...
35,981
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,982
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,983
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,984
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,985
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print wikipedia.output(u"==%s=="%pl.title()) while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u...
35,986
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,987
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,988
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,989
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,990
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,991
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
def asktoadd(pl): ctoshow = 500 print print("==%s==")%pl.title() while 1: answer = raw_input("y(es)/n(o)/i(gnore)/(o)ther options? ") if answer=='y': include(pl) break if answer=='c': include(pl,realinclude=False) break if answer=='z': if pl.exists(): if not pl.isRedirectPage(): linkterm = wikipedia.input(u"In what man...
35,992
def __init__(self): family.Family.__init__(self) self.name = 'wiktionary' self.langs = { 'minnan':'zh-min-nan.wiktionary.org', 'nb':'no.wiktionary.org', 'zh-cn':'zh.wiktionary.org', 'zh-tw':'zh.wiktionary.org' } for lang in self.knownlanguages: self.langs[lang] = lang+'.wiktionary.org' # Most namespaces are inherited...
def __init__(self): family.Family.__init__(self) self.name = 'wiktionary' self.langs = { 'minnan':'zh-min-nan.wiktionary.org', 'nb':'no.wiktionary.org', 'zh-cn':'zh.wiktionary.org', 'zh-tw':'zh.wiktionary.org' } for lang in self.knownlanguages: self.langs[lang] = lang+'.wiktionary.org' # Most namespaces are inherited...
35,993
def treat(refpl, thispl): try: reftxt=refpl.get() except wikipedia.IsRedirectPage: wikipedia.output(u'%s is a redirect to %s' % (refpl.linkname(), thispl.linkname())) choice = wikipedia.input(u'Do you want to work on pages linking to %s? [y|N]' % refpl.linkname()) if choice == 'y': for ref_redir in getReferences(refpl)...
def treat(refpl, thispl): try: reftxt=refpl.get() except wikipedia.IsRedirectPage: wikipedia.output(u'%s is a redirect to %s' % (refpl.linkname(), thispl.linkname())) choice = wikipedia.input(u'Do you want to work on pages linking to %s? [y|N]' % refpl.linkname()) if choice == 'y': for ref_redir in getReferences(refpl)...
35,994
def __init__(self, oldCatTitle, newCatTitle, batchMode = False, editSummary = '', inPlace = False, moveCatPage = True): self.editSummary = editSummary self.inPlace = inPlace self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle self.inPlace = inPlace self.moveCatPa...
def __init__(self, oldCatTitle, newCatTitle, batchMode = False, editSummary = '', inPlace = False, moveCatPage = True): self.editSummary = editSummary self.oldCat = catlib.Category(wikipedia.getSite(), 'Category:' + oldCatTitle) self.newCatTitle = newCatTitle self.moveCatPage = moveCatPage # set edit summary message
35,995
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, inPlace=self...
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, inPlace=self...
35,996
def get_redirects_from_dump(sqlfilename): dict = {} # open sql dump and read page titles out of it dump = sqldump.SQLdump(sqlfilename, wikipedia.myencoding()) # case-insensitive regular expression which takes a redirect's text # (that is: '#REDIRECT [[bla]]') and extracts its target (that is: bla). redirR = re.compile(...
def get_redirects_from_dump(sqlfilename): dict = {} # open sql dump and read page titles out of it dump = sqldump.SQLdump(sqlfilename, wikipedia.myencoding()) # case-insensitive regular expression which takes a redirect's text # (that is: '#REDIRECT [[bla]]') and extracts its target (that is: bla). redirR = re.compile(...
35,997
def get_redirects_from_dump(sqlfilename): dict = {} # open sql dump and read page titles out of it dump = sqldump.SQLdump(sqlfilename, wikipedia.myencoding()) # case-insensitive regular expression which takes a redirect's text # (that is: '#REDIRECT [[bla]]') and extracts its target (that is: bla). redirR = re.compile(...
def get_redirects_from_dump(sqlfilename): dict = {} # open sql dump and read page titles out of it dump = sqldump.SQLdump(sqlfilename, wikipedia.myencoding()) # case-insensitive regular expression which takes a redirect's text # (that is: '#REDIRECT [[bla]]') and extracts its target (that is: bla). redirR = re.compile(...
35,998
def retrieve_broken_redirects(source): if source == None: # retrieve information from the live wiki's maintenance page host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.maintenance_address(wikipedia.mylang, 'brokenredirects', default_limit = False) print ...
def retrieve_broken_redirects(source): if source == None: # retrieve information from the live wiki's maintenance page host = wikipedia.family.hostname(wikipedia.mylang) # broken redirect maintenance page's URL url = wikipedia.family.maintenance_address(wikipedia.mylang, 'brokenredirects', default_limit = False) print ...
35,999