Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pattern instance.
"""
pattern = Pattern(id=id)
interface = Interface()
for p in g.nodes():
attr_dict = g.node[p]
port = Port(identifier=attr_dict['identifier'],
interface=attr_dict['interface'],
io=attr_dict['io'],
type=attr_dict['type'])
interface.ports.append(port)
pattern.interface = interface
for c in g.edges():
connection = PatternConnection(from_=c[0], to=c[1])
pattern.connections.append(connection)
return pattern