MCPcopy Index your code
hub / github.com/ddserver/ddserver / FormatterDeclaration

Class FormatterDeclaration

ddserver/utils/txtprot.py:152–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150
151
152class FormatterDeclaration(object):
153 def __init__(self, messages, splitter = ' '):
154 self.__splitter = splitter
155 self.__messages = {message.tag : message
156 for message
157 in messages}
158
159
160 def __call__(self, message):
161 # Find the message declaration for tag and format the values using this
162 # message declaration
163 load = self.__messages[message.tag].format(message)
164
165 # Join the message parts separated by the splitter character
166 return self.__splitter.join([message.tag] + load)
167
168
169
170 def __getattr__(self, key):
171 ''' Returns a message declaration for the given key. '''
172
173 return self.__messages[key]
174
175

Callers 1

__main__.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected