##// END OF EJS Templates
py3: cleanup map usage and avoid py3 ambiguity...
Mads Kiilerich -
r7892:ce5d4c58 default
parent child Browse files
Show More
@@ -101,7 +101,7 b' def main(argv=None):'
101 101 parser.error('Please specify method name')
102 102
103 103 try:
104 margs = dict(map(lambda s: s.split(':', 1), other))
104 margs = dict(s.split(':', 1) for s in other)
105 105 except ValueError:
106 106 sys.stderr.write('Error parsing arguments \n')
107 107 sys.exit()
@@ -25,7 +25,6 b' Original author and date, and relevant c'
25 25 :license: GPLv3, see LICENSE.md for more details.
26 26 """
27 27
28 import itertools
29 28 import logging
30 29 import traceback
31 30
@@ -42,7 +41,7 b' from kallithea.config.routing import url'
42 41 from kallithea.lib import helpers as h
43 42 from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoGroupPermissionLevelDecorator, LoginRequired
44 43 from kallithea.lib.base import BaseController, render
45 from kallithea.lib.utils2 import safe_int
44 from kallithea.lib.utils2 import safe_int, safe_unicode
46 45 from kallithea.model.db import RepoGroup, Repository
47 46 from kallithea.model.forms import RepoGroupForm, RepoGroupPermsForm
48 47 from kallithea.model.meta import Session
@@ -120,9 +119,7 b' class RepoGroupsController(BaseControlle'
120 119 )
121 120
122 121 for repo_gr in group_iter:
123 children_groups = map(h.safe_unicode,
124 itertools.chain((g.name for g in repo_gr.parents),
125 (x.name for x in [repo_gr])))
122 children_groups = [safe_unicode(g.name) for g in repo_gr.parents] + [safe_unicode(repo_gr.name)]
126 123 repo_count = repo_gr.repositories.count()
127 124 repo_groups_data.append({
128 125 "raw_name": repo_gr.group_name,
@@ -168,7 +168,7 b' class JSONRPCController(TGController):'
168 168 # self.kargs and dispatch control to WGIController
169 169 argspec = inspect.getargspec(self._func)
170 170 arglist = argspec[0][1:]
171 defaults = map(type, argspec[3] or [])
171 defaults = [type(arg) for arg in argspec[3] or []]
172 172 default_empty = type(NotImplemented)
173 173
174 174 # kw arguments required by this method
@@ -100,7 +100,7 b' class FeedController(BaseRepoController)'
100 100 desc_msg.append('\n\n')
101 101 desc_msg.append(raw_diff)
102 102 desc_msg.append('</pre>')
103 return map(safe_unicode, desc_msg)
103 return [safe_unicode(chunk) for chunk in desc_msg]
104 104
105 105 def _feed(self, repo_name, kind, feed_factory):
106 106 """Produce a simple feed"""
@@ -379,7 +379,7 b' def pygmentize_annotation(repo_name, fil'
379 379 h %= 1
380 380 HSV_tuple = [h, 0.95, 0.95]
381 381 RGB_tuple = hsv_to_rgb(*HSV_tuple)
382 yield map(lambda x: str(int(x * 256)), RGB_tuple)
382 yield [str(int(x * 256)) for x in RGB_tuple]
383 383
384 384 cgenerator = gen_color()
385 385
@@ -78,7 +78,7 b' class WhooshIndexingDaemon(object):'
78 78 # filter repo list
79 79 if repo_list:
80 80 # Fix non-ascii repo names to unicode
81 repo_list = map(safe_unicode, repo_list)
81 repo_list = set(safe_unicode(repo_name) for repo_name in repo_list)
82 82 self.filtered_repo_paths = {}
83 83 for repo_name, repo in self.repo_paths.items():
84 84 if repo_name in repo_list:
@@ -47,7 +47,7 b' class GitInMemoryChangeset(BaseInMemoryC'
47 47 for node in self.added + self.changed:
48 48 # Compute subdirs if needed
49 49 dirpath, nodename = posixpath.split(node.path)
50 dirnames = map(safe_str, dirpath and dirpath.split('/') or [])
50 dirnames = safe_str(dirpath).split('/') if dirpath else []
51 51 parent = commit_tree
52 52 ancestors = [('', parent)]
53 53
@@ -27,7 +27,7 b' class MercurialChangeset(BaseChangeset):'
27 27
28 28 @LazyProperty
29 29 def tags(self):
30 return map(safe_unicode, self._ctx.tags())
30 return [safe_unicode(tag) for tag in self._ctx.tags()]
31 31
32 32 @LazyProperty
33 33 def branch(self):
@@ -95,7 +95,7 b' class MercurialChangeset(BaseChangeset):'
95 95
96 96 @LazyProperty
97 97 def bookmarks(self):
98 return map(safe_unicode, self._ctx.bookmarks())
98 return [safe_unicode(bookmark) for bookmark in self._ctx.bookmarks()]
99 99
100 100 @LazyProperty
101 101 def message(self):
@@ -1163,7 +1163,7 b' class Repository(Base, BaseDbModel):'
1163 1163 # names in the database, but that eventually needs to be converted
1164 1164 # into a valid system path
1165 1165 p += self.repo_name.split(Repository.url_sep())
1166 return os.path.join(*map(safe_unicode, p))
1166 return os.path.join(*(safe_unicode(d) for d in p))
1167 1167
1168 1168 @property
1169 1169 def cache_keys(self):
@@ -2511,8 +2511,7 b' class Gist(Base, BaseDbModel):'
2511 2511 def scm_instance(self):
2512 2512 from kallithea.lib.vcs import get_repo
2513 2513 base_path = self.base_path()
2514 return get_repo(os.path.join(*map(safe_str,
2515 [base_path, self.gist_access_id])))
2514 return get_repo(os.path.join(safe_str(base_path), safe_str(self.gist_access_id)))
2516 2515
2517 2516
2518 2517 class UserSshKeys(Base, BaseDbModel):
@@ -73,8 +73,7 b' class PermissionModel(object):'
73 73 return '.'.join(perm_name.split('.')[:1])
74 74
75 75 perms = UserToPerm.query().filter(UserToPerm.user == user).all()
76 defined_perms_groups = map(_get_group,
77 (x.permission.permission_name for x in perms))
76 defined_perms_groups = set(_get_group(x.permission.permission_name) for x in perms)
78 77 log.debug('GOT ALREADY DEFINED:%s', perms)
79 78 DEFAULT_PERMS = Permission.DEFAULT_USER_PERMISSIONS
80 79
@@ -644,7 +644,7 b' class RepoModel(object):'
644 644 else:
645 645 _paths = [self.repos_path, new_parent_path, repo_name]
646 646 # we need to make it str for mercurial
647 repo_path = os.path.join(*map(lambda x: safe_str(x), _paths))
647 repo_path = os.path.join(*(safe_str(x) for x in _paths))
648 648
649 649 # check if this path is not a repository
650 650 if is_valid_repo(repo_path, self.repos_path):
General Comments 0
You need to be logged in to leave comments. Login now