Skip to content

Commit

Permalink
Merge pull request #16 from hust-open-atom-club/fix_edu
Browse files Browse the repository at this point in the history
  • Loading branch information
tttturtle-russ committed Aug 20, 2024
2 parents 240e1d2 + 90caafc commit 582b015
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion linux-statistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
import requests
from tqdm import tqdm

def is_university_domain(test_domain, uni_list):
'''
Verify if the provided domain is a university domain in the uni_list
'''
for university in uni_list:
if test_domain in university["domains"]:
return True

for university in uni_list:
for raw_domain in university["domains"]:
# domain: sc.edu
# raw_domain: osc.edu
if test_domain.endswith(raw_domain):
return True
return False

parser = ArgumentParser()
parser.add_argument("--branch", type=str, default="master")
parser.add_argument("--path", type=str, default="/tmp/linux")
Expand Down Expand Up @@ -51,7 +67,7 @@
continue
# get email domain
domain = email.split("@")[-1]
if not ".edu" in domain:
if not is_university_domain(domain, university_list):
continue

result_patches[domain] = result_patches.get(domain, 0) + 1
Expand Down

0 comments on commit 582b015

Please sign in to comment.