from artgraph.plugins.plugin import Plugin
from artgraph.node import Node, NodeTypes
from artgraph.relationship import AssociatedActRelationship

class InfoboxPlugin(Plugin):
    def __init__(self, node):
        self._node = node
        
    def get_nodes(self):
        wikicode = self.get_wikicode(self._node.get_title())
        templates = wikicode.filter_templates()
        relationships = []

        for t in templates:
            if t.name.matches('Infobox musical artist'):
                associated_acts = t.get('associated_acts')
                
                for w in associated_acts.value.filter_wikilinks():
                    relationships.append(AssociatedActRelationship(self._node, Node(w.title, NodeTypes.ARTIST)))
                
        return relationships
        
from artgraph.plugins.plugin import Plugin

class InfoboxPlugin(Plugin):
    def __init__(self, node):
        self._node = node
        
    def get_nodes(self):
        from artgraph.node import Node, NodeTypes
        from artgraph.relationship import AssociatedActRelationship
        
        wikicode = self.get_wikicode(self._node.get_title())
        templates = wikicode.filter_templates()
        relationships = []

        for t in templates:
            if t.name.matches('Infobox musical artist'):
                associated_acts = t.get('associated_acts')
                
                for w in associated_acts.value.filter_wikilinks():
                    relationships.append(AssociatedActRelationship(self._node, Node(w.title, NodeTypes.ARTIST)))
                
        return relationships
        
Fix imports to be able to import properly from the worker nodes
Fix imports to be able to import properly from the worker nodes
  from artgraph.plugins.plugin import Plugin
- from artgraph.node import Node, NodeTypes
- from artgraph.relationship import AssociatedActRelationship
  
  class InfoboxPlugin(Plugin):
      def __init__(self, node):
          self._node = node
          
      def get_nodes(self):
+         from artgraph.node import Node, NodeTypes
+         from artgraph.relationship import AssociatedActRelationship
+         
          wikicode = self.get_wikicode(self._node.get_title())
          templates = wikicode.filter_templates()
          relationships = []
  
          for t in templates:
              if t.name.matches('Infobox musical artist'):
                  associated_acts = t.get('associated_acts')
                  
                  for w in associated_acts.value.filter_wikilinks():
                      relationships.append(AssociatedActRelationship(self._node, Node(w.title, NodeTypes.ARTIST)))
                  
          return relationships
          
Fix imports to be able to import properly from the worker nodes
## Code Before:
from artgraph.plugins.plugin import Plugin
from artgraph.node import Node, NodeTypes
from artgraph.relationship import AssociatedActRelationship

class InfoboxPlugin(Plugin):
    def __init__(self, node):
        self._node = node
        
    def get_nodes(self):
        wikicode = self.get_wikicode(self._node.get_title())
        templates = wikicode.filter_templates()
        relationships = []

        for t in templates:
            if t.name.matches('Infobox musical artist'):
                associated_acts = t.get('associated_acts')
                
                for w in associated_acts.value.filter_wikilinks():
                    relationships.append(AssociatedActRelationship(self._node, Node(w.title, NodeTypes.ARTIST)))
                
        return relationships
        
## Instruction:
Fix imports to be able to import properly from the worker nodes
## Code After:
from artgraph.plugins.plugin import Plugin

class InfoboxPlugin(Plugin):
    def __init__(self, node):
        self._node = node
        
    def get_nodes(self):
        from artgraph.node import Node, NodeTypes
        from artgraph.relationship import AssociatedActRelationship
        
        wikicode = self.get_wikicode(self._node.get_title())
        templates = wikicode.filter_templates()
        relationships = []

        for t in templates:
            if t.name.matches('Infobox musical artist'):
                associated_acts = t.get('associated_acts')
                
                for w in associated_acts.value.filter_wikilinks():
                    relationships.append(AssociatedActRelationship(self._node, Node(w.title, NodeTypes.ARTIST)))
                
        return relationships
        