File size: 566 Bytes
f747401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import glob
import autopep8


def format_all():
    files = glob.glob('**/*.py', recursive=True)
    for f in files:
        if '.venv' in f:
            continue
        print(f"Formatting {f}...")
        with open(f, 'r', encoding='utf-8') as file:
            source = file.read()

        fixed = autopep8.fix_code(
            source,
            options={
                'max_line_length': 79,
                'aggressive': 2})

        with open(f, 'w', encoding='utf-8') as file:
            file.write(fixed)


if __name__ == "__main__":
    format_all()