Phoenix Logo

phoenix_title wx.lib.pubsub.core.topicutils

Various utilities used by topic-related modules.

copyright:Copyright since 2006 by Oliver Schoenborn, all rights reserved.
license:BSD, see LICENSE_BSD_Simple.txt for details.

function_summary Functions Summary

smartDedent Dedent paragraph using textwrap.dedent(), but properly dedents
stringize If topicName is a string, just return it
tupleize If topicName is a tuple of strings, just return it as is. Otherwise,
validateName Raise TopicNameError if nameTuple not valid as topic name.

class_summary Classes Summary

WeakNone Pretend to be a weak reference to nothing. Used by ArgsInfos to

Functions



smartDedent(paragraph)

Dedent paragraph using textwrap.dedent(), but properly dedents even if the first line of paragraph does not contain blanks. This handles the case where a user types a documentation string as

‘’‘A long string spanning several lines.’‘’


stringize(topicName)

If topicName is a string, just return it as is. If it is a topic definition object (ie an object that has ‘msgDataSpec’ as data member), return the dotted name of corresponding topic. Otherwise, assume topicName is a tuple and convert it to to a dotted name i.e. (‘a’,’b’,’c’) => ‘a.b.c’. Empty name is not allowed (ValueError). The reverse operation is tupleize(topicName).



tupleize(topicName)

If topicName is a tuple of strings, just return it as is. Otherwise, convert it to tuple, assuming dotted notation used for topicName. I.e. ‘a.b.c’ => (‘a’,’b’,’c’). Empty topicName is not allowed (ValueError). The reverse operation is stringize(topicNameTuple).



validateName(topicName)

Raise TopicNameError if nameTuple not valid as topic name.