MCPcopy Create free account
hub / github.com/ipython/ipython / main

Function main

tools/fixup_whats_new_pr.py:17–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16
17def 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
40if __name__ == '__main__':
41 main()

Callers 1

Calls 2

readMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected