Example #1
0
def reformat_white_space():
    try:
        import autopep8
    except ImportError:
        print(WARNING + "Could not find 'autopep8', exceeding whitespace will not be removed!" + TERMINATOR)
        return

    merchant_dir_path = os.path.abspath("./{{ cookiecutter.app_name }}")
    args = autopep8.parse_args(['--max-line-length 119', '--in-place', '--recursive'])
    if os.path.exists(merchant_dir_path):
        autopep8.fix_multiple_files([merchant_dir_path], args)
Example #2
0
def fix_p2p8(directory):
    import autopep8
    import multiprocessing

    # pylint: disable=protected-access
    autopep8.fix_multiple_files([directory],
                                options=autopep8._get_options(
                                    {
                                        'jobs': multiprocessing.cpu_count(),
                                        'verbose': True,
                                        'recursive': True,
                                        'in_place': True,
                                        'max_line_length': 100
                                    }, False))
Example #3
0
def autopep_files(files, max_line_length):
    # type: (typing.List[str], int) -> None
    files = files[:]
    options = _AutopepOptions(aggressive=1,  # pylint:disable=not-callable
                              diff=False,
                              exclude=set(),
                              experimental=False,
                              global_config=None,
                              ignore='',
                              ignore_local_config=False,
                              in_place=True,
                              indent_size=4,
                              jobs=0,
                              line_range=None,
                              list_fixes=False,
                              max_line_length=max_line_length,
                              pep8_passes=-1,
                              recursive=False,
                              select={'W', 'E'},
                              verbose=0,
                              hang_closing=False)
    autopep8.fix_multiple_files(files, options, sys.stdout)