Source

fat_po_editor / fat_po_editor / util.py

Full commit
# -*- coding: utf-8 -*-

def isiterable(entry):
    """Basically it gives you is entry is a list, tuple or generator."""
    if (isinstance(entry, list)
        or isinstance(entry, tuple)
        or hasattr(entry, '__iter__')):
        
        return True
    return False

class StringBuilder(object):
    """Use it instead of doing += for building unicode strings from pieces"""
    def __init__(self, val=u""):
        self.val = val
        self.appended = []
    
    def __iadd__(self, other):
        self.appended.append(other)
        return self

    def __unicode__(self):
        self.val = u"".join((self.val, u"".join(self.appended)))
        self.appended = []
        return self.val