def reformat_source(source, style, name):
    options = _autopep8_options_for_style(style)
    tmp_str = autopep8.fix_code(source, options)

    fixers = _fixers_for_style(style)
    tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers, explicit=fixers)
    return unicode(tool.refactor_string(tmp_str, name=name))
def reformat_source(source, style, name):
    options = _autopep8_options_for_style(style)
    tmp_str = autopep8.fix_code(source, options)

    fixers = _fixers_for_style(style)
    tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers,
                                            explicit=fixers)
    return unicode(tool.refactor_string(tmp_str, name=name))
Esempio n. 3
0
def reformat_source(source, autopep8_options, fixers, name):
    tmp_str = source

    if autopep8_options:
        tmp_str = autopep8.fix_code(tmp_str, autopep8_options)

    if fixers:
        tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers, explicit=fixers)
        tmp_str = unicode(tool.refactor_string(tmp_str, name=name))

    return tmp_str
Esempio n. 4
0
def reformat_source(source, autopep8_options, fixers, name):
    tmp_str = source

    if autopep8_options:
        tmp_str = autopep8.fix_code(tmp_str, autopep8_options)

    if fixers:
        tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers,
                                                explicit=fixers)
        tmp_str = unicode(tool.refactor_string(tmp_str, name=name))

    return tmp_str