Changeset - bdb79ef2c879
[Not reviewed]
default
0 7 0
Mads Kiilerich - 6 years ago 2019-12-26 05:17:09
mads@kiilerich.com
Grafted from: ca11709d4a95
py3: drop .keys when we don't need them

In python 3 they will be iterators and mostly useless ... but they are already
mostly redundant in py2.
7 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/changelog.py
Show inline comments
 
@@ -131,17 +131,17 @@ class ChangelogController(BaseRepoContro
 
            log.error(traceback.format_exc())
 
            h.flash(e, category='error')
 
            raise HTTPFound(location=url('changelog_home', repo_name=c.repo_name))
 

	
 
        c.branch_name = branch_name
 
        c.branch_filters = [('', _('None'))] + \
 
            [(k, k) for k in c.db_repo_scm_instance.branches.keys()]
 
            [(k, k) for k in c.db_repo_scm_instance.branches]
 
        if c.db_repo_scm_instance.closed_branches:
 
            prefix = _('(closed)') + ' '
 
            c.branch_filters += [('-', '-')] + \
 
                [(k, prefix + k) for k in c.db_repo_scm_instance.closed_branches.keys()]
 
                [(k, prefix + k) for k in c.db_repo_scm_instance.closed_branches]
 
        revs = []
 
        if not f_path:
 
            revs = [x.revision for x in c.cs_pagination]
 
        c.jsdata = graph_data(c.db_repo_scm_instance, revs)
 

	
 
        c.revision = revision # requested revision ref
kallithea/lib/indexers/daemon.py
Show inline comments
 
@@ -328,14 +328,14 @@ class WhooshIndexingDaemon(object):
 
                    writer.commit(merge=True)
 
                    log.debug('>>> FINISHED REBUILDING CHANGESET INDEX <<<')
 
                else:
 
                    log.debug('>> NOTHING TO COMMIT TO CHANGESET INDEX<<')
 

	
 
    def update_file_index(self):
 
        log.debug((u'STARTING INCREMENTAL INDEXING UPDATE FOR EXTENSIONS %s '
 
                   'AND REPOS %s') % (INDEX_EXTENSIONS, self.repo_paths.keys()))
 
        log.debug(u'STARTING INCREMENTAL INDEXING UPDATE FOR EXTENSIONS %s '
 
                  'AND REPOS %s', INDEX_EXTENSIONS, ' and '.join(self.repo_paths))
 

	
 
        idx = open_dir(self.index_location, indexname=self.indexname)
 
        # The set of all paths in the index
 
        indexed_paths = set()
 
        # The set of all paths we need to re-index
 
        to_index = set()
 
@@ -429,13 +429,13 @@ class WhooshIndexingDaemon(object):
 
                               indexname=CHGSET_IDX_NAME)
 
        chgset_idx_writer = chgset_idx.writer()
 

	
 
        file_idx = create_in(self.index_location, SCHEMA, indexname=IDX_NAME)
 
        file_idx_writer = file_idx.writer()
 
        log.debug('BUILDING INDEX FOR EXTENSIONS %s '
 
                  'AND REPOS %s' % (INDEX_EXTENSIONS, self.repo_paths.keys()))
 
                  'AND REPOS %s', INDEX_EXTENSIONS, ' and '.join(self.repo_paths))
 

	
 
        for repo_name, repo in sorted(self.repo_paths.items()):
 
            log.debug('Updating indices for repo %s', repo_name)
 
            # skip indexing if there aren't any revisions
 
            if len(repo) < 1:
 
                continue
kallithea/lib/vcs/backends/__init__.py
Show inline comments
 
@@ -6,13 +6,12 @@
 
    Main package for scm backends
 

	
 
    :created_on: Apr 8, 2010
 
    :copyright: (c) 2010-2011 by Marcin Kuzminski, Lukasz Balcerzak.
 
"""
 
import os
 
from pprint import pformat
 

	
 
from kallithea.lib.vcs.conf import settings
 
from kallithea.lib.vcs.exceptions import VCSError
 
from kallithea.lib.vcs.utils.helpers import get_scm
 
from kallithea.lib.vcs.utils.imports import import_class
 
from kallithea.lib.vcs.utils.paths import abspath
 
@@ -48,13 +47,13 @@ def get_backend(alias):
 
    """
 
    Returns ``Repository`` class identified by the given alias or raises
 
    VCSError if alias is not recognized or backend class cannot be imported.
 
    """
 
    if alias not in settings.BACKENDS:
 
        raise VCSError("Given alias '%s' is not recognized! Allowed aliases:\n"
 
            "%s" % (alias, pformat(settings.BACKENDS.keys())))
 
            "%s" % (alias, '", "'.join(settings.BACKENDS)))
 
    backend_path = settings.BACKENDS[alias]
 
    klass = import_class(backend_path)
 
    return klass
 

	
 

	
 
def get_supported_backends():
kallithea/lib/vcs/utils/termcolors.py
Show inline comments
 
@@ -185,13 +185,13 @@ def parse_color_setting(config_string):
 
            if fg in color_names:
 
                definition['fg'] = fg
 
            if colors and colors[-1] in color_names:
 
                definition['bg'] = colors[-1]
 

	
 
            # All remaining instructions are options
 
            opts = tuple(s for s in styles if s in opt_dict.keys())
 
            opts = tuple(s for s in styles if s in opt_dict)
 
            if opts:
 
                definition['opts'] = opts
 

	
 
            # The nocolor palette has all available roles.
 
            # Use that palette as the basis for determining
 
            # if the role is valid.
kallithea/model/db.py
Show inline comments
 
@@ -71,12 +71,13 @@ class BaseDbModel(object):
 
    Base Model for all classes
 
    """
 

	
 
    @classmethod
 
    def _get_keys(cls):
 
        """return column names for this model """
 
        # Note: not a normal dict - iterator gives "users.firstname", but keys gives "firstname"
 
        return class_mapper(cls).c.keys()
 

	
 
    def get_dict(self):
 
        """
 
        return dict with keys and values corresponding
 
        to this model data """
kallithea/model/notification.py
Show inline comments
 
@@ -174,13 +174,13 @@ class EmailNotificationModel(object):
 
        return subject for email based on given type
 
        """
 
        tmpl = self._subj_map[type_]
 
        try:
 
            subj = tmpl % kwargs
 
        except KeyError as e:
 
            log.error('error generating email subject for %r from %s: %s', type_, ','.join(self._subj_map.keys()), e)
 
            log.error('error generating email subject for %r from %s: %s', type_, ', '.join(self._subj_map), e)
 
            raise
 
        # gmail doesn't do proper threading but will ignore leading square
 
        # bracket content ... so that is where we put status info
 
        bracket_tags = []
 
        status_change = kwargs.get('status_change')
 
        if status_change:
kallithea/templates/base/perms_summary.html
Show inline comments
 
@@ -2,13 +2,13 @@
 
## usage:
 
##    <%namespace name="p" file="/base/perms_summary.html"/>
 
##    ${p.perms_summary(c.perm_user.permissions)}
 

	
 
<%def name="perms_summary(permissions, show_all=False, actions=True)">
 
<div id="perms">
 
     %for section in sorted(permissions.keys()):
 
     %for section in sorted(permissions):
 
        <div class="perms_section_head">
 
            <h4>${section.replace("_"," ").capitalize()}</h4>
 
            %if section != 'global':
 
              <div class="pull-right checkbox">
 
                ${_('Show')}:
 
                <label>${h.checkbox('perms_filter_none_%s' % section, 'none', 'checked', class_='perm_filter filter_%s' % section, **{'data-section':section, 'data-perm_type':'none'})}<span class="label label-none">${_('None')}</span></label>
0 comments (0 inline, 0 general)