def flatten(expr): """ Test utility method to turn a list of strings character attribute declarations and similar lists into a single string with all character attribute information removed. """ return u''.join(list(text.flatten(expr, currentAttrs=text.AttributeSet())))
def send(self, stuff): """ Write a flattenable structure to my transport/protocol thingy. """ #FIXME: Encoding should be done *inside* flatten, not here. flatterStuff = T.flatten(stuff, useColors=self.useColors, currentAttrs=self.termAttrs) txt = u''.join(list(flatterStuff)) bytes = txt.encode('utf-8') self.proto.write(bytes)
def flattenWithoutColors(vt102): return T.flatten(vt102, useColors=False)
def F(*a, **kw): if "currentAttrs" not in kw: kw["currentAttrs"] = T.AttributeSet() return ''.join(list(T.flatten(a, **kw)))
def format(potentialTarget): concept = iimaginary.IConcept(potentialTarget) vt102 = concept.vt102(self.player) flattened = list(flatten(vt102, useColors=False)) return "".join(flattened)