-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathpreview_concatenated_list_comprehensions.py
More file actions
27 lines (21 loc) · 1.33 KB
/
preview_concatenated_list_comprehensions.py
File metadata and controls
27 lines (21 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# flags: --preview --line-length=120
matching_routes = [route for route in network_routes if route.destination and router_ip in route.destination_network] + [route for route in network_routes if route.destination is None and route.family == requested_family]
already_wrapped = (
[route for route in network_routes if route.load_balanced] +
[route for route in network_routes if route.fallback_route]
)
triple = [route for route in network_routes if route.has_primary and route.supports_failover] + [route for route in network_routes if route.has_secondary and route.supports_failover] + [route for route in network_routes if route.is_backup and route.supports_failover]
# output
matching_routes = (
[route for route in network_routes if route.destination and router_ip in route.destination_network]
+ [route for route in network_routes if route.destination is None and route.family == requested_family]
)
already_wrapped = (
[route for route in network_routes if route.load_balanced]
+ [route for route in network_routes if route.fallback_route]
)
triple = (
[route for route in network_routes if route.has_primary and route.supports_failover]
+ [route for route in network_routes if route.has_secondary and route.supports_failover]
+ [route for route in network_routes if route.is_backup and route.supports_failover]
)