MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / find_emails

Function find_emails

src/cluecode/finder.py:127–145  ·  view source on GitHub ↗

Yield an iterable of (email, line_number) found in file at ``location``. Only return unique items if ``unique`` is True.

(location, unique=True)

Source from the content-addressed store, hash-verified

125
126
127def find_emails(location, unique=True):
128 """
129 Yield an iterable of (email, line_number) found in file at ``location``.
130 Only return unique items if ``unique`` is True.
131 """
132 patterns = [('emails', emails_regex(),)]
133 matches = find(location, patterns)
134
135 if TRACE_EMAIL:
136 matches = list(matches)
137 for r in matches:
138 logger_debug('find_emails: match:', r)
139
140 filters = (junk_email_domains_filter, uninteresting_emails_filter)
141 if unique:
142 filters += (unique_filter,)
143 matches = apply_filters(matches, *filters)
144 for _key, email, _line, line_number in matches:
145 yield email, line_number
146
147
148def junk_email_domains_filter(matches):

Callers 2

get_ignorablesFunction · 0.90
get_emailsFunction · 0.90

Calls 4

emails_regexFunction · 0.85
findFunction · 0.85
apply_filtersFunction · 0.85
logger_debugFunction · 0.70

Tested by

no test coverage detected