()
| 15 | |
| 16 | |
| 17 | def main(): |
| 18 | folder = 'docs/source/whatsnew/pr/' |
| 19 | assert folder.endswith('/') |
| 20 | files = glob.glob(folder+'*.rst') |
| 21 | print(files) |
| 22 | |
| 23 | for filename in files: |
| 24 | print('Adding pseudo-title to:', filename) |
| 25 | title = filename[:-4].split('/')[-1].replace('-', ' ').capitalize() |
| 26 | |
| 27 | with open(filename) as f: |
| 28 | data = f.read() |
| 29 | try: |
| 30 | if data and data.splitlines()[1].startswith('='): |
| 31 | continue |
| 32 | except IndexError: |
| 33 | pass |
| 34 | |
| 35 | with open(filename, 'w') as f: |
| 36 | f.write(title+'\n') |
| 37 | f.write('='* len(title)+'\n\n') |
| 38 | f.write(data) |
| 39 | |
| 40 | if __name__ == '__main__': |
| 41 | main() |
no test coverage detected