|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | # encoding: utf-8 |
3 | 3 |
|
4 | | -''' |
| 4 | +""" |
5 | 5 |
|
6 | 6 | Originally created for Ursgal ( https://github.com/ursgal/ursgal ) |
7 | 7 |
|
8 | 8 |
|
9 | | -''' |
| 9 | +""" |
10 | 10 |
|
11 | 11 | import glob |
12 | 12 | import os |
13 | 13 |
|
14 | | -if __name__ == '__main__': |
15 | | - print(''' |
| 14 | +if __name__ == "__main__": |
| 15 | + print( |
| 16 | + """ |
16 | 17 | Formatting example scripts into rst files for the docs |
17 | | -''') |
| 18 | +""" |
| 19 | + ) |
18 | 20 | # input() |
19 | 21 | example_script_path = os.path.join( |
20 | 22 | os.path.dirname(__file__), |
21 | 23 | os.pardir, |
22 | | - 'example_scripts', |
23 | | - '*.py', |
| 24 | + "example_scripts", |
| 25 | + "*.py", |
24 | 26 | ) |
25 | 27 | print(example_script_path) |
26 | 28 | for example_script in glob.glob(example_script_path): |
27 | 29 | if os.path.exists(example_script) is False: |
28 | 30 | continue |
29 | 31 | basename = os.path.basename(example_script) |
30 | | - print( |
31 | | - 'Reading: {0}'.format(example_script) |
32 | | - ) |
| 32 | + print("Reading: {0}".format(example_script)) |
33 | 33 | file_path = os.path.join( |
34 | 34 | os.path.dirname(__file__), |
35 | | - 'source', |
36 | | - 'code_inc', |
37 | | - '{0}', |
| 35 | + "source", |
| 36 | + "code_inc", |
| 37 | + "{0}", |
38 | 38 | ) |
39 | | - with open( file_path.format( basename.replace('.py', '.inc')), 'w') as o: |
40 | | - print('''.. code-block:: python\n''', file=o) |
41 | | - with open( example_script ) as infile: |
| 39 | + with open(file_path.format(basename.replace(".py", ".inc")), "w") as o: |
| 40 | + print(""".. code-block:: python\n""", file=o) |
| 41 | + with open(example_script) as infile: |
42 | 42 | for line in infile: |
43 | | - print('\t{0}'.format( line.rstrip()), file=o) |
44 | | - |
45 | | - |
| 43 | + print("\t{0}".format(line.rstrip()), file=o) |
0 commit comments