File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ I'm really greatful to all the contributors. Following are the awesome people (in no specific order) who have contributed their examples to wtfpython.
2+
3+ | Contributor | Github | Issues |
4+ | -------------| --------| --------|
5+ | Lucas-C | [ Lucas-C] ( https://github.com/Lucas-C ) | [ #36 ] ( https:/github.com/satwikkansal/wtfpython/issues/36 ) |
6+ | MittalAshok | [ MittalAshok] ( https://github.com/MittalAshok ) | [ #23 ] ( https:/github.com/satwikkansal/wtfpython/issues/23 ) |
7+ | asottile | [ asottile] ( https://github.com/asottile ) | [ #40 ] ( https:/github.com/satwikkansal/wtfpython/issues/40 ) |
8+ | MostAwesomeDude | [ MostAwesomeDude] ( https://github.com/MostAwesomeDude ) | [ #1 ] ( https:/github.com/satwikkansal/wtfpython/issues/1 ) |
9+ | tukkek | [ tukkek] ( https://github.com/tukkek ) | [ #11 ] ( https:/github.com/satwikkansal/wtfpython/issues/11 ) , [ #26 ] ( https:/github.com/satwikkansal/wtfpython/issues/26 ) |
10+ | PiaFraus | [ PiaFraus] ( https://github.com/PiaFraus ) | [ #9 ] ( https:/github.com/satwikkansal/wtfpython/issues/9 ) |
11+ | chris-rands | [ chris-rands] ( https://github.com/chris-rands ) | [ #32 ] ( https:/github.com/satwikkansal/wtfpython/issues/32 ) |
12+
13+ Thank you all for taking out time, and making this project better!
14+
Original file line number Diff line number Diff line change 1+ """
2+ Parses the README.md and generated the table
3+ `CONTRIBUTORS.md`.
4+ """
5+
6+ import pprint
7+ import re
8+ import requests
9+
10+ regex = ("[sS]uggested by @(\S+) in \[this\]\(https:\/\/github\.com\/satwikkansal"
11+ "\/wtf[pP]ython\/issues\/(\d+)\) issue" )
12+
13+
14+ fname = "README.md"
15+ contribs = {}
16+
17+ table_header = """
18+ | Contributor | Github | Issues |
19+ |-------------|--------|--------|
20+ """
21+
22+ table_row = '| {} | [{}](https://github.com/{}) | {} |'
23+ issue_format = '[#{}](https:/github.com/satwikkansal/wtfpython/issues/{})'
24+ rows_so_far = []
25+
26+ github_rest_api = "https://api.github.com/users/{}"
27+
28+
29+ with open (fname , 'r' ) as f :
30+ file_content = f .read ()
31+ matches = re .findall (regex , file_content )
32+ for match in matches :
33+ if contribs .get (match [0 ]) and match [1 ] not in contribs [match [0 ]]:
34+ contribs [match [0 ]].append (match [1 ])
35+ else :
36+ contribs [match [0 ]] = [match [1 ]]
37+
38+ for handle , issues in contribs .items ():
39+ issue_string = ', ' .join ([issue_format .format (i , i ) for i in issues ])
40+ resp = requests .get (github_rest_api .format (handle ))
41+ name = handle
42+ if resp .status_code is 200 :
43+ pprint .pprint (resp .json ()['name' ])
44+ else :
45+ print (handle , resp .content )
46+ rows_so_far .append (table_row .format (name ,
47+ handle ,
48+ handle ,
49+ issue_string ))
50+
51+ print (table_header + "\n " .join (rows_so_far ))
You can’t perform that action at this time.
0 commit comments