Agent: Use dict comprehension instead of for

This commit is contained in:
Mike Salvatore 2022-09-30 11:50:18 -04:00
parent 3f89e50930
commit 4987dddc0c
2 changed files with 2 additions and 6 deletions

View File

@ -46,9 +46,7 @@ def _scan_tcp_ports(
def _generate_tcp_scan_event(
host: str, port_scan_data: Dict[int, PortScanData], event_timestamp: float
):
port_statuses = {}
for port, data in port_scan_data.items():
port_statuses[port] = data.status
port_statuses = {port: psd.status for port, psd in port_scan_data.items()}
return TCPScanEvent(
source=get_agent_id(),

View File

@ -35,9 +35,7 @@ def patch_check_tcp_ports(monkeypatch, open_ports_data):
def _get_tcp_scan_event(port_scan_data: PortScanData):
port_statuses = {}
for port, data in port_scan_data.items():
port_statuses[port] = data.status
port_statuses = {port: psd.status for port, psd in port_scan_data.items()}
return TCPScanEvent(
source=get_agent_id(),