File: make_clean_config.py

package info (click to toggle)
python-mne 0.8.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 87,892 kB
  • ctags: 6,639
  • sloc: python: 54,697; makefile: 165; sh: 15
file content (30 lines) | stat: -rwxr-xr-x 778 bytes parent folder | download
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
27
28
29
30
#! /usr/bin/env python

import os

fullfid = open(os.path.join(os.path.split(__file__)[0], os.path.pardir, os.path.pardir,
                            "data", "configfiles", "full_configbase.py"), "r")
cleanfid = open(os.path.join(os.path.split(__file__)[0], os.path.pardir, os.path.pardir,
                            "data", "configfiles", "clean_configbase.py"), "w")

write = True
lastflip = None

def flip(value):
    if value:
        return False
    else:
        return True

for num, line in enumerate(fullfid):

    if not line.startswith("#--"):
        if line.startswith("\"\"\"") and num > 15:
            write = flip(write)
            lastflip = num

        if write and not lastflip == num:
            cleanfid.write(line)

fullfid.close()
cleanfid.close()