Skip to content
Snippets Groups Projects
Commit aeb9db17 authored by Robert Latta's avatar Robert Latta
Browse files

yielded copies of dicts to prevent polution

parent 669e787c
No related branches found
No related tags found
No related merge requests found
...@@ -124,6 +124,14 @@ def get_port_id_services(ds: IMS): ...@@ -124,6 +124,14 @@ def get_port_id_services(ds: IMS):
# internal port a / internal port b # internal port a / internal port b
# port a / port b # port a / port b
# if there are more than two ports we'll yield a circuit of the ends of the
# sequence and the reverse; and then single ended circuits for all ports
# between
# e.g. four ports are reported [a,b,c,d] the 4 circs would have endpoints
# a and d
# d and a
# b only
# c only
def _populate_end_info(_circuit, _port_ids): def _populate_end_info(_circuit, _port_ids):
port_ids = [p for p in _port_ids if p] port_ids = [p for p in _port_ids if p]
if not port_ids: if not port_ids:
...@@ -133,15 +141,15 @@ def get_port_id_services(ds: IMS): ...@@ -133,15 +141,15 @@ def get_port_id_services(ds: IMS):
_circuit['port_a_id'] = port_a_id _circuit['port_a_id'] = port_a_id
if port_a_id != port_b_id: if port_a_id != port_b_id:
_circuit['port_b_id'] = port_b_id _circuit['port_b_id'] = port_b_id
yield _circuit yield copy(_circuit)
_circuit['port_a_id'], _circuit['port_b_id'] = \ _circuit['port_a_id'], _circuit['port_b_id'] = \
_circuit['port_b_id'], _circuit['port_a_id'] _circuit['port_b_id'], _circuit['port_a_id']
yield _circuit yield copy(_circuit)
if len(port_ids) > 2: if len(port_ids) > 2:
_circuit.pop('port_b_id', None) _circuit.pop('port_b_id', None)
for p in port_ids[1:-1]: for p in port_ids[1:-1]:
_circuit['port_a_id'] = p _circuit['port_a_id'] = p
yield _circuit yield copy(_circuit)
for circuit in circuits: for circuit in circuits:
cd = { cd = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment