B
    lU\              "   @   s  d Z dZd d ZddlmZ ddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddd	d
dddddddddddddddddddddd d!d"d#d$d%d&d'd(g"Ze ZejZejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&ej'Z'ed)d*d+Z(e) Z*e*+ Z,e*j-Z.d3e/d)d-dZ0d4d.dZ1e/d)d/d
Z2ed)d0dZ3e*j4Z5e*j6Z7e*j8Z9ee d)d1d2Z:d,S )5a  
This is the main entry-point to pubsub's core functionality. The :mod:`~pubsub.pub`
module supports:

* messaging: publishing and receiving messages of a given topic
* tracing: tracing pubsub activity in an application
* trapping exceptions: dealing with "badly behaved" listeners (ie that leak exceptions)
* specificatio of topic tree: defining (or just documenting) the topic tree of an
  application; message data specification (MDS)

The recommended usage is ::

    from pubsub import pub

    // use pub functions:
    pub.sendMessage(...)

Note that this module creates a "default" instance of
pubsub.core.Publisher and binds several local functions to some of its methods
and those of the pubsub.core.TopicManager instance that it contains. However, an
application may create as many independent instances of Publisher as
required (for instance, one in each thread; with a custom queue to mediate
message transfer between threads).
   z$Rev: 243 $       )List)	Publisher
AUTO_TOPICListenerMismatchErrorTopicDefnErrorIListenerExcHandlerExcHandlerErrorr   TopicNameErrorUnrecognizedSourceFormatErrorSenderUnknownMsgDataErrorSenderMissingReqdMsgDataErrorTopicManager
ALL_TOPICSTopicMessageDataSpecErrorexportTopicTreeSpecTOPIC_TREE_FROM_MODULETOPIC_TREE_FROM_STRINGTOPIC_TREE_FROM_CLASSTopicTreeTraverserINotificationHandler	subscribeunsubscribeunsubAllisSubscribedisValidvalidater   r   r	   getListenerExcHandlersetListenerExcHandlerr
   r   r   topicTreeRoot	topicsMapr   getDefaultTopicMgraddTopicDefnProviderclearTopicDefnProvidersgetNumTopicDefnProvidersr   r   r   r   Z)instantiateAllDefinedTopicsTopicDefnErrorr   setTopicUnspecifiedFatalsendMessageaddNotificationHandlersetNotificationFlagsgetNotificationFlagsclearNotificationHandlersr   )returnc               C   s   t S )z
    Get the Publisher instance created by default when this module
    is imported. See the module doc for details about this instance.
    )
_publisher r/   r/   )lib/python3.7/site-packages/pubsub/pub.pygetDefaultPublisher   s    r1   Nc             C   s   t |j| |dS )a  
    Return true only if listener can subscribe to messages of given topic.
    If curriedArgNames can be a list of parameters of the given listener, that
    should be assumed curried (i.e. actual listener signature is signature of
    given listener minus curried args).
    )curriedArgNames)	_topicMgrgetTopicr   )listener	topicNamer2   r/   r/   r0   r      s    c             C   s   t |j| |d dS )z
    Checks if listener can subscribe to topicName. If not, raises
    ListenerMismatchError, otherwise just returns. The curriedArgNames is
    same as for isValid().
    )r2   N)r3   r4   r   )r5   r6   r2   r/   r/   r0   r      s    c             C   s   t || S )z
    Returns true if listener has subscribed to topicName, false otherwise.
    WARNING: a false return is not a guarantee that listener won't get
    messages of topicName: it could receive messages of a subtopic of
    topicName.
    )r3   r4   ZhasListener)r5   r6   r/   r/   r0   r      s    c               C   s   t S )z
    Get the TopicManager instance created by default when this
    module is imported. This function is a shortcut for
    ``pub.getDefaultPublisher().getTopicMgr()``.
    )r3   r/   r/   r/   r0   r#      s    c             C   s*   g }x | D ]}t | || q
W |S )ag  
    Loop over all topics of given provider and "instantiate" each topic, thus
    forcing a parse of the topics documentation, message data specification (MDS),
    comparison with parent MDS, and MDS documentation. Without this function call,
    an error among any of those characteristics will manifest only if the a
    listener is registered on it.
    )r3   ZgetOrCreateTopicappend)ZproviderZ
all_topicsZ
topic_namer/   r/   r0   instantiateAllDefinedTopics   s
    

r8   )N)N);__doc__ZVERSION_APIsplitZVERSION_SVNtypingr   Zcorer   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __all__r.   r   r   r   r(   r   r    r)   r,   r*   r+   r'   r1   ZgetTopicMgrr3   ZgetRootAllTopicsr!   Z
_topicsMapr"   boolr   r   r   r#   ZaddDefnProviderr$   ZclearDefnProvidersr%   ZgetNumDefnProvidersr&   r8   r/   r/   r/   r0   <module>   s|   \"


	
	