mirror of
https://github.com/vinta/awesome-python.git
synced 2024-12-02 16:31:06 +00:00
Minor code fix
This commit is contained in:
parent
8096f47754
commit
6a502dd8aa
8
sort.py
8
sort.py
|
@ -29,10 +29,10 @@ def sort_blocks():
|
||||||
|
|
||||||
# Sorting the libraries
|
# Sorting the libraries
|
||||||
inner_blocks = sorted(blocks[0].split('##'))
|
inner_blocks = sorted(blocks[0].split('##'))
|
||||||
for i in range(1 , len(inner_blocks)):
|
for i in range(1, len(inner_blocks)):
|
||||||
if inner_blocks[i][0] != '#':
|
if inner_blocks[i][0] != '#':
|
||||||
inner_blocks[i] = '##' + inner_blocks[i]
|
inner_blocks[i] = '##' + inner_blocks[i]
|
||||||
inner_blocks=''.join(inner_blocks)
|
inner_blocks = ''.join(inner_blocks)
|
||||||
|
|
||||||
# Replacing the non-sorted libraries by the sorted ones and gathering all at the final_README file
|
# Replacing the non-sorted libraries by the sorted ones and gathering all at the final_README file
|
||||||
blocks[0] = inner_blocks
|
blocks[0] = inner_blocks
|
||||||
|
@ -68,7 +68,9 @@ def main():
|
||||||
|
|
||||||
with open('README.md', 'w+') as sorted_file:
|
with open('README.md', 'w+') as sorted_file:
|
||||||
# Then all of the blocks are sorted individually
|
# Then all of the blocks are sorted individually
|
||||||
blocks = [''.join(sorted(block, key=lambda s: s.lower())) for block in blocks]
|
blocks = [
|
||||||
|
''.join(sorted(block, key=str.lower)) for block in blocks
|
||||||
|
]
|
||||||
# And the result is written back to README.md
|
# And the result is written back to README.md
|
||||||
sorted_file.write(''.join(blocks))
|
sorted_file.write(''.join(blocks))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user