@staticmethod
    def list_placeholders(fmt):
        placeholders = set()
        nb = 0
        i = 0
        n = len(fmt)
        while i < n:
            if fmt[i] == '{':
                i += 1
                if fmt[i] == '{': # KeyError:
                    i += 1
                    continue
                e = fmt.index('}', i) # KeyError
                f = e
                for c in (':', '!', '[', '.'):
                    c = fmt.find(c, i)
                    if c != -1:
                        f = min(f, c)
                if i == f:
                    nb += 1
                else:
                    arg = fmt[i:f]
                    try:
                        arg = int(arg)
                    except ValueError:
                        placeholders.add(arg)
                    else:
                        nb = max(nb, arg + 1)
                i = e
            i += 1
        return nb, placeholders
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/modules/basic_modules.py/StringFormat.list_placeholders/original