list compr, general improvements

migration_mirror
idziubenko 3 роки тому
джерело 0826021939
коміт 1f2b817d6e

@ -158,7 +158,7 @@ class Profile(object):
@classmethod
def from_string(cls, repository, s):
parts = list(filter(None, s.split()))
parts = [x for x in s.split() if x]
if len(parts) == 3 and parts[0] in cls.available_arch:
return Profile(repository, parts[1], parts[0])
return None

@ -156,8 +156,8 @@ class Update(MethodsInterface):
EmergeCache.logger.logger.setLevel(logging.WARNING)
self.emerge_cache.check_list = (
self.emerge_cache.check_list +
map(lambda x:emerge_parser.GitCheckvalue(x, self.getGit()),
self.clVars.Get('update.cl_update_rep_path')))
[emerge_parser.GitCheckvalue(x, self.getGit()) for x
in self.clVars.Get('update.cl_update_rep_path')])
self.update_map = {}
self.refresh_binhost = False
self.pkgnum = None
@ -370,7 +370,6 @@ class Update(MethodsInterface):
makeDirectory(reposdir)
os.rename(layman_fullname, repos_fullname)
os.symlink(symlink_target, layman_fullname)
#print "MYDEBUG", reposdir, laymandir, rpath_orig
self.endTask(True)
return True

@ -70,7 +70,7 @@ class UpdateInfo(object):
"""
Проверить есть ли уже запущенная копия console-gui
"""
return any(list(filter(lambda x: "cl-console-gui" in x, getRunCommands())))
return any([x for x in getRunCommands() if "cl-console-gui" in x])
def update_already_run(self):
"""

@ -453,8 +453,7 @@ class VariableClUpdateSyncOverlayRep(ReadonlyVariable):
type = "list"
def get(self):
return list(filter(lambda x: x not in ("portage", "gentoo"),
self.Get('cl_update_sync_rep')))
return [x for x in self.Get('cl_update_sync_rep') if x not in ("portage", "gentoo")]
class VariableClUpdateOutdateSet(ReadonlyVariable):
@ -828,7 +827,7 @@ class VariableClUpdateTemplatesLocate(Variable):
def choice(self):
descr = lambda x: self.descriptionMap.get(x,
_("%s overlay templates" % x))
return list(map(lambda x: (x, descr(x)), self.get()))
return [(x, descr(x)) for x in self.get()]
class VariableClUpdateProfileDependName(FieldValue, ReadonlyVariable):

Завантаження…
Відмінити
Зберегти