changeset 3933:b48dbb4a46ff

fix pep8
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 05 Aug 2008 17:51:08 +0200
parents 2bcd23157684
children be75172aaf9b
files MoinMoin/script/migration/1059997.py MoinMoin/script/migration/text_moin160a_wiki.py MoinMoin/script/migration/wikiutil160a.py
diffstat 3 files changed, 64 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/migration/1059997.py	Tue Aug 05 17:35:16 2008 +0200
+++ b/MoinMoin/script/migration/1059997.py	Tue Aug 05 17:51:08 2008 +0200
@@ -6,7 +6,7 @@
     Note: this is a special hack for some users of a early 1.6 alpha version,
           this code is skipped and NOT executed in a normal release-to-release
           migration (like when going from 1.5.x release to 1.6.0 release).
-          
+
           If you run this early 1.6alpha code (with different link markup than
           1.5.x AND 1.6.x release has), you need to manually put 1059997 into
           your data/meta file to have this special code executed.
--- a/MoinMoin/script/migration/text_moin160a_wiki.py	Tue Aug 05 17:35:16 2008 +0200
+++ b/MoinMoin/script/migration/text_moin160a_wiki.py	Tue Aug 05 17:51:08 2008 +0200
@@ -113,7 +113,7 @@
         'word_rule': word_rule,
         'smiley': u'|'.join(map(re.escape, config.smileys))}
 
-    # Don't start p before these 
+    # Don't start p before these
     no_new_p_before = ("heading rule table tableZ tr td "
                        "ul ol dl dt dd li li_none indent "
                        "macro parser pre")
@@ -1092,7 +1092,7 @@
                 self.request.write(self._indent_to(indlen, indtype, numtype, numstart))
 
                 # Table mode
-                # TODO: move into function?                
+                # TODO: move into function?
                 if (not self.in_table and line[indlen:indlen + 2] == "||"
                     and line.endswith("|| ") and len(line) >= 5 + indlen):
                     # Start table
--- a/MoinMoin/script/migration/wikiutil160a.py	Tue Aug 05 17:35:16 2008 +0200
+++ b/MoinMoin/script/migration/wikiutil160a.py	Tue Aug 05 17:51:08 2008 +0200
@@ -36,7 +36,7 @@
     """ Decode Windows path names correctly. This is needed because many CGI
     servers follow the RFC recommendation and re-encode the path_info variable
     according to the file system semantics.
-    
+
     @param text: the text to decode, string
     @rtype: unicode
     @return: decoded text
@@ -85,7 +85,7 @@
 def decodeUserInput(s, charsets=[config.charset]):
     """
     Decodes input from the user.
-    
+
     @param s: the string to unquote
     @param charsets: list of charsets to assume the string is in
     @rtype: unicode
@@ -105,7 +105,7 @@
 def url_quote(s, safe='/', want_unicode=False):
     """
     Wrapper around urllib.quote doing the encoding/decoding as usually wanted:
-    
+
     @param s: the string to quote (can be str or unicode, if it is unicode,
               config.charset is used to encode it before calling urllib)
     @param safe: just passed through to urllib
@@ -125,7 +125,7 @@
 def url_quote_plus(s, safe='/', want_unicode=False):
     """
     Wrapper around urllib.quote_plus doing the encoding/decoding as usually wanted:
-    
+
     @param s: the string to quote (can be str or unicode, if it is unicode,
               config.charset is used to encode it before calling urllib)
     @param safe: just passed through to urllib
@@ -145,7 +145,7 @@
 def url_unquote(s, want_unicode=True):
     """
     Wrapper around urllib.unquote doing the encoding/decoding as usually wanted:
-    
+
     @param s: the string to unquote (can be str or unicode, if it is unicode,
               config.charset is used to encode it before calling urllib)
     @param want_unicode: for the less usual case that you want to get back
@@ -179,7 +179,7 @@
 
 def makeQueryString(qstr=None, want_unicode=False, **kw):
     """ Make a querystring from arguments.
-        
+
     kw arguments overide values in qstr.
 
     If a string is passed in, it's returned verbatim and
