http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10170
Revision: 10170 Author: xqt Date: 2012-05-03 07:49:44 +0000 (Thu, 03 May 2012) Log Message: ----------- minor docs changes from trunk
Modified Paths: -------------- branches/rewrite/scripts/replace.py
Modified: branches/rewrite/scripts/replace.py =================================================================== --- branches/rewrite/scripts/replace.py 2012-05-02 05:52:15 UTC (rev 10169) +++ branches/rewrite/scripts/replace.py 2012-05-03 07:49:44 UTC (rev 10170) @@ -64,8 +64,8 @@ in order not to waste too much CPU.
-fix:XYZ Perform one of the predefined replacements tasks, which are - given in the dictionary 'fixes' defined inside the file - fixes.py. + given in the dictionary 'fixes' defined inside the files + fixes.py and user-fixes.py. The -regex and -nocase argument and given replacements will be ignored if you use -fix. Currently available predefined fixes are: @@ -110,10 +110,12 @@ talk about HTTP, where the typo has become part of the standard:
python replace.py referer referrer -file:typos.txt -excepttext:HTTP + +Please type "replace.py -help | more" if you can't read the top of the help. """ from __future__ import generators # -# (C) Daniel Herding & the Pywikipedia team, 2004-2011 +# (C) Daniel Herding & the Pywikipedia team, 2004-2012 # __version__='$Id$' # @@ -183,7 +185,8 @@ and not self.isTextExcepted(entry.text): new_text = entry.text for old, new in self.replacements: - new_text = pywikibot.replaceExcept(new_text, old, new, self.excsInside, self.site) + new_text = pywikibot.replaceExcept( + new_text, old, new, self.excsInside, self.site) if new_text != entry.text: yield pywikibot.Page(self.site, entry.title) except KeyboardInterrupt: @@ -613,7 +616,7 @@ caseInsensitive = fix['nocase'] replacements = fix['replacements']
- #Set the regular expression flags + # Set the regular expression flags flags = re.UNICODE if caseInsensitive: flags = flags | re.IGNORECASE @@ -630,7 +633,8 @@ oldR = re.compile(old, flags) replacements[i] = oldR, new
- for exceptionCategory in ['title', 'require-title', 'text-contains', 'inside']: + for exceptionCategory in [ + 'title', 'require-title', 'text-contains', 'inside']: if exceptionCategory in exceptions: patterns = exceptions[exceptionCategory] if not regex:
pywikipedia-svn@lists.wikimedia.org