コード例 #1
0
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))
コード例 #2
0
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))
コード例 #3
0
ファイル: main.py プロジェクト: mirror/chromium
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
コード例 #4
0
ファイル: main.py プロジェクト: sokolovp/BraveMining
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