changeset 5305:72e0fe2e3278

cleanup: remove unnecessary '%s'%s formatting
author Mads Kiilerich <madski@unity3d.com>
date Fri, 24 Jul 2015 16:37:40 +0200
parents 975f5769be08
children 63bed817308c
files kallithea/__init__.py kallithea/controllers/feed.py kallithea/lib/diffs.py kallithea/lib/helpers.py kallithea/lib/ipaddr.py kallithea/lib/pidlock.py kallithea/lib/vcs/subprocessio.py kallithea/lib/vcs/utils/diffs.py kallithea/model/comment.py kallithea/tests/functional/test_my_account.py
diffstat 10 files changed, 15 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/__init__.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/__init__.py	Fri Jul 24 16:37:40 2015 +0200
@@ -71,7 +71,7 @@
     from kallithea.lib import get_current_revision
     _rev = get_current_revision(quiet=True)
     if _rev and len(VERSION) > 3:
-        VERSION += ('%s' % _rev[0],)
+        VERSION += (_rev[0],)
 except ImportError:
     pass
 
--- a/kallithea/controllers/feed.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/controllers/feed.py	Fri Jul 24 16:37:40 2015 +0200
@@ -65,9 +65,7 @@
         self.feed_diff_limit = safe_int(CONF.get('rss_cut_off_limit', 32 * 1024))
 
     def _get_title(self, cs):
-        return "%s" % (
-            h.shorter(cs.message, 160)
-        )
+        return h.shorter(cs.message, 160)
 
     def __changes(self, cs):
         changes = []
--- a/kallithea/lib/diffs.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/lib/diffs.py	Fri Jul 24 16:37:40 2015 +0200
@@ -618,7 +618,7 @@
 
         """
         # Transform all whitespace to underscore
-        idstring = re.sub(r'\s', "_", '%s' % idstring)
+        idstring = re.sub(r'\s', "_", idstring)
         # Remove everything that is not a hyphen or a member of \w
         idstring = re.sub(r'(?!-)\W', "", idstring).lower()
         return idstring
--- a/kallithea/lib/helpers.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/lib/helpers.py	Fri Jul 24 16:37:40 2015 +0200
@@ -446,7 +446,7 @@
     if show_rev:
         return 'r%s:%s' % (cs.revision, raw_id)
     else:
-        return '%s' % (raw_id)
+        return raw_id
 
 
 def fmt_date(date):
@@ -606,9 +606,9 @@
             if isinstance(rev, BaseChangeset) or isinstance(rev, AttributeDict):
                 if rev.op and rev.ref_name:
                     if rev.op == 'delete_branch':
-                        lbl = '%s' % _('Deleted branch: %s') % rev.ref_name
+                        lbl = _('Deleted branch: %s') % rev.ref_name
                     elif rev.op == 'tag':
-                        lbl = '%s' % _('Created tag: %s') % rev.ref_name
+                        lbl = _('Created tag: %s') % rev.ref_name
                     else:
                         lbl = 'Unknown operation %s' % rev.op
                 else:
@@ -618,7 +618,7 @@
                                revision=rev.raw_id)
             else:
                 # changeset cannot be found - it might have been stripped or removed
-                lbl = ('%s' % rev)[:12]
+                lbl = rev[:12]
                 title = _('Changeset not found')
             if parse_cs:
                 return link_to(lbl, _url, title=title, class_='tooltip')
@@ -945,15 +945,14 @@
 
         for thispage in xrange(leftmost_page, rightmost_page + 1):
             # Highlight the current page number and do not use a link
+            text = str(thispage)
             if thispage == self.page:
-                text = '%s' % (thispage,)
                 # Wrap in a SPAN tag if nolink_attr is set
                 if self.curpage_attr:
                     text = HTML.span(c=text, **self.curpage_attr)
                 nav_items.append(text)
             # Otherwise create just a link to that page
             else:
-                text = '%s' % (thispage,)
                 nav_items.append(self._pagerlink(thispage, text))
 
         # Insert dots if there are pages between the displayed
@@ -1337,7 +1336,7 @@
                   % (pattern_index, ISSUE_PATTERN, ISSUE_SERVER_LNK,
                      ISSUE_PREFIX))
 
-        URL_PAT = re.compile(r'%s' % ISSUE_PATTERN)
+        URL_PAT = re.compile(ISSUE_PATTERN)
 
         def url_func(match_obj):
             pref = ''
--- a/kallithea/lib/ipaddr.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/lib/ipaddr.py	Fri Jul 24 16:37:40 2015 +0200
@@ -514,7 +514,7 @@
         return '%s(%r)' % (self.__class__.__name__, str(self))
 
     def __str__(self):
-        return  '%s' % self._string_from_ip_int(self._ip)
+        return self._string_from_ip_int(self._ip)
 
     def __hash__(self):
         return hash(hex(long(self._ip)))
--- a/kallithea/lib/pidlock.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/lib/pidlock.py	Fri Jul 24 16:37:40 2015 +0200
@@ -62,7 +62,7 @@
         locking function, if lock is present it
         will raise LockHeld exception
         """
-        lockname = '%s' % (os.getpid())
+        lockname = str(os.getpid())
         if self.debug:
             print 'running lock'
         self.trylock()
--- a/kallithea/lib/vcs/subprocessio.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/lib/vcs/subprocessio.py	Fri Jul 24 16:37:40 2015 +0200
@@ -395,7 +395,7 @@
 
     def next(self):
         if self.process and self.process.poll():
-            err = '%s' % ''.join(self.error)
+            err = ''.join(self.error)
             raise EnvironmentError("Subprocess exited due to an error:\n" + err)
         return self.output.next()
 
--- a/kallithea/lib/vcs/utils/diffs.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/lib/vcs/utils/diffs.py	Fri Jul 24 16:37:40 2015 +0200
@@ -356,7 +356,7 @@
 
         """
         # Transform all whitespace to underscore
-        idstring = re.sub(r'\s', "_", '%s' % idstring)
+        idstring = re.sub(r'\s', "_", idstring)
         # Remove everything that is not a hyphen or a member of \w
         idstring = re.sub(r'(?!-)\W', "", idstring).lower()
         return idstring
--- a/kallithea/model/comment.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/model/comment.py	Fri Jul 24 16:37:40 2015 +0200
@@ -75,7 +75,7 @@
         if revision:
             notification_type = Notification.TYPE_CHANGESET_COMMENT
             cs = repo.scm_instance.get_changeset(revision)
-            desc = "%s" % (cs.short_id)
+            desc = cs.short_id
 
             threading = ['%s-rev-%s@%s' % (repo.repo_name, revision, h.canonical_hostname())]
             if line_no: # TODO: url to file _and_ line number
--- a/kallithea/tests/functional/test_my_account.py	Fri Jul 24 16:37:40 2015 +0200
+++ b/kallithea/tests/functional/test_my_account.py	Fri Jul 24 16:37:40 2015 +0200
@@ -182,7 +182,7 @@
         msg = validators.ValidUsername(edit=False, old_data={})\
                 ._messages['username_exists']
         msg = h.html_escape(msg % {'username': TEST_USER_ADMIN_LOGIN})
-        response.mustcontain(u"%s" % msg)
+        response.mustcontain(msg)
 
     def test_my_account_api_keys(self):
         usr = self.log_user(TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS)