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. |
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. |
WeakNone |
Pretend to be a weak reference to nothing. Used by ArgsInfos to |
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.