@@ -23,21 +23,17 @@ def sort_blocks():
23
23
table_of_contents = '' .join (read_me .split ('- - -' )[0 ])
24
24
blocks = '' .join (read_me .split ('- - -' )[1 ]).split ('\n # ' )
25
25
for i in range (len (blocks )):
26
- if i == 0 :
27
- blocks [i ] = blocks [i ] + '\n '
28
- else :
29
- blocks [i ] = '# ' + blocks [i ] + '\n '
30
-
26
+ blocks [i ] = blocks [i ] + '\n ' if i == 0 else f'# { blocks [i ]} ' + '\n '
31
27
# Sorting the libraries
32
28
inner_blocks = sorted (blocks [0 ].split ('##' ))
33
29
for i in range (1 , len (inner_blocks )):
34
30
if inner_blocks [i ][0 ] != '#' :
35
- inner_blocks [i ] = '##' + inner_blocks [i ]
31
+ inner_blocks [i ] = f '##{ inner_blocks [i ]} '
36
32
inner_blocks = '' .join (inner_blocks )
37
33
38
34
# Replacing the non-sorted libraries by the sorted ones and gathering all at the final_README file
39
35
blocks [0 ] = inner_blocks
40
- final_README = table_of_contents + ' - - -' + '' .join (blocks )
36
+ final_README = f' { table_of_contents } - - -' + '' .join (blocks )
41
37
42
38
with open ('README.md' , 'w+' ) as sorted_file :
43
39
sorted_file .write (final_README )
@@ -57,7 +53,7 @@ def main():
57
53
s_line = line .lstrip ()
58
54
indent = len (line ) - len (s_line )
59
55
60
- if any ([ s_line .startswith (s ) for s in ['* [' , '- [' ] ]):
56
+ if any (s_line .startswith (s ) for s in ['* [' , '- [' ]):
61
57
if indent == last_indent :
62
58
blocks [- 1 ].append (line )
63
59
else :
0 commit comments