Fix pylint warning W0108: Lambda may not be necessary

Remove unnecessary usage of lambda.

Change-Id: I06d41933057d60d15d307ee800cca052a44754c6
This commit is contained in:
David Pursehouse 2012-10-25 12:40:51 +09:00
parent e072a92a9b
commit 7e6dd2dff0
4 changed files with 8 additions and 9 deletions

View File

@ -88,7 +88,7 @@ class _GitCall(object):
ver_str = git.version()
if ver_str.startswith('git version '):
_git_version = tuple(
map(lambda x: int(x),
map(int,
ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]
))
else:
@ -110,7 +110,7 @@ def git_require(min_version, fail=False):
if min_version <= git_version:
return True
if fail:
need = '.'.join(map(lambda x: str(x), min_version))
need = '.'.join(map(str, min_version))
print >>sys.stderr, 'fatal: git %s or later required' % need
sys.exit(1)
return False

View File

@ -537,7 +537,7 @@ class Remote(object):
self.url = self._Get('url')
self.review = self._Get('review')
self.projectname = self._Get('projectname')
self.fetch = map(lambda x: RefSpec.FromString(x),
self.fetch = map(RefSpec.FromString,
self._Get('fetch', all_keys=True))
self._review_url = None
@ -657,7 +657,7 @@ class Remote(object):
self._Set('url', self.url)
self._Set('review', self.review)
self._Set('projectname', self.projectname)
self._Set('fetch', map(lambda x: str(x), self.fetch))
self._Set('fetch', map(str, self.fetch))
def _Set(self, key, value):
key = 'remote.%s.%s' % (self.name, key)

View File

@ -195,12 +195,12 @@ def _CheckWrapperVersion(ver, repo_path):
sys.exit(1)
exp = _CurrentWrapperVersion()
ver = tuple(map(lambda x: int(x), ver.split('.')))
ver = tuple(map(int, ver.split('.')))
if len(ver) == 1:
ver = (0, ver[0])
exp_str = '.'.join(map(str, exp))
if exp[0] > ver[0] or ver < (0, 4):
exp_str = '.'.join(map(lambda x: str(x), exp))
print >>sys.stderr, """
!!! A new repo command (%5s) is available. !!!
!!! You must upgrade before you can continue: !!!
@ -210,7 +210,6 @@ def _CheckWrapperVersion(ver, repo_path):
sys.exit(1)
if exp > ver:
exp_str = '.'.join(map(lambda x: str(x), exp))
print >>sys.stderr, """
... A new repo command (%5s) is available.
... You should upgrade soon:
@ -272,7 +271,7 @@ def _UserAgent():
_user_agent = 'git-repo/%s (%s) git/%s Python/%d.%d.%d' % (
repo_version,
os_name,
'.'.join(map(lambda d: str(d), git.version_tuple())),
'.'.join(map(str, git.version_tuple())),
py_version[0], py_version[1], py_version[2])
return _user_agent

View File

@ -1175,7 +1175,7 @@ class Project(object):
cmd = ['fetch', remote.name]
cmd.append('refs/changes/%2.2d/%d/%d' \
% (change_id % 100, change_id, patch_id))
cmd.extend(map(lambda x: str(x), remote.fetch))
cmd.extend(map(str, remote.fetch))
if GitCommand(self, cmd, bare=True).Wait() != 0:
return None
return DownloadedChange(self,