changeset 3175:2a3a6cb34e45

pylint findings: fix some harmless stuff
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 03 Mar 2008 02:02:55 +0100
parents 4ea7ea7d755e
children b24235ec504f
files Makefile MoinMoin/Page.py MoinMoin/PageEditor.py MoinMoin/action/AttachFile.py MoinMoin/action/diff.py MoinMoin/action/login.py MoinMoin/action/newaccount.py MoinMoin/action/revert.py MoinMoin/action/serveopenid.py MoinMoin/action/userprefs.py MoinMoin/auth/botbouncer.py MoinMoin/auth/ldap_login.py MoinMoin/auth/openidrp.py MoinMoin/auth/php_session.py MoinMoin/config/multiconfig.py MoinMoin/events/jabbernotify.py MoinMoin/events/notification.py MoinMoin/macro/Hits.py MoinMoin/macro/Include.py MoinMoin/macro/PageCount.py MoinMoin/macro/RandomQuote.py MoinMoin/macro/TableOfContents.py MoinMoin/mail/mailimport.py MoinMoin/parser/text_moin_wiki.py MoinMoin/script/export/package.py MoinMoin/script/maint/mailtranslators.py MoinMoin/script/migration/_conv160.py MoinMoin/stats/languages.py MoinMoin/user.py MoinMoin/userform/admin.py MoinMoin/userform/login.py MoinMoin/userprefs/changepass.py MoinMoin/userprefs/notification.py MoinMoin/wikidicts.py MoinMoin/xmlrpc/__init__.py
diffstat 35 files changed, 50 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Mar 02 20:37:49 2008 +0100
+++ b/Makefile	Mon Mar 03 02:02:55 2008 +0100
@@ -86,7 +86,7 @@
 	@python -u -m trace --count --coverdir=cover --missing tests/runtests.py
 
 pylint:
-	@pylint --disable-msg=W0511,W0302,W0131,C0101,W0612,W0613,W0702,W0703,W0704,W0706,W0142,W0201 --disable-msg-cat=R --parseable=y MoinMoin
+	@pylint --disable-msg=W0142,W0511,W0612,W0613,C0103,C0111,C0302,C0321,C0322 --disable-msg-cat=R MoinMoin
 
 clean: clean-testwiki clean-pyc
 	rm -rf build
--- a/MoinMoin/Page.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/Page.py	Mon Mar 03 02:02:55 2008 +0100
@@ -34,7 +34,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, re, codecs
+import os, codecs
 
 from MoinMoin import log
 logging = log.getLogger(__name__)
--- a/MoinMoin/PageEditor.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/PageEditor.py	Mon Mar 03 02:02:55 2008 +0100
@@ -19,15 +19,14 @@
 import os, time, codecs, errno
 
 
-from MoinMoin import caching, config, user, wikiutil, error
+from MoinMoin import caching, config, wikiutil, error
 from MoinMoin.Page import Page
 from MoinMoin.widget import html
 from MoinMoin.widget.dialog import Status
 from MoinMoin.logfile import editlog, eventlog
 from MoinMoin.support.python_compatibility import set
 from MoinMoin.util import filesys, timefuncs, web
-from MoinMoin.mail import sendmail
-from MoinMoin.events import PageDeletedEvent, PageRenamedEvent, PageCopiedEvent
+from MoinMoin.events import PageDeletedEvent, PageRenamedEvent, PageCopiedEvent, PageRevertedEvent
 from MoinMoin.events import PagePreSaveEvent, Abort, send_event
 import MoinMoin.events.notification as notification
 
@@ -677,14 +676,12 @@
             msg = self.saveText(pg.get_raw_body(), 0, extra=revstr, action="SAVE/REVERT", notify=False)
 
             # Remove cache entry (if exists)
-            from MoinMoin import caching
             pg = Page(self.request, self.page_name)
             key = self.request.form.get('key', ['text_html'])[0]
             caching.CacheEntry(self.request, pg, key, scope='item').remove()
             caching.CacheEntry(self.request, pg, "pagelinks", scope='item').remove()
 
             # Notify observers
-            from MoinMoin.events import PageRevertedEvent, send_event
             e = PageRevertedEvent(self.request, self.page_name, revision, revstr)
             send_event(e)
 
--- a/MoinMoin/action/AttachFile.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/action/AttachFile.py	Mon Mar 03 02:02:55 2008 +0100
@@ -34,7 +34,6 @@
 from MoinMoin.util import filesys, timefuncs
 from MoinMoin.security.textcha import TextCha
 from MoinMoin.events import FileAttachedEvent, send_event
-import MoinMoin.events.notification as notification
 
 action_name = __name__.split('.')[-1]
 
--- a/MoinMoin/action/diff.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/action/diff.py	Mon Mar 03 02:02:55 2008 +0100
@@ -7,7 +7,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import wikiutil
 from MoinMoin.logfile import editlog
 from MoinMoin.Page import Page
 
--- a/MoinMoin/action/login.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/action/login.py	Mon Mar 03 02:02:55 2008 +0100
@@ -10,7 +10,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import user, userform
+from MoinMoin import userform
 from MoinMoin.Page import Page
 from MoinMoin.widget import html
 
--- a/MoinMoin/action/newaccount.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/action/newaccount.py	Mon Mar 03 02:02:55 2008 +0100
@@ -9,7 +9,6 @@
 from MoinMoin import user, wikiutil, util
 from MoinMoin.Page import Page
 from MoinMoin.widget import html
-import MoinMoin.events as events
 from MoinMoin.security.textcha import TextCha
 
 
--- a/MoinMoin/action/revert.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/action/revert.py	Mon Mar 03 02:02:55 2008 +0100
@@ -6,7 +6,6 @@
                 2006 MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
-from MoinMoin.Page import Page
 
 def execute(pagename, request):
     """ restore another revision of a page as a new current revision """
--- a/MoinMoin/action/serveopenid.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/action/serveopenid.py	Mon Mar 03 02:02:55 2008 +0100
@@ -19,7 +19,6 @@
 from openid.server import server
 from openid.message import IDENTIFIER_SELECT
 from MoinMoin.widget import html
-from MoinMoin.Page import Page
 from MoinMoin.request import MoinMoinFinish
 
 def execute(pagename, request):
--- a/MoinMoin/action/userprefs.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/action/userprefs.py	Mon Mar 03 02:02:55 2008 +0100
@@ -10,7 +10,6 @@
 """
 
 from MoinMoin import wikiutil
-from MoinMoin.Page import Page
 from MoinMoin.widget import html
 
 def _handle_submission(request):
--- a/MoinMoin/auth/botbouncer.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/auth/botbouncer.py	Mon Mar 03 02:02:55 2008 +0100
@@ -7,8 +7,6 @@
 """
 from MoinMoin import user
 from MoinMoin.auth import BaseAuth, CancelLogin, ContinueLogin, MultistageRedirectLogin
-from MoinMoin import wikiutil
-from MoinMoin.widget import html
 from urllib import urlopen, quote_plus
 
 class BotBouncer(BaseAuth):
--- a/MoinMoin/auth/ldap_login.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/auth/ldap_login.py	Mon Mar 03 02:02:55 2008 +0100
@@ -19,7 +19,6 @@
                 2006 Nick Phillips
     @license: GNU GPL, see COPYING for details.
 """
-import sys
 import ldap
 
 from MoinMoin import log
--- a/MoinMoin/auth/openidrp.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/auth/openidrp.py	Mon Mar 03 02:02:55 2008 +0100
@@ -11,7 +11,6 @@
 from openid.consumer import consumer
 from openid.yadis.discover import DiscoveryFailure
 from openid.fetchers import HTTPFetchingError
-from MoinMoin import wikiutil
 from MoinMoin.widget import html
 from MoinMoin.auth import CancelLogin, ContinueLogin
 from MoinMoin.auth import MultistageFormLogin, MultistageRedirectLogin
--- a/MoinMoin/auth/php_session.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/auth/php_session.py	Mon Mar 03 02:02:55 2008 +0100
@@ -12,7 +12,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import Cookie, urllib
+import urllib
 from MoinMoin import user
 from MoinMoin.auth import _PHPsessionParser, BaseAuth
 
@@ -61,20 +61,20 @@
             else:
                 return user_obj, True
 
-            user = user.User(request, name=username, auth_username=username,
-                             auth_method=self.name)
+            u = user.User(request, name=username, auth_username=username,
+                          auth_method=self.name)
 
             changed = False
-            if name != user.aliasname:
-                user.aliasname = name
+            if name != u.aliasname:
+                u.aliasname = name
                 changed = True
-            if email != user.email:
-                user.email = email
+            if email != u.email:
+                u.email = email
                 changed = True
 
-            if user:
-                user.create_or_update(changed)
-            if user and user.valid:
-                return user, True # True to get other methods called, too
+            if u:
+                u.create_or_update(changed)
+            if u and u.valid:
+                return u, True # True to get other methods called, too
         return user_obj, True # continue with next method in auth list
 
--- a/MoinMoin/config/multiconfig.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/config/multiconfig.py	Mon Mar 03 02:02:55 2008 +0100
@@ -837,7 +837,7 @@
                 if not self.secret:
                     raise error.ConfigurationError(errmsg)
             except AttributeError, err:
-                    raise error.ConfigurationError(errmsg)
+                raise error.ConfigurationError(errmsg)
 
             from xmlrpclib import Server
             self.notification_server = Server(self.notification_bot_uri, )
--- a/MoinMoin/events/jabbernotify.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/events/jabbernotify.py	Mon Mar 03 02:02:55 2008 +0100
@@ -10,7 +10,6 @@
 
 import xmlrpclib
 
-from MoinMoin import error
 from MoinMoin.Page import Page
 from MoinMoin.user import User, getUserList
 from MoinMoin.support.python_compatibility import set
--- a/MoinMoin/events/notification.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/events/notification.py	Mon Mar 03 02:02:55 2008 +0100
@@ -9,7 +9,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import MoinMoin.user
 from MoinMoin import user, wikiutil
 from MoinMoin.Page import Page
 from MoinMoin.events import EventResult
--- a/MoinMoin/macro/Hits.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/macro/Hits.py	Mon Mar 03 02:02:55 2008 +0100
@@ -18,7 +18,6 @@
 
 Dependencies = ['time'] # do not cache
 
-from MoinMoin import wikiutil
 from MoinMoin.logfile import eventlog
 
 
--- a/MoinMoin/macro/Include.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/macro/Include.py	Mon Mar 03 02:02:55 2008 +0100
@@ -19,7 +19,7 @@
 generates_headings = True
 
 import re, StringIO
-from MoinMoin import wikiutil, config
+from MoinMoin import wikiutil
 from MoinMoin.Page import Page
 
 
--- a/MoinMoin/macro/PageCount.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/macro/PageCount.py	Mon Mar 03 02:02:55 2008 +0100
@@ -11,21 +11,21 @@
 from MoinMoin import wikiutil
 
 def macro_PageCount(macro, exists=None):
-        """ Return number of pages readable by current user
-
-        Return either an exact count (slow!) or fast count including deleted pages.
+    """ Return number of pages readable by current user
 
-        TODO: make macro syntax more sane
-        """
-        request = macro.request
-        exists = wikiutil.get_unicode(request, exists, 'exists')
-        # Check input
-        only_existing = False
-        if exists == u'exists':
-            only_existing = True
-        elif exists:
-            raise ValueError("Wrong argument: %r" % exists)
+    Return either an exact count (slow!) or fast count including deleted pages.
 
