MCPcopy Create free account
hub / github.com/PyWavelets/pywt / analyze_line

Function analyze_line

util/authors.py:46–72  ·  view source on GitHub ↗
(line, names, disp=False)

Source from the content-addressed store, hash-verified

44 authors = set()
45
46 def analyze_line(line, names, disp=False):
47 line = line.strip().decode('utf-8')
48
49 # Check the commit author name
50 m = re.match('^@@@([^@]*)@@@', line)
51 if m:
52 name = m.group(1)
53 line = line[m.end():]
54 name = NAME_MAP.get(name, name)
55 if disp:
56 if name not in names:
57 stdout_b.write(f" - Author: {name}\n".encode())
58 names.add(name)
59
60 # Look for "thanks to" messages in the commit log
61 m = re.search(r'([Tt]hanks to|[Cc]ourtesy of) ([A-Z][A-Za-z]*? [A-Z][A-Za-z]*? [A-Z][A-Za-z]*|[A-Z][A-Za-z]*? [A-Z]\. [A-Z][A-Za-z]*|[A-Z][A-Za-z ]*? [A-Z][A-Za-z]*|[a-z0-9]+)($|\.| )', line)
62 if m:
63 name = m.group(2)
64 if name not in ('this',):
65 if disp:
66 stdout_b.write(f" - Log : {line.strip().encode('utf-8')}\n")
67 name = NAME_MAP.get(name, name)
68 names.add(name)
69
70 line = line[m.end():].strip()
71 line = re.sub(r'^(and|, and|, ) ', 'Thanks to ', line)
72 analyze_line(line.encode('utf-8'), names)
73
74 # Find all authors before the named range
75 for line in git.pipe('log', '--pretty=@@@%an@@@%n@@@%cn@@@%n%b',

Callers 1

mainFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected