Changeset - 956c557749cf
[Not reviewed]
default
0 4 0
Mads Kiilerich - 10 years ago 2015-08-17 01:11:42
madski@unity3d.com
cleanup: fix some risky variable redefinitions

Found with pyflakes.
4 files changed with 28 insertions and 28 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -339,7 +339,7 @@ class PullrequestsController(BaseRepoCon
 
                                              )
 
        if ancestor_rev is None:
 
            ancestor_rev = org_repo.scm_instance.EMPTY_CHANGESET
 
        revisions = [cs.raw_id for cs in cs_ranges]
 
        revisions = [cs_.raw_id for cs_ in cs_ranges]
 

	
 
        # hack: ancestor_rev is not an other_rev but we want to show the
 
        # requested destination and have the exact ancestor
kallithea/lib/helpers.py
Show inline comments
 
@@ -87,11 +87,11 @@ def canonical_hostname():
 
        parts = url('home', qualified=True).split('://', 1)
 
        return parts[1].split('/', 1)[0]
 

	
 
def html_escape(text):
 
def html_escape(s):
 
    """Return string with all html escaped.
 
    This is also safe for javascript in html but not necessarily correct.
 
    """
 
    return (text
 
    return (s
 
        .replace('&', '&')
 
        .replace(">", ">")
 
        .replace("<", "&lt;")
 
@@ -99,11 +99,11 @@ def html_escape(text):
 
        .replace("'", "&apos;")
 
        )
 

	
 
def shorter(text, size=20):
 
def shorter(s, size=20):
 
    postfix = '...'
 
    if len(text) > size:
 
        return text[:size - len(postfix)] + postfix
 
    return text
 
    if len(s) > size:
 
        return s[:size - len(postfix)] + postfix
 
    return s
 

	
 

	
 
def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
 
@@ -601,8 +601,8 @@ def action_parser(user_log, feed=False, 
 

	
 
        def lnk(rev, repo_name):
 
            lazy_cs = False
 
            title = None
 
            _url = '#'
 
            title_ = None
 
            url_ = '#'
 
            if isinstance(rev, BaseChangeset) or isinstance(rev, AttributeDict):
 
                if rev.op and rev.ref_name:
 
                    if rev.op == 'delete_branch':
 
@@ -614,15 +614,15 @@ def action_parser(user_log, feed=False, 
 
                else:
 
                    lazy_cs = True
 
                    lbl = rev.short_id[:8]
 
                    _url = url('changeset_home', repo_name=repo_name,
 
                    url_ = url('changeset_home', repo_name=repo_name,
 
                               revision=rev.raw_id)
 
            else:
 
                # changeset cannot be found - it might have been stripped or removed
 
                lbl = rev[:12]
 
                title = _('Changeset not found')
 
                title_ = _('Changeset not found')
 
            if parse_cs:
 
                return link_to(lbl, _url, title=title, class_='tooltip')
 
            return link_to(lbl, _url, raw_id=rev.raw_id, repo_name=repo_name,
 
                return link_to(lbl, url_, title=title_, class_='tooltip')
 
            return link_to(lbl, url_, raw_id=rev.raw_id, repo_name=repo_name,
 
                           class_='lazy-cs' if lazy_cs else '')
 

	
 
        def _get_op(rev_txt):
 
@@ -718,8 +718,8 @@ def action_parser(user_log, feed=False, 
 

	
 
    def get_fork_name():
 
        repo_name = action_params
 
        _url = url('summary_home', repo_name=repo_name)
 
        return _('Fork name %s') % link_to(action_params, _url)
 
        url_ = url('summary_home', repo_name=repo_name)
 
        return _('Fork name %s') % link_to(action_params, url_)
 

	
 
    def get_user_name():
 
        user_name = action_params
 
@@ -938,31 +938,31 @@ class Page(_Page):
 
        # and the currently displayed page range
 
        if leftmost_page - self.first_page > 1:
 
            # Wrap in a SPAN tag if nolink_attr is set
 
            text = '..'
 
            text_ = '..'
 
            if self.dotdot_attr:
 
                text = HTML.span(c=text, **self.dotdot_attr)
 
            nav_items.append(text)
 
                text_ = HTML.span(c=text_, **self.dotdot_attr)
 
            nav_items.append(text_)
 

	
 
        for thispage in xrange(leftmost_page, rightmost_page + 1):
 
            # Highlight the current page number and do not use a link
 
            text = str(thispage)
 
            text_ = str(thispage)
 
            if thispage == self.page:
 
                # 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)
 
                    text_ = HTML.span(c=text_, **self.curpage_attr)
 
                nav_items.append(text_)
 
            # Otherwise create just a link to that page
 
            else:
 
                nav_items.append(self._pagerlink(thispage, text))
 
                nav_items.append(self._pagerlink(thispage, text_))
 

	
 
        # Insert dots if there are pages between the displayed
 
        # page numbers and the end of the page range
 
        if self.last_page - rightmost_page > 1:
 
            text = '..'
 
            text_ = '..'
 
            # Wrap in a SPAN tag if nolink_attr is set
 
            if self.dotdot_attr:
 
                text = HTML.span(c=text, **self.dotdot_attr)
 
            nav_items.append(text)
 
                text_ = HTML.span(c=text_, **self.dotdot_attr)
 
            nav_items.append(text_)
 

	
 
        # Create a link to the very last page (unless we are on the last
 
        # page or there would be no need to insert '..' spacers)
kallithea/lib/paster_commands/cleanup.py
Show inline comments
 
@@ -86,7 +86,7 @@ class Command(BasePasterCommand):
 

	
 
        repos_location = Ui.get_repos_location()
 
        to_remove = []
 
        for dn, dirs, f in os.walk(safe_str(repos_location)):
 
        for dn_, dirs, f in os.walk(safe_str(repos_location)):
 
            alldirs = list(dirs)
 
            del dirs[:]
 
            if ('.hg' in alldirs or
 
@@ -94,7 +94,7 @@ class Command(BasePasterCommand):
 
                continue
 
            for loc in alldirs:
 
                if REMOVED_REPO_PAT.match(loc):
 
                    to_remove.append([os.path.join(dn, loc),
 
                    to_remove.append([os.path.join(dn_, loc),
 
                                      self._extract_date(loc)])
 
                else:
 
                    dirs.append(loc)
kallithea/tests/api/api_base.py
Show inline comments
 
@@ -2146,7 +2146,7 @@ class _BaseTestApi(object):
 
        self._compare_error(id_, expected, given=response.body)
 

	
 
    @mock.patch.object(RepoGroupModel, 'grant_user_group_permission', crash)
 
    def test_api_grant_user_group_permission_exception_when_adding(self):
 
    def test_api_grant_user_group_permission_exception_when_adding_to_repo_group(self):
 
        perm = 'group.read'
 
        id_, params = _build_data(self.apikey,
 
                                  'grant_user_group_permission_to_repo_group',
0 comments (0 inline, 0 general)