-        count = request.rootpage.getPageCount(exists=only_existing)
-        return macro.formatter.text("%d" % count)
+    TODO: make macro syntax more sane
+    """
+    request = macro.request
+    exists = wikiutil.get_unicode(request, exists, 'exists')
+    # Check input
+    only_existing = False
+    if exists == u'exists':
+        only_existing = True
+    elif exists:
+        raise ValueError("Wrong argument: %r" % exists)
 
+    count = request.rootpage.getPageCount(exists=only_existing)
+    return macro.formatter.text("%d" % count)
+
--- a/MoinMoin/macro/RandomQuote.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/macro/RandomQuote.py	Mon Mar 03 02:02:55 2008 +0100
@@ -21,7 +21,7 @@
 
 import random
 
-from MoinMoin.Page import Page, wikiutil
+from MoinMoin.Page import Page
 
 Dependencies = ["time"]
 
--- a/MoinMoin/macro/TableOfContents.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/macro/TableOfContents.py	Mon Mar 03 02:02:55 2008 +0100
@@ -25,7 +25,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import re
 from MoinMoin.formatter import FormatterBase
 from MoinMoin.Page import Page
 from MoinMoin import wikiutil
--- a/MoinMoin/mail/mailimport.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/mail/mailimport.py	Mon Mar 03 02:02:55 2008 +0100
@@ -13,7 +13,7 @@
 import email
 from email.Utils import getaddresses, parsedate_tz, mktime_tz
 
-from MoinMoin import user, wikiutil
+from MoinMoin import user
 from MoinMoin.action.AttachFile import add_attachment, AttachmentAlreadyExists
 from MoinMoin.Page import Page
 from MoinMoin.PageEditor import PageEditor
--- a/MoinMoin/parser/text_moin_wiki.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/parser/text_moin_wiki.py	Mon Mar 03 02:02:55 2008 +0100
@@ -734,7 +734,6 @@
 
                         # use EmbedObject for other mimetypes
                         from MoinMoin.macro.EmbedObject import EmbedObject
-                        from MoinMoin.action import AttachFile
                         if mt is not None:
                             # reuse class tmp from Despam to define macro
                             from MoinMoin.action.Despam import tmp
--- a/MoinMoin/script/export/package.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/script/export/package.py	Mon Mar 03 02:02:55 2008 +0100
@@ -8,9 +8,9 @@
 @license: GNU GPL, see COPYING for details.
 """
 
-import codecs, errno, os, re, shutil, sys, time
+import os
 
-from MoinMoin import config, wikiutil, Page, user
+from MoinMoin import wikiutil, user
 from MoinMoin import script
 
 
@@ -98,9 +98,9 @@
             packagedata = package.collectpackage(package.searchpackage(request,
                                                                        self.options.search), packageoutput)
         elif self.options.pages:
-                packagedata = package.collectpackage(self.options.pages.split(","), packageoutput)
+            packagedata = package.collectpackage(self.options.pages.split(","), packageoutput)
         else:
-                packagedata = package.collectpackage(request.rootpage.getPageList(
+            packagedata = package.collectpackage(request.rootpage.getPageList(
                                 include_underlay=False,
                                 filter=lambda name: not wikiutil.isSystemPage(request, name)),
                                 packageoutput)
--- a/MoinMoin/script/maint/mailtranslators.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/script/maint/mailtranslators.py	Mon Mar 03 02:02:55 2008 +0100
@@ -6,9 +6,9 @@
 @license: GPL, see COPYING for details
 """
 
-import sys, os
+import sys
 
-from MoinMoin import config, i18n
+from MoinMoin import i18n
 from MoinMoin.mail.sendmail import sendmail
 from MoinMoin.script import MoinScript
 
--- a/MoinMoin/script/migration/_conv160.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/script/migration/_conv160.py	Mon Mar 03 02:02:55 2008 +0100
@@ -349,9 +349,9 @@
                 att.copy(attach_dir)
 
     def copy(self, pages_dir, renames):
-            self.renames = renames
-            self.read()
-            self.write(pages_dir)
+        self.renames = renames
+        self.read()
+        self.write(pages_dir)
 
 
 class User:
--- a/MoinMoin/stats/languages.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/stats/languages.py	Mon Mar 03 02:02:55 2008 +0100
@@ -9,7 +9,7 @@
 """
 
 
-from MoinMoin import user, wikiutil, i18n
+from MoinMoin import user, i18n
 
 
 def linkto(pagename, request, params=''):
--- a/MoinMoin/user.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/user.py	Mon Mar 03 02:02:55 2008 +0100
@@ -618,7 +618,7 @@
 
         arena = 'user'
         key = 'name2id'
-        cache = caching.CacheEntry(self._request, arena, key, scope='wiki').remove()
+        caching.CacheEntry(self._request, arena, key, scope='wiki').remove()
         try:
             del self._request.cfg.cache.name2id
         except:
--- a/MoinMoin/userform/admin.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/userform/admin.py	Mon Mar 03 02:02:55 2008 +0100
@@ -7,7 +7,7 @@
                 2007 MoinMoin:ReimarBauer
     @license: GNU GPL, see COPYING for details.
 """
-from MoinMoin import user, wikidicts, wikiutil
+from MoinMoin import user, wikiutil
 from MoinMoin.util.dataset import TupleDataset, Column
 from MoinMoin.Page import Page
 
--- a/MoinMoin/userform/login.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/userform/login.py	Mon Mar 03 02:02:55 2008 +0100
@@ -7,7 +7,6 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin import wikiutil
 from MoinMoin.widget import html
 
 
--- a/MoinMoin/userprefs/changepass.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/userprefs/changepass.py	Mon Mar 03 02:02:55 2008 +0100
@@ -8,8 +8,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import time
-from MoinMoin import user, wikiutil
+from MoinMoin import user
 from MoinMoin.widget import html
 from MoinMoin.userprefs import UserPrefBase
 
--- a/MoinMoin/userprefs/notification.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/userprefs/notification.py	Mon Mar 03 02:02:55 2008 +0100
@@ -8,8 +8,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import time
-from MoinMoin import user, util, wikiutil, events
+from MoinMoin import events
 from MoinMoin.widget import html
 from MoinMoin.userprefs import UserPrefBase
 
--- a/MoinMoin/wikidicts.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/wikidicts.py	Mon Mar 03 02:02:55 2008 +0100
@@ -8,9 +8,7 @@
 """
 import re, time
 
-from MoinMoin import caching, wikiutil, Page, logfile
-from MoinMoin.logfile.editlog import EditLog
-
+from MoinMoin import caching, Page
 
 # Version of the internal data structure which is pickled.
 # Please increment if you have changed the structure.
--- a/MoinMoin/xmlrpc/__init__.py	Sun Mar 02 20:37:49 2008 +0100
+++ b/MoinMoin/xmlrpc/__init__.py	Mon Mar 03 02:02:55 2008 +0100
@@ -565,7 +565,6 @@
         if not self.request.user.may.write(pagename):
             return xmlrpclib.Fault(1, "You are not allowed to edit this page")
 
-        from MoinMoin.PageEditor import PageEditor
         rev = int(self._instr(revision))
         editor = PageEditor(self.request, pagename)