Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,11 @@ def AddEmailEmployerMapping (email, employer, end = nextyear, domain = False):
# LG: Artificial Domains from Hacker's email domain names
ArtificialDomains = {}
def GetHackerDomain(dom, email):
new_dom = ''.join(map(lambda x: x.lower().capitalize(), dom.split('.')[:-1]))
parts = dom.split('.')
# If the domain has no dot (e.g. "localhost"), keep the whole value so we
# generate a meaningful label instead of just " *".
name_parts = parts if len(parts) == 1 else parts[:-1]
new_dom = ''.join(map(lambda x: x.lower().capitalize(), name_parts))
new_dom += ' *'
key = (new_dom, dom)
if key not in ArtificialDomains:
Expand All @@ -420,7 +424,10 @@ def MapToEmployer (email, unknown = 0):
if len (namedom) < 2:
print 'Oops...funky email %s' % email_encode(email)
return [(nextyear, GetEmployer ('Funky'), False)]
s = namedom[1].split ('.')
domain = namedom[1]
s = domain.split ('.')
# Keep a usable default for unknown==1 even when the domain has no dots.
addr = domain
for dots in range (len (s) - 2, -1, -1):
addr = '.'.join (s[dots:])
try:
Expand Down
2 changes: 1 addition & 1 deletion src/logparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def getDate(self, line):
arr2 = []
for i in range(len(arr) - 1):
s = arr[i]
if s != '' and s != 'Date:':
if s and s not in ('Date:', 'CommitDate:'):
arr2.append(s)
datestr = ' '.join(arr2)
date = datetime.datetime.strptime(datestr, '%a %b %d %H:%M:%S %Y')
Expand Down