changeset 2009:093bdc2d6fe0

remove redundant parens, fix some minor bugs
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 17 Feb 2013 18:17:27 +0100
parents cb2ca948f94b
children e317d66d89b3
files MoinMoin/_tests/test_wikiutil.py MoinMoin/converter/html_out.py MoinMoin/converter/rst_in.py MoinMoin/mail/sendmail.py MoinMoin/themes/_tests/test_navi_bar.py MoinMoin/user.py MoinMoin/util/__init__.py MoinMoin/util/_tests/test_crypto.py MoinMoin/util/_tests/test_diff3.py MoinMoin/util/_tests/test_diff_text.py MoinMoin/util/_tests/test_util.py MoinMoin/util/diff3.py MoinMoin/util/paramparser.py
diffstat 13 files changed, 27 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/_tests/test_wikiutil.py	Sun Feb 17 18:17:27 2013 +0100
@@ -161,7 +161,7 @@
     # with no parent
     result = wikiutil.ParentItemName(u'itemname')
     expected = u''
-    assert result == expected, ('Expected "%(expected)s" but got "%(result)s"')
+    assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
     # with a parent
     result = wikiutil.ParentItemName(u'some/parent/itemname')
     expected = u'some/parent'
--- a/MoinMoin/converter/html_out.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/converter/html_out.py	Sun Feb 17 18:17:27 2013 +0100
@@ -622,7 +622,7 @@
                                          html.onclick_:
                                             "$('.moin-table-of-contents ol').toggle();return false;",
                                      },
-                                     children=[('[+]'), ])
+                                     children=['[+]', ])
                 elem_h = html.div(attrib={html.class_: 'moin-table-of-contents-heading'},
                                   children=[_('Contents'), headtogglelink])
                 elem.append(elem_h)
--- a/MoinMoin/converter/rst_in.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/converter/rst_in.py	Sun Feb 17 18:17:27 2013 +0100
@@ -619,7 +619,7 @@
 
 class Writer(writers.Writer):
 
-    supported = ('moin-x-document')
+    supported = ('moin-x-document', )
     config_section = 'MoinMoin writer'
     config_section_dependencies = ('writers', )
     output = None
--- a/MoinMoin/mail/sendmail.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/mail/sendmail.py	Sun Feb 17 18:17:27 2013 +0100
@@ -96,7 +96,7 @@
     logging.debug("send mail, to: {0!r}".format(to))
 
     if not to and not cc and not bcc:
-        return (1, _("No recipients, nothing to do"))
+        return 1, _("No recipients, nothing to do")
 
     subject = subject.encode(CHARSET)
 
@@ -167,7 +167,7 @@
                     pass
         except smtplib.SMTPException as e:
             logging.exception("smtp mail failed with an exception.")
-            return (0, str(e))
+            return 0, str(e)
         except (os.error, socket.error) as e:
             logging.exception("smtp mail failed with an exception.")
             return (0, _("Connection to mailserver '%(server)s' failed: %(reason)s",
@@ -183,13 +183,13 @@
             sendmail_status = sendmailp.close()
             if sendmail_status:
                 logging.error("sendmail failed with status: {0!s}".format(sendmail_status))
-                return (0, str(sendmail_status))
+                return 0, str(sendmail_status)
         except:
             logging.exception("sendmail failed with an exception.")
-            return (0, _("Mail not sent"))
+            return 0, _("Mail not sent")
 
     logging.debug("Mail sent successfully")
-    return (1, _("Mail sent successfully"))
+    return 1, _("Mail sent successfully")
 
 
 def encodeSpamSafeEmail(email_address, obfuscation_text=''):
--- a/MoinMoin/themes/_tests/test_navi_bar.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/themes/_tests/test_navi_bar.py	Sun Feb 17 18:17:27 2013 +0100
@@ -52,7 +52,7 @@
     def test_parent_item(self):
         test_result = ThemeSupport.parent_item(self.theme, 'moin/moin-2.0/Item')
         expected = 'moin/moin-2.0'
-        assert test_result == expected, ('Expected "%(expected)s" but got "%(test_result)s"') % locals()
+        assert test_result == expected, 'Expected "%(expected)s" but got "%(test_result)s"' % locals()
 
 
 def test_shorten_item_name():
--- a/MoinMoin/user.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/user.py	Sun Feb 17 18:17:27 2013 +0100
@@ -135,7 +135,7 @@
     if userid:
         userdata = User(userid)
         if userdata.mailto_author and userdata.email:
-            return ('email', userdata.email)
+            return 'email', userdata.email
         elif userdata.name:
             interwiki = getInterwikiHome(userdata.name0)
             if interwiki:
--- a/MoinMoin/util/__init__.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/util/__init__.py	Sun Feb 17 18:17:27 2013 +0100
@@ -117,4 +117,4 @@
     else:
         previous_offset = -1
     next_offset = count
-    return (selected_result, next_offset, previous_offset)
+    return selected_result, next_offset, previous_offset
--- a/MoinMoin/util/_tests/test_crypto.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/util/_tests/test_crypto.py	Sun Feb 17 18:17:27 2013 +0100
@@ -18,14 +18,14 @@
         length = 8
         result1 = crypto.random_string(length)
         result2 = crypto.random_string(length)
-        assert result1 != result2, ('Expected different random strings, but got "%(result1)s" and "%(result2)s"') % locals()
+        assert result1 != result2, 'Expected different random strings, but got "%(result1)s" and "%(result2)s"' % locals()
 
         result_string = crypto.random_string(length)
         assert isinstance(result_string, str), ('Expected an string value, but got ' + str(type(result_string)))
 
         result = len(crypto.random_string(length))
         expected = length
-        assert result == expected, ('Expected length "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected length "%(expected)s" but got "%(result)s"' % locals()
 
 
 class TestToken(object):
@@ -62,7 +62,7 @@
         result1 = crypto.cache_key(**test_kw1)
         test_kw2 = {'Moin2': 'value2'}
         result2 = crypto.cache_key(**test_kw2)
-        assert result1 != result2, ("Expected different keys for different <kw> but got the same")
+        assert result1 != result2, "Expected different keys for different <kw> but got the same"
 
 
 coverage_modules = ['MoinMoin.util.crypto']
--- a/MoinMoin/util/_tests/test_diff3.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/util/_tests/test_diff3.py	Sun Feb 17 18:17:27 2013 +0100
@@ -80,7 +80,7 @@
 AAA 014
 >>>>>>>>>>>>>>>>>>>>>>>>>
 """
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util.diff3']
--- a/MoinMoin/util/_tests/test_diff_text.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/util/_tests/test_diff_text.py	Sun Feb 17 18:17:27 2013 +0100
@@ -64,7 +64,7 @@
 - AAA 013
 - AAA 014"""
 
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util.diff_text']
--- a/MoinMoin/util/_tests/test_util.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/util/_tests/test_util.py	Sun Feb 17 18:17:27 2013 +0100
@@ -15,31 +15,31 @@
         """ util.rangelist: test correct function for misc. input values """
         result = util.rangelist([])
         expected = ''
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([42])
         expected = '42'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([42, 23])
         expected = '23,42'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([1, 2, 3, 4, 5])
         expected = '1-5'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 5, 3])
         expected = '2-3,5'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 3, 5, 6])
         expected = '2-3,5-6'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 3, 5, 6, 23, 100, 101, 102, 104])
         expected = '2-3,5-6,23,100-102,104'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util']
--- a/MoinMoin/util/diff3.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/util/diff3.py	Sun Feb 17 18:17:27 2013 +0100
@@ -135,7 +135,7 @@
             match_len = match(old, other, other_match[0], other_match[1],
                               difference)
             if match_len == difference:
-                return (new_match[0], other_match[1] + difference, new_match[1])
+                return new_match[0], other_match[1] + difference, new_match[1]
             else:
                 other_match = find_match(old, other,
                                          other_match[0] + match_len,
@@ -155,7 +155,7 @@
         # both conflicts change same number of lines
         # or no match till the end
         else:
-            return (new_match[0], other_match[1], new_match[1])
+            return new_match[0], other_match[1], new_match[1]
 
 
 def match(list1, list2, nr1, nr2, maxcount=3):
@@ -217,7 +217,7 @@
     elif hit2:
         return hit2
     else:
-        return (len1, len2)
+        return len1, len2
 
 
 def main():
--- a/MoinMoin/util/paramparser.py	Sun Feb 17 17:51:55 2013 +0100
+++ b/MoinMoin/util/paramparser.py	Sun Feb 17 18:17:27 2013 +0100
@@ -529,7 +529,7 @@
                 return ret
         if self._defaultunit is not None:
             try:
-                return (self._type(s), self._defaultunit)
+                return self._type(s), self._defaultunit
             except ValueError:
                 pass
         units = ', '.join(self._units)