diff --git a/service-mgmt-api/sm-api/sm_api/common/safe_utils.py b/service-mgmt-api/sm-api/sm_api/common/safe_utils.py index 1c994e31..9c534d0b 100644 --- a/service-mgmt-api/sm-api/sm_api/common/safe_utils.py +++ b/service-mgmt-api/sm-api/sm_api/common/safe_utils.py @@ -47,7 +47,7 @@ def getcallargs(function, *args, **kwargs): else: keyed_args[argnames[0]] = None - remaining_argnames = filter(lambda x: x not in keyed_args, argnames) + remaining_argnames = [x for x in argnames if x not in keyed_args] keyed_args.update(dict(zip(remaining_argnames, args))) if defaults: diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/config/generator.py b/service-mgmt-api/sm-api/sm_api/openstack/common/config/generator.py index a3b91775..bd00ef82 100755 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/config/generator.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/config/generator.py @@ -73,9 +73,9 @@ def generate(srcfiles): os.path.basename(filepath).split('.')[0]]) mods_by_pkg.setdefault(pkg_name, list()).append(mod_str) # NOTE(lzyeval): place top level modules before packages - pkg_names = filter(lambda x: x.endswith(PY_EXT), mods_by_pkg.keys()) + pkg_names = [x for x in mods_by_pkg.keys() if x.endswith(PY_EXT)] pkg_names.sort() - ext_names = filter(lambda x: x not in pkg_names, mods_by_pkg.keys()) + ext_names = [x for x in mods_by_pkg.keys() if x not in pkg_names] ext_names.sort() pkg_names.extend(ext_names) diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/eventlet_backdoor.py b/service-mgmt-api/sm-api/sm_api/openstack/common/eventlet_backdoor.py index 4d213590..62225fa4 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/eventlet_backdoor.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/eventlet_backdoor.py @@ -47,7 +47,7 @@ def _dont_use_this(): def _find_objects(t): - return filter(lambda o: isinstance(o, t), gc.get_objects()) + return [o for o in gc.get_objects() if isinstance(o, t)] def _print_greenthreads(): diff --git a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/matchmaker_redis.py b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/matchmaker_redis.py index 42e64072..a491d0ab 100644 --- a/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/matchmaker_redis.py +++ b/service-mgmt-api/sm-api/sm_api/openstack/common/rpc/matchmaker_redis.py @@ -87,8 +87,8 @@ class RedisFanoutExchange(RedisExchange): def run(self, topic): topic = topic.split('~', 1)[1] hosts = self.redis.smembers(topic) - good_hosts = filter( - lambda host: self.matchmaker.is_alive(topic, host), hosts) + good_hosts = [host for host in hosts if + self.matchmaker.is_alive(topic, host)] return [(x, x.split('.', 1)[1]) for x in good_hosts] diff --git a/service-mgmt-client/sm-client/sm_client/openstack/common/config/generator.py b/service-mgmt-client/sm-client/sm_client/openstack/common/config/generator.py index 756cd3f7..17a6f286 100644 --- a/service-mgmt-client/sm-client/sm_client/openstack/common/config/generator.py +++ b/service-mgmt-client/sm-client/sm_client/openstack/common/config/generator.py @@ -73,9 +73,9 @@ def generate(srcfiles): os.path.basename(filepath).split('.')[0]]) mods_by_pkg.setdefault(pkg_name, list()).append(mod_str) # NOTE(lzyeval): place top level modules before packages - pkg_names = filter(lambda x: x.endswith(PY_EXT), mods_by_pkg.keys()) + pkg_names = [x for x in mods_by_pkg.keys() if x.endswith(PY_EXT)] pkg_names.sort() - ext_names = filter(lambda x: x not in pkg_names, mods_by_pkg.keys()) + ext_names = [x for x in mods_by_pkg.keys() if x not in pkg_names] ext_names.sort() pkg_names.extend(ext_names) diff --git a/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py b/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py index cd5872e1..ef8df02e 100644 --- a/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py +++ b/service-mgmt-client/sm-client/sm_client/v1/smc_service_shell.py @@ -31,7 +31,7 @@ def do_service_list(cc, args): fields = ['id', 'name', 'node_name', 'state'] field_labels = ['id', 'service_name', 'hostname', 'state'] # remove the entry in the initial state - clean_list = filter(lambda x: x.state != 'initial', service) + clean_list = [x for x in service if x.state != 'initial'] for s in clean_list: if s.status: setattr(s, 'state', s.state + '-' + s.status)