@@ -202,7 +202,7 @@
 def quoteWikinameURL(pagename, charset=config.charset):
     """ Return a url encoding of filename in plain ascii
 
-    Use urllib.quote to quote any character that is not always safe. 
+    Use urllib.quote to quote any character that is not always safe.
 
     @param pagename: the original pagename (unicode)
     @param charset: url text encoding, 'utf-8' recommended. Other charset
@@ -217,11 +217,11 @@
 
 def escape(s, quote=0):
     """ Escape possible html tags
-    
+
     Replace special characters '&', '<' and '>' by SGML entities.
     (taken from cgi.escape so we don't have to include that, even if we
     don't use cgi at all)
-    
+
     @param s: (unicode) string to escape
     @param quote: bool, should transform '\"' to '&quot;'
     @rtype: when called with a unicode object, return unicode object - otherwise return string object
@@ -284,11 +284,11 @@
 
 def quoteWikinameFS(wikiname, charset=config.charset):
     """ Return file system representation of a Unicode WikiName.
-            
+
     Warning: will raise UnicodeError if wikiname can not be encoded using
     charset. The default value of config.charset, 'utf-8' can encode any
     character.
-        
+
     @param wikiname: Unicode string possibly containing non-ascii characters
     @param charset: charset to encode string
     @rtype: string
@@ -302,7 +302,7 @@
         # append leading safe stuff
         quoted.append(filename[location:needle.start()])
         location = needle.end()
-        # Quote and append unsafe stuff           
+        # Quote and append unsafe stuff
         quoted.append('(')
         for character in needle.group():
             quoted.append('%02x' % ord(character))
@@ -315,17 +315,17 @@
 
 def unquoteWikiname(filename, charsets=[config.charset]):
     """ Return Unicode WikiName from quoted file name.
-    
+
     We raise an InvalidFileNameError if we find an invalid name, so the
     wiki could alarm the admin or suggest the user to rename a page.
     Invalid file names should never happen in normal use, but are rather
-    cheap to find. 
-    
+    cheap to find.
+
     This function should be used only to unquote file names, not page
     names we receive from the user. These are handled in request by
     urllib.unquote, decodePagename and normalizePagename.
-    
-    Todo: search clients of unquoteWikiname and check for exceptions. 
+
+    Todo: search clients of unquoteWikiname and check for exceptions.
 
     @param filename: string using charset and possibly quoted parts
     @param charsets: list of charsets used by string
@@ -379,7 +379,7 @@
     """ Convert UNIX timestamp (may be float or int) to our version
         (long) int.
         We don't want to use floats, so we just scale by 1e6 to get
-        an integer in usecs. 
+        an integer in usecs.
     """
     return long(ts*1000000L) # has to be long for py 2.2.x
 
@@ -387,7 +387,7 @@
     """ Convert version number to UNIX timestamp (float).
         This must ONLY be used for display purposes.
     """
-    return v/1000000.0
+    return v / 1000000.0
 
 
 # This is the list of meta attribute names to be treated as integers.
@@ -587,7 +587,7 @@
 
 def split_wiki(wikiurl):
     """ Split a wiki url, e.g:
-    
+
     'MoinMoin:FrontPage' -> "MoinMoin", "FrontPage", ""
     'FrontPage' -> "Self", "FrontPage", ""
     'MoinMoin:"Page with blanks" link title' -> "MoinMoin", "Page with blanks", "link title"
@@ -624,7 +624,7 @@
 
 def resolve_wiki(request, wikiurl):
     """ Resolve an interwiki link.
-    
+
     @param request: the request object
     @param wikiurl: the InterWiki:PageName link
     @rtype: tuple
@@ -640,10 +640,10 @@
 def join_wiki(wikiurl, wikitail):
     """
     Add a (url_quoted) page name to an interwiki url.
-   
+
     Note: We can't know what kind of URL quoting a remote wiki expects.
           We just use a utf-8 encoded string with standard URL quoting.
-          
+
     @param wikiurl: wiki url, maybe including a $PAGE placeholder
     @param wikitail: page name
     @rtype: string
@@ -662,7 +662,7 @@
 
 def isSystemPage(request, pagename):
     """ Is this a system page? Uses AllSystemPagesGroup internally.
-    
+
     @param request: the request object
     @param pagename: the page name
     @rtype: bool
@@ -674,7 +674,7 @@
 
 def isTemplatePage(request, pagename):
     """ Is this a template page?
-    
+
     @param pagename: the page name
     @rtype: bool
     @return: true if page is a template page
@@ -697,11 +697,11 @@
 
     WARNING: DO NOT USE THIS TO FILTER THE FULL PAGE LIST! Use
     getPageList with a filter function.
-        
+
     If you pass a list with a single pagename, either that is returned
     or an empty list, thus you can use this function like a `isCategoryPage`
     one.
-       
+
     @param pagelist: a list of pages
     @rtype: list
     @return: only the category pages of pagelist
@@ -712,7 +712,7 @@
 
 def getLocalizedPage(request, pagename): # was: getSysPage
     """ Get a system page according to user settings and available translations.
-    
+
     We include some special treatment for the case that <pagename> is the
     currently rendered page, as this is the case for some pages used very
     often, like FrontPage, RecentChanges etc. - in that case we reuse the
@@ -765,7 +765,7 @@
     those who have not created a homepage.
 
     DEPRECATED - try to use getInterwikiHomePage (see below)
-    
+
     @param request: the request object
     @param username: the user's name
     @rtype: Page
@@ -789,13 +789,13 @@
 def getInterwikiHomePage(request, username=None):
     """
     Get a user's homepage.
-    
+
     cfg.user_homewiki influences behaviour of this:
     'Self' does mean we store user homepage in THIS wiki.
     When set to our own interwikiname, it behaves like with 'Self'.
-    
+
     'SomeOtherWiki' means we store user homepages in another wiki.
-    
+
     @param request: the request object
     @param username: the user's name
     @rtype: tuple (or None for anon users)
@@ -1007,7 +1007,7 @@
 
 def importPlugin(cfg, kind, name, function="execute"):
     """ Import wiki or builtin plugin
-    
+
     Returns function from a plugin module name. If name can not be
     imported, raise PluginMissingError. If function is missing, raise
     PluginAttributeError.
@@ -1018,7 +1018,7 @@
     Wiki plugins will always override builtin plugins. If you want
     specific plugin, use either importWikiPlugin or importBuiltinPlugin
     directly.
-    
+
     @param cfg: wiki config instance
     @param kind: what kind of module we want to import
     @param name: the name of the module
@@ -1034,7 +1034,7 @@
 
 def importWikiPlugin(cfg, kind, name, function="execute"):
     """ Import plugin from the wiki data directory
-    
+
     See importPlugin docstring.
     """
     if not name in wikiPlugins(kind, cfg):
@@ -1044,8 +1044,8 @@
 
 
 def importBuiltinPlugin(kind, name, function="execute"):
-    """ Import builtin plugin from MoinMoin package 
-    
+    """ Import builtin plugin from MoinMoin package
+
     See importPlugin docstring.
     """
     if not name in builtinPlugins(kind):
@@ -1055,8 +1055,8 @@
 
 
 def importNameFromPlugin(moduleName, name):
-    """ Return name from plugin module 
-    
+    """ Return name from plugin module
+
     Raise PluginAttributeError if name does not exists.
     """
     module = __import__(moduleName, globals(), {}, [name])
@@ -1068,7 +1068,7 @@
 
 def builtinPlugins(kind):
     """ Gets a list of modules in MoinMoin.'kind'
-    
+
     @param kind: what kind of modules we look for
     @rtype: list
     @return: module names
@@ -1079,10 +1079,10 @@
 
 def wikiPlugins(kind, cfg):
     """ Gets a list of modules in data/plugin/'kind'
- 
+
     Require valid plugin directory. e.g missing 'parser' directory or
     missing '__init__.py' file will raise errors.
-    
+
     @param kind: what kind of modules we look for
     @rtype: list
     @return: module names
@@ -1094,7 +1094,7 @@
 
 def getPlugins(kind, cfg):
     """ Gets a list of plugin names of kind
-    
+
     @param kind: what kind of modules we look for
     @rtype: list
     @return: module names
@@ -1178,7 +1178,7 @@
     a tuple (found_flag, msg). found_flag is whether it did find and process
     something, msg is '' when all was OK or any other string to return an error
     message.
-    
+
     @param request: the request object
     @param attrstring: string containing the attributes to be parsed
     @param endtoken: token terminating parsing
@@ -1261,28 +1261,28 @@
          String   | s      | 'Stri\'ng'
          Boolean  | b      | 0 1 True false
          Name     |        | case_sensitive | converted to string
-        
-        So say you want to parse three things, name, age and if the 
+
+        So say you want to parse three things, name, age and if the
         person is male or not:
-        
+
         The pattern will be: %(name)s%(age)i%(male)b
-        
+
         As a result, the returned dict will put the first value into
         male, second into age etc. If some argument is missing, it will
-        get None as its value. This also means that all the identifiers 
+        get None as its value. This also means that all the identifiers
         in the pattern will exist in the dict, they will just have the
         value None if they were not specified by the caller.
-        
+
         So if we call it with the parameters as follows:
             ("John Smith", 18)
         this will result in the following dict:
             {"name": "John Smith", "age": 18, "male": None}
-        
+
         Another way of calling would be:
             ("John Smith", male=True)
         this will result in the following dict:
             {"name": "John Smith", "age": None, "male": True}
-        
+
         @copyright: 2004 by Florian Festi,
                     2006 by Mikko Virkkilä
         @license: GNU GPL, see COPYING for details.
@@ -1425,7 +1425,7 @@
     param = ' 4,"DI\'NG", b=retry, a="DING"'
 
     #p_list, p_dict = parse_parameters(param)
-    
+
     print 'Pattern :', pattern
     print 'Param :', param
 
@@ -1445,7 +1445,7 @@
     """
     Make a filename that is supposed to be a plain name secure, i.e.
     remove any possible path components that compromise our system.
-    
+
     @param basename: (possibly unsafe) filename
     @rtype: string
     @return: (safer) filename
@@ -1459,7 +1459,7 @@
 def mapURL(request, url):
     """
     Map URLs according to 'cfg.url_mappings'.
-    
+
     @param url: a URL
     @rtype: string
     @return: mapped URL
@@ -1480,7 +1480,7 @@
     """
     Return a group letter for `name`, which must be a unicode string.
     Currently supported: Hangul Syllables (U+AC00 - U+D7AF)
-    
+
     @param name: a string
     @rtype: string
     @return: group letter or None
@@ -1492,10 +1492,10 @@
         return c.upper() # we put lower and upper case words into the same index group
 
 
-def isStrictWikiname(name, word_re=re.compile(ur"^(?:[%(u)s][%(l)s]+){2,}$" % {'u':config.chars_upper, 'l':config.chars_lower})):
+def isStrictWikiname(name, word_re=re.compile(ur"^(?:[%(u)s][%(l)s]+){2,}$" % {'u': config.chars_upper, 'l': config.chars_lower})):
     """
     Check whether this is NOT an extended name.
-    
+
     @param name: the wikiname in question
     @rtype: bool
     @return: true if name matches the word_re
@@ -1506,7 +1506,7 @@
 def isPicture(url):
     """
     Is this a picture's url?
-    
+
     @param url: the url in question
     @rtype: bool
     @return: true if url points to a picture
@@ -1624,7 +1624,7 @@
         # invalid or empty ticket
         return False
     now = time.time()
-    if timestamp < now - 10*3600:
+    if timestamp < now - 10 * 3600:
         # we don't accept tickets older than 10h
         return False
     ourticket = createTicket(request, timestamp_str)
@@ -1637,7 +1637,7 @@
     out = StringIO.StringIO()
     request.redirect(out)
     wikiizer = Parser(text, request)
-    wikiizer.format(request.formatter,inhibit_p=True)
+    wikiizer.format(request.formatter, inhibit_p=True)
     result = out.getvalue()
     request.redirect()
     del out