def validate()

in labgraph/graphs/method.py [0:0]


    def validate(self) -> None:
        for i, topic1 in enumerate(self.published_topics):
            for j, topic2 in enumerate(self.published_topics):
                if i != j and topic1 is topic2:
                    raise LabgraphError(
                        f"Method '{self.name}' got two @publisher decorators for the "
                        "same topic"
                    )

        if len(self.published_topics) > 0:
            if self.is_background:
                raise LabgraphError(
                    f"Method '{self.name}' cannot have both a @{publisher.__name__} "
                    f"decorator and a @{background.__name__} decorator"
                )
            if self.is_main:
                raise LabgraphError(
                    f"Method '{self.name}' cannot have both a @{publisher.__name__} "
                    f"decorator and a @{main.__name__} decorator"
                )

        if self.subscribed_topic is not None:
            if self.is_background:
                raise LabgraphError(
                    f"Method '{self.name}' cannot have both a @{subscriber.__name__} "
                    f"decorator and a @{background.__name__} decorator"
                )
            if self.is_main:
                raise LabgraphError(
                    f"Method '{self.name}' cannot have both a @{subscriber.__name__} "
                    f"decorator and a @{main.__name__} decorator"
                )

        if self.is_background and self.is_main:
            raise LabgraphError(
                f"Method '{self.name}' cannot have both a @{background.__name__} "
                f"decorator and a @{main.__name__} decorator"
            )