(self, name: str, okIfNone: bool = False)
Get the Topic instance for the given topic name. By default, raises
        an TopicNameError exception if a topic with given name doesn't exist. If
        okIfNone=True, returns None instead of raising an exception.
Get the Topic instance for the given topic name. By default, raises
        an TopicNameError exception if a topic with given name doesn't exist. If
        okIfNone=True, returns None instead of raising an exception.
Get the Topic instance for the given topic name . By default raises an TopicNameError exception if a topic with given name doesn t exist . If okIfNone = True returns None instead of raising an exception .
def getTopic(self, name: str, okIfNone: bool = False) -> Topic:
        """
        Get the Topic instance for the given topic name. By default, raises
        an TopicNameError exception if a topic with given name doesn't exist. If
        okIfNone=True, returns None instead of raising an exception.
        """
        topicNameDotted = stringize(name)
        # if not name:
        #    raise TopicNameError(name, 'Empty topic name not allowed')
        obj = self._topicsMap.get(topicNameDotted, None)
        if obj is not None:
            return obj

        if okIfNone:
            return None

        # NOT FOUND! Determine what problem is and raise accordingly:
        # find the closest parent up chain that does exists:
        parentObj, subtopicNames = self.__getClosestParent(topicNameDotted)
        assert subtopicNames

        subtopicName = subtopicNames[0]
        if parentObj is self.__allTopics:
            raise TopicNameError(name, 'Root topic "%s" doesn\'t exist' % subtopicName)

        msg = 'Topic "%s" doesn\'t have "%s" as subtopic' % (parentObj.getName(), subtopicName)
        raise TopicNameError(name, msg)
def getTopic ( self , name : str , okIfNone : bool = False ) -> Topic : topicNameDotted = stringize ( name ) # if not name: #    raise TopicNameError(name, 'Empty topic name not allowed') obj = self . _topicsMap . get ( topicNameDotted , None ) if obj is not None : return obj if okIfNone : return None # NOT FOUND! Determine what problem is and raise accordingly: # find the closest parent up chain that does exists: parentObj , subtopicNames = self . __getClosestParent ( topicNameDotted ) assert subtopicNames subtopicName = subtopicNames [ 0 ] if parentObj is self . __allTopics : raise TopicNameError ( name , 'Root topic "%s" doesn\'t exist' % subtopicName ) msg = 'Topic "%s" doesn\'t have "%s" as subtopic' % ( parentObj . getName ( ) , subtopicName ) raise TopicNameError ( name , msg )