File: io_formats.py

package info (click to toggle)
python-ase 3.26.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (38 lines) | stat: -rw-r--r-- 1,430 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
31
32
33
34
35
36
37
38
# creates: formatoptions.rst
from ase.io.formats import all_formats

with open('formatoptions.rst', 'w') as fd:
    print('============================================', file=fd)
    print('Format Specific Options', file=fd)
    print('============================================', file=fd)
    format_names = sorted(all_formats.keys())
    for name in format_names:
        fmt = all_formats[name]
        print(f'.. _{name}:\n', file=fd)
        print(name, file=fd)
        print('----------------------------------------', file=fd)
        if fmt.can_read:
            print(
                '\n .. autofunction:: {:}.read_{:}\n\n'.format(
                    fmt.module_name, fmt._formatname
                ),
                file=fd,
            )
        if fmt.can_write:
            print(
                '\n .. autofunction:: {:}.write_{:}\n\n'.format(
                    fmt.module_name, fmt._formatname
                ),
                file=fd,
            )
        if (not fmt.can_read) and (not fmt.can_write):
            print(
                '\n No automatic documentation of this module found.', file=fd
            )
            print(
                '\n Visit '
                'https://gitlab.com/ase/ase/tree/master/ase/io/{:}.py'
                ' to see if you find the information needed in '
                'the source code.\n\n'.format(fmt.module_name),
                file=fd,
            )