summaryrefslogtreecommitdiff
path: root/doc/_ext/px_cleaner.py
blob: 24541207eaf826a438a5e18c3c79f7114e6a080c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Clean up .px files created by Sphinx."""

import sys

def clean_px(fname):
    """Clean a px file."""

    with open(fname) as f:
        text = f.read()
    text = text.lstrip()
    with open(fname, "w") as f:
        f.write(text)

def clean_px_files(fnames):
    for fname in fnames:
        clean_px(fname)

if __name__ == '__main__':
    clean_px_files(sys.argv[1:])