

def set_buffer_syntax(state):
    source = state.source
    contained = ''
    include_cmd = ''
    if (source.syntaxes or source.include_syntax):
        contained += ' contains='
        if source.syntaxes:
            contained += (source.name() + '_.*')
        if source.include_syntax:
            filetype = Path(source.include_syntax).stem.capitalize()
            contained += (',@' + filetype)
            include_cmd = ((('syntax include @' + filetype) + ' ') + source.include_syntax)
    magic = ((('syntax region ' + source.name()) + ' oneline keepend start=/^/ end=/$/') + contained)
    vim.command('syntax clear')
    map(vim.command, ((([include_cmd] + source.syntaxes) + source.highlights) + [magic]))
    vim.command('syntax sync minlines=1 maxlines=1')

dataset/ETHPy150Open azure-satellite/pyunite/pyunite/core.py set_buffer_syntax/original