Table Of Contents

Previous topic

TopicTreeTraverser

Next topic

TopicNameInvalid

This Page

phoenix_title topicutils

Various little utilities used by topic-related modules.

copyright:Copyright 2006-2009 by Oliver Schoenborn, all rights reserved.
license:BSD, see LICENSE.txt for details.

class_hierarchy Inheritance Diagram

Inheritance diagram for module topicutils

Inheritance diagram of topicutils


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 TopicNameInvalid if nameTuple not valid as topic name.

class_summary Classes Summary

TopicNameInvalid Except raised when the topic name is not properly formatted.
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 TopicNameInvalid if nameTuple not valid as topic name.