mirror of
https://github.com/vinta/awesome-python
synced 2024-11-15 00:07:24 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
beb08bfb6b
5 changed files with 1115 additions and 970 deletions
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
## What is this Python project?
|
||||
|
||||
Describe features.
|
||||
|
||||
## What's the difference between this Python project and similar ones?
|
||||
|
||||
Enumerate comparisons.
|
||||
|
||||
--
|
||||
|
||||
Anyone who agrees with this pull request could vote for it by adding a :+1: to it, and usually, the maintainer will merge it when votes reach **20**.
|
10
.travis.yml
Normal file
10
.travis.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
language: ruby
|
||||
|
||||
rvm:
|
||||
- 2.2
|
||||
|
||||
before_script:
|
||||
- gem install awesome_bot
|
||||
|
||||
script:
|
||||
- awesome_bot README.md --allow-dupe --white-list pyparsing,graphviz.org
|
|
@ -4,12 +4,14 @@ Your contributions are always welcome!
|
|||
|
||||
## Guidelines
|
||||
|
||||
* Add section if needed.
|
||||
* Add section description.
|
||||
* Add section title to Table of contents.
|
||||
* Add one link per Pull Request.
|
||||
* Add the link: `* [project-name](http://example.com/) - A short description ends with a period.`
|
||||
* Keep descriptions concise.
|
||||
* Add a section if needed.
|
||||
* Add the section description.
|
||||
* Add the section title to Table of Contents.
|
||||
* Search previous suggestions before making a new one, as yours may be a duplicate.
|
||||
* Add your links: `* [project-name](http://example.com/) - A short description ends with a dot.`
|
||||
* Don't mention `Python` in the description as it's implied.
|
||||
* Check your spelling and grammar.
|
||||
* Make sure your text editor is set to remove trailing whitespace.
|
||||
* Send a Pull Request.
|
||||
* Remove any trailing whitespace.
|
||||
* Send a Pull Request with the reason why the library is awesome.
|
||||
|
|
30
sort.py
30
sort.py
|
@ -13,6 +13,33 @@
|
|||
and flattening the end structure into a list of lines. Revision 2 maybe ^.^.
|
||||
"""
|
||||
|
||||
def sort_blocks():
|
||||
# First, we load the current README into memory
|
||||
with open('README.md', 'r') as read_me_file:
|
||||
read_me = read_me_file.read()
|
||||
|
||||
# Separating the 'table of contents' from the contents (blocks)
|
||||
table_of_contents = ''.join(read_me.split('- - -')[0])
|
||||
blocks = ''.join(read_me.split('- - -')[1]).split('\n# ')
|
||||
for i in range(len(blocks)):
|
||||
if i == 0:
|
||||
blocks[i] = blocks[i] + '\n'
|
||||
else:
|
||||
blocks[i] = '# ' + blocks[i] + '\n'
|
||||
|
||||
# Sorting the libraries
|
||||
inner_blocks = sorted(blocks[0].split('##'))
|
||||
for i in range(1 , len(inner_blocks)):
|
||||
if inner_blocks[i][0] != '#':
|
||||
inner_blocks[i] = '##' + inner_blocks[i]
|
||||
inner_blocks=''.join(inner_blocks)
|
||||
|
||||
# Replacing the non-sorted libraries by the sorted ones and gathering all at the final_README file
|
||||
blocks[0] = inner_blocks
|
||||
final_README = table_of_contents + '- - -' + ''.join(blocks)
|
||||
|
||||
with open('README.md', 'w+') as sorted_file:
|
||||
sorted_file.write(final_README)
|
||||
|
||||
def main():
|
||||
# First, we load the current README into memory as an array of lines
|
||||
|
@ -45,6 +72,9 @@ def main():
|
|||
# And the result is written back to README.md
|
||||
sorted_file.write(''.join(blocks))
|
||||
|
||||
# Then we call the sorting method
|
||||
sort_blocks()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue