# HG changeset patch # User Mads Kiilerich # Date 1577333829 -3600 # Node ID bdb79ef2c879aac4cf18bfff5c87fdfad16723ef # Parent c7d1efd3ca3fc341e3b85b8a5cfe2e897b850432 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. diff -r c7d1efd3ca3f -r bdb79ef2c879 kallithea/controllers/changelog.py --- a/kallithea/controllers/changelog.py Thu Dec 26 04:02:48 2019 +0100 +++ b/kallithea/controllers/changelog.py Thu Dec 26 05:17:09 2019 +0100 @@ -134,11 +134,11 @@ 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] diff -r c7d1efd3ca3f -r bdb79ef2c879 kallithea/lib/indexers/daemon.py --- a/kallithea/lib/indexers/daemon.py Thu Dec 26 04:02:48 2019 +0100 +++ b/kallithea/lib/indexers/daemon.py Thu Dec 26 05:17:09 2019 +0100 @@ -331,8 +331,8 @@ 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 @@ -432,7 +432,7 @@ 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) diff -r c7d1efd3ca3f -r bdb79ef2c879 kallithea/lib/vcs/backends/__init__.py --- a/kallithea/lib/vcs/backends/__init__.py Thu Dec 26 04:02:48 2019 +0100 +++ b/kallithea/lib/vcs/backends/__init__.py Thu Dec 26 05:17:09 2019 +0100 @@ -9,7 +9,6 @@ :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 @@ -51,7 +50,7 @@ """ 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 diff -r c7d1efd3ca3f -r bdb79ef2c879 kallithea/lib/vcs/utils/termcolors.py --- a/kallithea/lib/vcs/utils/termcolors.py Thu Dec 26 04:02:48 2019 +0100 +++ b/kallithea/lib/vcs/utils/termcolors.py Thu Dec 26 05:17:09 2019 +0100 @@ -188,7 +188,7 @@ 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 diff -r c7d1efd3ca3f -r bdb79ef2c879 kallithea/model/db.py --- a/kallithea/model/db.py Thu Dec 26 04:02:48 2019 +0100 +++ b/kallithea/model/db.py Thu Dec 26 05:17:09 2019 +0100 @@ -74,6 +74,7 @@ @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): diff -r c7d1efd3ca3f -r bdb79ef2c879 kallithea/model/notification.py --- a/kallithea/model/notification.py Thu Dec 26 04:02:48 2019 +0100 +++ b/kallithea/model/notification.py Thu Dec 26 05:17:09 2019 +0100 @@ -177,7 +177,7 @@ 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 diff -r c7d1efd3ca3f -r bdb79ef2c879 kallithea/templates/base/perms_summary.html --- a/kallithea/templates/base/perms_summary.html Thu Dec 26 04:02:48 2019 +0100 +++ b/kallithea/templates/base/perms_summary.html Thu Dec 26 05:17:09 2019 +0100 @@ -5,7 +5,7 @@ <%def name="perms_summary(permissions, show_all=False, actions=True)">
- %for section in sorted(permissions.keys()): + %for section in sorted(permissions):

${section.replace("_"," ").capitalize()}

%if section != 'global':