@@ -128,10 +128,8 @@ def find_emails(location):
128128 """
129129 patterns = [('emails' , emails_regex (),)]
130130 matches = find (location , patterns )
131- matches = apply_filters (matches ,
132- junk_email_domains_filter ,
133- unique_filter ,
134- )
131+ email_filters = (junk_email_domains_filter , unique_filter ,)
132+ matches = apply_filters (matches , * email_filters )
135133 for _key , email , _line in matches :
136134 yield email
137135
@@ -171,17 +169,14 @@ def urls_regex():
171169
172170INVALID_URLS_PATTERN = '(ht|f)tp[s]?://([$%*/_])+'
173171
174-
175172def find_urls (location ):
176173 """
177174 Yield urls found in file at location.
178175 """
179176 patterns = [('urls' , urls_regex (),)]
180177 matches = find (location , patterns )
181178
182- # the order of filters IS important
183- matches = apply_filters (
184- matches ,
179+ url_filters = (
185180 verbatim_crlf_url_cleaner ,
186181 end_of_url_cleaner ,
187182 empty_urls_filter ,
@@ -193,6 +188,10 @@ def find_urls(location):
193188 junk_urls_filter ,
194189 unique_filter ,
195190 )
191+
192+
193+ # the order of filters IS important
194+ matches = apply_filters (matches , url_filters )
196195 for _key , url , _line in matches :
197196 yield unicode (url )
198197
0 commit comments