Yield an iterable of (email, line_number) found in file at ``location``. Only return unique items if ``unique`` is True.
(location, unique=True)
| 125 | |
| 126 | |
| 127 | def 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 | |
| 148 | def junk_email_domains_filter(matches): |
no test coverage detected