Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #166 from themousepotato/mentor-list-populate-script
Browse files Browse the repository at this point in the history
Add script to generate list_of_mentors.json from projects.csv #165
  • Loading branch information
themousepotato authored Dec 19, 2018
2 parents 43efb84 + f9bc5d4 commit 118be6a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions kwoc/populate_mentor_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/python
#-*- coding: utf-8 -*-

import os
import csv
import json

dir_path = os.path.dirname(os.path.realpath(__file__))
root_dir = '/'.join(dir_path.split('/')[:-1])

PROJECT_CSV = os.path.join(root_dir,'gh_scraper/projects.csv')
MENTORS_JSON = os.path.join(root_dir,'gh_scraper/list_of_mentors.json')

def main():
mentors = []

with open(PROJECT_CSV, 'r') as f:
table = csv.reader(f)
for row in table:
mentors.append('{mentor} | {project}'.format(mentor=row[0], project=row[2]))

with open(MENTORS_JSON, 'w') as f:
mentors = mentors[1:]
mentors = list(set(mentors))
mentors.sort()
json.dump(mentors, f)

if __name__ == '__main__':
main()

0 comments on commit 118be6a

Please sign in to comment.