|
@@ -183,6 +183,38 @@ class SinkConfig:
|
183
|
183
|
|
184
|
184
|
return s
|
185
|
185
|
|
|
186
|
+ def __str__(self):
|
|
187
|
+ """Print the SinkStatus in the manner of the configuration shell"""
|
|
188
|
+ s = ""
|
|
189
|
+
|
|
190
|
+ if self.status is not None:
|
|
191
|
+ s += "status: "
|
|
192
|
+ if self.status is SinkStatus.EMPTY:
|
|
193
|
+ s += "empty"
|
|
194
|
+ elif self.status is SinkStatus.VALID:
|
|
195
|
+ s += "valid"
|
|
196
|
+ elif self.status is SinkStatus.INVALID:
|
|
197
|
+ s += "invalid"
|
|
198
|
+ s += "\n"
|
|
199
|
+
|
|
200
|
+ if self.flags is not None:
|
|
201
|
+ s += "flags: "
|
|
202
|
+ if self.flags is SinkFlags.NONE:
|
|
203
|
+ s += "(none)"
|
|
204
|
+ else:
|
|
205
|
+ if self.flags & SinkFlags.GIVEBACK:
|
|
206
|
+ s += "GiveBack"
|
|
207
|
+ s += "\n"
|
|
208
|
+
|
|
209
|
+ if self.v is not None:
|
|
210
|
+ s += "v: {:.2f} V\n".format(self.v / 1000)
|
|
211
|
+
|
|
212
|
+ if self.i is not None:
|
|
213
|
+ s += "i: {:.2f} A\n".format(self.i / 1000)
|
|
214
|
+
|
|
215
|
+ # Return all but the last character of s to remove the trailing newline
|
|
216
|
+ return s[:-1]
|
|
217
|
+
|
186
|
218
|
def __eq__(self, other):
|
187
|
219
|
if isinstance(other, self.__class__):
|
188
|
220
|
if other.status is not self.status:
|