From b7566a805b456b0a6821b42cdc01b645a2c890b8 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 30 Sep 2022 14:22:02 -0400 Subject: [PATCH] Island: Use list comprehension instead of map() --- .../monkey_island/cc/repository/mongo_machine_repository.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/repository/mongo_machine_repository.py b/monkey/monkey_island/cc/repository/mongo_machine_repository.py index 75cbf2d46..8e1934cc7 100644 --- a/monkey/monkey_island/cc/repository/mongo_machine_repository.py +++ b/monkey/monkey_island/cc/repository/mongo_machine_repository.py @@ -75,7 +75,7 @@ class MongoMachineRepository(IMachineRepository): except Exception as err: raise RetrievalError(f"Error retrieving machines: {err}") - return list(map(lambda m: Machine(**m), cursor)) + return [Machine(**m) for m in cursor] def get_machines_by_ip(self, ip: IPv4Address) -> Sequence[Machine]: ip_regex = "^" + str(ip).replace(".", "\\.") + "\\/.*$" @@ -86,7 +86,7 @@ class MongoMachineRepository(IMachineRepository): except Exception as err: raise RetrievalError(f'Error retrieving machines with ip "{ip}": {err}') - machines = list(map(lambda m: Machine(**m), cursor)) + machines = [Machine(**m) for m in cursor] if len(machines) == 0: raise UnknownRecordError(f'No machines found with IP "{ip}"')