Last active
April 19, 2018 01:05
-
-
Save lauromoura/23ca4fa4c420cf225865e6fd8e12041d to your computer and use it in GitHub Desktop.
Generate a report of efl developers from the devs git repo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env | |
''' | |
Generate a report of efl's developers. | |
''' | |
import os | |
from collections import defaultdict | |
from tabulate import tabulate | |
def main(): | |
target_filename = 'info.txt' | |
categories = [ | |
'Login', | |
'Name', | |
'IRC Nick', | |
'E-Mail', | |
'Location', | |
'Managing', # Line too long... | |
'Contributing', | |
'Platform' | |
] | |
data = defaultdict(lambda: defaultdict(dict)) | |
tiers = ('developers', 'probies') | |
for root, _, files in os.walk('.'): | |
if not target_filename in files or 'inactive' in root: | |
continue | |
tier, username = os.path.split(root) | |
tier = os.path.split(tier)[1] | |
with open(os.path.join(root, target_filename)) as handle: | |
for line in handle: | |
if not line.strip(): | |
continue | |
key, value = [x.strip() for x in line.strip().split(':', maxsplit=1)] | |
if key not in categories: | |
continue | |
else: | |
if len(value) > 30: | |
sep = ',' if ',' in value else ' ' | |
value = '\n'.join(x.strip() for x in value.split(sep)) | |
data[tier][username][key] = value | |
for tier in tiers: | |
print('==== %s ====' % tier.capitalize()) | |
print(tabulate(data[tier].values(), headers='keys', tablefmt='grid')) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment