def apiDecorator(api_type):
    def _apiDecorator(func):
        lines = ['']
        marked = False
        if not func.__doc__:
            func.__doc__ = func.__name__
        lines = func.__doc__.split('\n')
        for idx, line in enumerate(lines):
            if '@' in line:
                l = line.replace('\t', '        ')
                l2 = line.lstrip()
                indent = len(l) - len(l2)
                lines.insert(idx, (' ' * indent) + '(%s)' % api_type)
                marked = True
                break

        if not marked:
            lines[0] = lines[0] + ' (%s)' % api_type

        try:
            func.__doc__ = '\n'.join(lines)
        except __HOLE__:
            # maybe a C function.
            pass
        return func
    return _apiDecorator
dataset/ETHPy150Open sassoftware/conary/conary/lib/api.py/apiDecorator