def pre_update(self, context):
    assert isinstance(self.canvas, Canvas)
    connected_items = [c.item for c in self.canvas.get_connections(connected=self)]
    connectors = any(map((lambda i: isinstance(i.subject, UML.Connector)), connected_items))
    if (connectors or (self._folded != Folded.NONE)):
        provided = (connectors or any(map((lambda i: isinstance(i.subject, UML.Implementation)), connected_items)))
        required = any(map((lambda i: isinstance(i.subject, UML.Usage)), connected_items))
        if (required and provided):
            self.folded = Folded.ASSEMBLY
        elif required:
            self.folded = Folded.REQUIRED
        else:
            self.folded = Folded.PROVIDED
        self.update_shapes(connectors=connectors)
    super().pre_update(context)
def pre_update(self, context):
    assert isinstance(self.canvas, Canvas)
    connected_items = [c.item for c in self.canvas.get_connections(connected=self)]
    connectors = any(map((lambda i: isinstance(i.subject, UML.Connector)), connected_items))
    if (connectors or (self._folded != Folded.NONE)):
        provided = (connectors or any(map((lambda i: isinstance(i.subject, UML.Implementation)), connected_items)))
        required = any(map((lambda i: isinstance(i.subject, UML.Usage)), connected_items))
        if (required and provided):
            self.folded = Folded.ASSEMBLY
        elif required:
            self.folded = Folded.REQUIRED
        else:
            self.folded = Folded.PROVIDED
        self.update_shapes(connectors=connectors)
    super().pre_update(context)