diff --git a/kallithea/bin/kallithea_cli_repo.py b/kallithea/bin/kallithea_cli_repo.py --- a/kallithea/bin/kallithea_cli_repo.py +++ b/kallithea/bin/kallithea_cli_repo.py @@ -110,7 +110,7 @@ def repo_purge_deleted(ask, older_than): return parts = parts.groupdict() time_params = {} - for (name, param) in parts.iteritems(): + for name, param in parts.items(): if param: time_params[name] = int(param) return datetime.timedelta(**time_params) diff --git a/kallithea/controllers/admin/defaults.py b/kallithea/controllers/admin/defaults.py --- a/kallithea/controllers/admin/defaults.py +++ b/kallithea/controllers/admin/defaults.py @@ -68,7 +68,7 @@ class DefaultsController(BaseController) try: form_result = _form.to_python(dict(request.POST)) - for k, v in form_result.iteritems(): + for k, v in form_result.items(): setting = Setting.create_or_update(k, v) Session().commit() h.flash(_('Default settings updated successfully'), diff --git a/kallithea/controllers/admin/settings.py b/kallithea/controllers/admin/settings.py --- a/kallithea/controllers/admin/settings.py +++ b/kallithea/controllers/admin/settings.py @@ -423,7 +423,7 @@ class SettingsController(BaseController) import kallithea c.ini = kallithea.CONFIG server_info = Setting.get_server_info() - for key, val in server_info.iteritems(): + for key, val in server_info.items(): setattr(c, key, val) return htmlfill.render( diff --git a/kallithea/controllers/api/__init__.py b/kallithea/controllers/api/__init__.py --- a/kallithea/controllers/api/__init__.py +++ b/kallithea/controllers/api/__init__.py @@ -180,7 +180,7 @@ class JSONRPCController(TGController): USER_SESSION_ATTR = 'apiuser' # get our arglist and check if we provided them as args - for arg, default in func_kwargs.iteritems(): + for arg, default in func_kwargs.items(): if arg == USER_SESSION_ATTR: # USER_SESSION_ATTR is something translated from API key and # this is checked before so we don't need validate it diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -109,7 +109,7 @@ class PullrequestsController(BaseRepoCon tipbranch = None branches = [] - for abranch, branchrev in repo.branches.iteritems(): + for abranch, branchrev in repo.branches.items(): n = 'branch:%s:%s' % (abranch, branchrev) desc = abranch if branchrev == tiprev: @@ -133,14 +133,14 @@ class PullrequestsController(BaseRepoCon log.debug('branch %r not found in %s', branch, repo) bookmarks = [] - for bookmark, bookmarkrev in repo.bookmarks.iteritems(): + for bookmark, bookmarkrev in repo.bookmarks.items(): n = 'book:%s:%s' % (bookmark, bookmarkrev) bookmarks.append((n, bookmark)) if rev == bookmarkrev: selected = n tags = [] - for tag, tagrev in repo.tags.iteritems(): + for tag, tagrev in repo.tags.items(): if tag == 'tip': continue n = 'tag:%s:%s' % (tag, tagrev) diff --git a/kallithea/lib/auth.py b/kallithea/lib/auth.py --- a/kallithea/lib/auth.py +++ b/kallithea/lib/auth.py @@ -442,7 +442,7 @@ class AuthUser(object): self.is_default_user = False else: # copy non-confidential database fields from a `db.User` to this `AuthUser`. - for k, v in dbuser.get_dict().iteritems(): + for k, v in dbuser.get_dict().items(): assert k not in ['api_keys', 'permissions'] setattr(self, k, v) self.is_default_user = dbuser.is_default_user @@ -525,7 +525,7 @@ class AuthUser(object): """ Returns list of repositories you're an admin of """ - return [x[0] for x in self.permissions['repositories'].iteritems() + return [x[0] for x in self.permissions['repositories'].items() if x[1] == 'repository.admin'] @property @@ -533,7 +533,7 @@ class AuthUser(object): """ Returns list of repository groups you're an admin of """ - return [x[0] for x in self.permissions['repositories_groups'].iteritems() + return [x[0] for x in self.permissions['repositories_groups'].items() if x[1] == 'group.admin'] @property @@ -541,7 +541,7 @@ class AuthUser(object): """ Returns list of user groups you're an admin of """ - return [x[0] for x in self.permissions['user_groups'].iteritems() + return [x[0] for x in self.permissions['user_groups'].items() if x[1] == 'usergroup.admin'] def __repr__(self): diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py --- a/kallithea/lib/diffs.py +++ b/kallithea/lib/diffs.py @@ -397,7 +397,7 @@ class DiffProcessor(object): 'new_lineno': '', 'action': 'context', 'line': msg, - } for _op, msg in stats['ops'].iteritems() + } for _op, msg in stats['ops'].items() if _op not in [MOD_FILENODE]]) _files.append({ diff --git a/kallithea/lib/markup_renderer.py b/kallithea/lib/markup_renderer.py --- a/kallithea/lib/markup_renderer.py +++ b/kallithea/lib/markup_renderer.py @@ -219,7 +219,7 @@ class MarkupRenderer(object): docutils_settings.update({'input_encoding': 'unicode', 'report_level': 4}) - for k, v in docutils_settings.iteritems(): + for k, v in docutils_settings.items(): directives.register_directive(k, v) parts = publish_parts(source=source, diff --git a/kallithea/lib/vcs/backends/git/changeset.py b/kallithea/lib/vcs/backends/git/changeset.py --- a/kallithea/lib/vcs/backends/git/changeset.py +++ b/kallithea/lib/vcs/backends/git/changeset.py @@ -79,7 +79,7 @@ class GitChangeset(BaseChangeset): @LazyProperty def tags(self): _tags = [] - for tname, tsha in self.repository.tags.iteritems(): + for tname, tsha in self.repository.tags.items(): if tsha == self.raw_id: _tags.append(tname) return _tags @@ -123,7 +123,7 @@ class GitChangeset(BaseChangeset): curdir = '' # initially extract things from root dir - for item, stat, id in tree.iteritems(): + for item, stat, id in tree.items(): if curdir: name = '/'.join((curdir, item)) else: @@ -137,7 +137,7 @@ class GitChangeset(BaseChangeset): else: curdir = dir dir_id = None - for item, stat, id in tree.iteritems(): + for item, stat, id in tree.items(): if dir == item: dir_id = id if dir_id: @@ -149,7 +149,7 @@ class GitChangeset(BaseChangeset): raise ChangesetError('%s have not been found' % curdir) # cache all items from the given traversed tree - for item, stat, id in tree.iteritems(): + for item, stat, id in tree.items(): if curdir: name = '/'.join((curdir, item)) else: @@ -407,7 +407,7 @@ class GitChangeset(BaseChangeset): dirnodes = [] filenodes = [] als = self.repository.alias - for name, stat, id in tree.iteritems(): + for name, stat, id in tree.items(): if path != '': obj_path = '/'.join((path, name)) else: diff --git a/kallithea/lib/vcs/backends/git/inmemory.py b/kallithea/lib/vcs/backends/git/inmemory.py --- a/kallithea/lib/vcs/backends/git/inmemory.py +++ b/kallithea/lib/vcs/backends/git/inmemory.py @@ -172,7 +172,7 @@ class GitInMemoryChangeset(BaseInMemoryC return [] def get_tree_for_dir(tree, dirname): - for name, mode, id in tree.iteritems(): + for name, mode, id in tree.items(): if name == dirname: obj = self.repository._repo[id] if isinstance(obj, objects.Tree): diff --git a/kallithea/lib/vcs/backends/git/repository.py b/kallithea/lib/vcs/backends/git/repository.py --- a/kallithea/lib/vcs/backends/git/repository.py +++ b/kallithea/lib/vcs/backends/git/repository.py @@ -252,7 +252,7 @@ class GitRepository(BaseRepository): def _get_all_revisions2(self): # alternate implementation using dulwich - includes = [ascii_str(sha) for key, (sha, type_) in self._parsed_refs.iteritems() + includes = [ascii_str(sha) for key, (sha, type_) in self._parsed_refs.items() if type_ != b'T'] return [c.commit.id for c in self._repo.get_walker(include=includes)] @@ -360,7 +360,7 @@ class GitRepository(BaseRepository): return {} sortkey = lambda ctx: ctx[0] _branches = [(key, ascii_str(sha)) - for key, (sha, type_) in self._parsed_refs.iteritems() if type_ == b'H'] + for key, (sha, type_) in self._parsed_refs.items() if type_ == b'H'] return OrderedDict(sorted(_branches, key=sortkey, reverse=False)) @LazyProperty @@ -377,7 +377,7 @@ class GitRepository(BaseRepository): sortkey = lambda ctx: ctx[0] _tags = [(key, ascii_str(sha)) - for key, (sha, type_) in self._parsed_refs.iteritems() if type_ == b'T'] + for key, (sha, type_) in self._parsed_refs.items() if type_ == b'T'] return OrderedDict(sorted(_tags, key=sortkey, reverse=True)) def tag(self, name, user, revision=None, message=None, date=None, @@ -447,7 +447,7 @@ class GitRepository(BaseRepository): (b'refs/remotes/origin/', b'RH'), (b'refs/tags/', b'T')] _refs = {} - for ref, sha in refs.iteritems(): + for ref, sha in refs.items(): for k, type_ in keys: if ref.startswith(k): _key = ref[len(k):] @@ -470,7 +470,7 @@ class GitRepository(BaseRepository): if n not in [b'HEAD']: heads[n] = val - return heads if reverse else dict((y, x) for x, y in heads.iteritems()) + return heads if reverse else dict((y, x) for x, y in heads.items()) def get_changeset(self, revision=None): """ diff --git a/kallithea/lib/vcs/backends/hg/changeset.py b/kallithea/lib/vcs/backends/hg/changeset.py --- a/kallithea/lib/vcs/backends/hg/changeset.py +++ b/kallithea/lib/vcs/backends/hg/changeset.py @@ -340,7 +340,7 @@ class MercurialChangeset(BaseChangeset): if os.path.dirname(d) == path] als = self.repository.alias - for k, vals in self._extract_submodules().iteritems(): + for k, vals in self._extract_submodules().items(): #vals = url,rev,type loc = vals[0] cs = vals[1] diff --git a/kallithea/lib/vcs/utils/progressbar.py b/kallithea/lib/vcs/utils/progressbar.py --- a/kallithea/lib/vcs/utils/progressbar.py +++ b/kallithea/lib/vcs/utils/progressbar.py @@ -215,7 +215,7 @@ def colorize(text='', opts=(), **kwargs) code_list = [] if text == '' and len(opts) == 1 and opts[0] == 'reset': return '\x1b[%sm' % RESET - for k, v in kwargs.iteritems(): + for k, v in kwargs.items(): if k == 'fg': code_list.append(foreground[v]) elif k == 'bg': diff --git a/kallithea/lib/vcs/utils/termcolors.py b/kallithea/lib/vcs/utils/termcolors.py --- a/kallithea/lib/vcs/utils/termcolors.py +++ b/kallithea/lib/vcs/utils/termcolors.py @@ -44,7 +44,7 @@ def colorize(text='', opts=(), **kwargs) code_list = [] if text == '' and len(opts) == 1 and opts[0] == 'reset': return '\x1b[%sm' % RESET - for k, v in kwargs.iteritems(): + for k, v in kwargs.items(): if k == 'fg': code_list.append(foreground[v]) elif k == 'bg': diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -94,7 +94,7 @@ class BaseDbModel(object): # update with attributes from __json__ if callable(_json_attr): _json_attr = _json_attr() - for k, val in _json_attr.iteritems(): + for k, val in _json_attr.items(): d[k] = val return d diff --git a/kallithea/model/scm.py b/kallithea/model/scm.py --- a/kallithea/model/scm.py +++ b/kallithea/model/scm.py @@ -671,18 +671,18 @@ class ScmModel(object): repo = repo.scm_instance branches_group = ([(u'branch:%s' % k, k) for k, v in - repo.branches.iteritems()], _("Branches")) + repo.branches.items()], _("Branches")) hist_l.append(branches_group) choices.extend([x[0] for x in branches_group[0]]) if repo.alias == 'hg': bookmarks_group = ([(u'book:%s' % k, k) for k, v in - repo.bookmarks.iteritems()], _("Bookmarks")) + repo.bookmarks.items()], _("Bookmarks")) hist_l.append(bookmarks_group) choices.extend([x[0] for x in bookmarks_group[0]]) tags_group = ([(u'tag:%s' % k, k) for k, v in - repo.tags.iteritems()], _("Tags")) + repo.tags.items()], _("Tags")) hist_l.append(tags_group) choices.extend([x[0] for x in tags_group[0]]) diff --git a/kallithea/model/validators.py b/kallithea/model/validators.py --- a/kallithea/model/validators.py +++ b/kallithea/model/validators.py @@ -544,7 +544,7 @@ def ValidPerms(type_='repo'): # CLEAN OUT ORG VALUE FROM NEW MEMBERS, and group them using new_perms_group = defaultdict(dict) - for k, v in value.copy().iteritems(): + for k, v in value.copy().items(): if k.startswith('perm_new_member'): del value[k] _type, part = k.split('perm_new_member_') @@ -564,7 +564,7 @@ def ValidPerms(type_='repo'): if new_member and new_perm and new_type: perms_new.add((new_member, new_perm, new_type)) - for k, v in value.iteritems(): + for k, v in value.items(): if k.startswith('u_perm_') or k.startswith('g_perm_'): member = k[7:] t = {'u': 'user', diff --git a/kallithea/templates/changeset/changeset_file_comment.html b/kallithea/templates/changeset/changeset_file_comment.html --- a/kallithea/templates/changeset/changeset_file_comment.html +++ b/kallithea/templates/changeset/changeset_file_comment.html @@ -163,7 +163,7 @@ ## original location of comments ... but the ones outside diff context remains here