def get_decorators(func):
    decorators = []
    if hasattr(func, '__module__'):
        mod = inspect.getmodule(func)
        source_code = inspect.getsourcelines(mod)[0]
        func_name = get_func_name(func)
        i = 0

        func_def = 'def {}'.format(func_name)
        class_def = 'class {}'.format(func_name)

        for line in source_code:
            if line.startswith(func_def) or line.startswith(class_def):
                j = 1
                k = source_code[i-j]
                # decorators can be defined on the previous line(s), but can have blank lines before them
                # blank lines are '\n', hence we strip() them to see if they're empty
                while k.startswith('@') or not k.strip():
                    if k.startswith('@'):
                        decorators.append(k.strip().split('(')[0])
                    j += 1
                    if j >= i: # don't wrap around when we get to the start of the file
                        break
                    k = source_code[i-j]
            i += 1

    return decorators
Creates a new LayeredPanel.
dataset/ETHPy150Open potatolondon/djangae/djangae/contrib/security/commands_utils.py/get_decorators--crossover with--dataset/ETHPy150Open enthought/pyface/pyface/layered_panel.py/LayeredPanel.__init__