Filter out the URL and email addresses.
770640
def _filter(self, text):
        """"""

        if self.urls:
            text = RE_LINK.sub('', text)
        if self.emails:
            text = RE_MAIL.sub('', text)
        return text
341767
def clean_email(self):
        
        contacts = self.api.lists.contacts(id=self.list_id)['result']

        for contact in contacts:
            if contact['email'] == self.cleaned_data['email']:
                raise forms.ValidationError(
                    _(u'This email is already subscribed'))

        return self.cleaned_data['email']
710072
def filter(self, table, idps, filter_string):
        """"""
        q = filter_string.lower()
        return [idp for idp in idps
                if q in idp.ud.lower()]
268221
def filter(self, table, cgroups, filter_string):
        """"""
        query = filter_string.lower()
        return [cgroup for cgroup in cgroups
                if query in cgroup.name.lower()]
841687
def clean_url(url):
        """"""
        if not url.startswith(('http://', 'https://')):
            url = f'http://{url}'

        if not URL_RE.match(url):
            raise BadURLException(f'{url} is not valid')

        return url
166142
def clean_addresses(addresses):
    
    if addresses is None:
        return []
    addresses = addresses.replace("\'", "")
    address_list = re.split('[,;]', addresses)
    clean_list = []
    for address in address_list:
        temp_clean_address = clean_address(address)
        clean_list.append(temp_clean_address)
    return clean_list
891614
def __filter(self, name):
        '''
        '''

        name = name.replace("'", '')
        name = name.replace('"', '')
        name = name.replace('!(null)', '')
        name = name.replace(" ", "_")
        name = name.replace("/", "_")
        name = name.replace(".", "_")
        return name.lower()
897310
def email_address_to_list(email_address):
    """"""
    realname, address = email.utils.parseaddr(email_address)
    return (
        [address, realname] if realname and address else
        [email_address, email_address]
    )
551560
function filterImageUrls (elem, urls) {
        var child = elem.firstChild;
        while (child) {
            if (child.tagName == 'IMG') {
                var url = child.src;
                if (urls.indexOf(url) == -1) {
                    urls.push(url);
                }
            }

            filterImageUrls(child, urls);

            child = child.nextSibling;
        }
    }
249209
def by_email_address(cls, email):
        """"""
        return DBSession.query(cls).filter_by(email_address=email).first()
915534
def filter_host_by_regex(regex):
    
    host_re = re.compile(regex)

    def inner_filter(items):
        """Inner filter for host. Accept if regex match host_name"""
        host = items["host"]
        if host is None:
            return False
        return host_re.match(host.host_name) is not None

    return inner_filter
1087736
def _sanitize_url_components(comp_list, field):
    '''
    
    '''
    if not comp_list:
        return ''
    elif comp_list[0].startswith('{0}='.format(field)):
        ret = '{0}=XXXXXXXXXX&'.format(field)
        comp_list.remove(comp_list[0])
        return ret + _sanitize_url_components(comp_list, field)
    else:
        ret = '{0}&'.format(comp_list[0])
        comp_list.remove(comp_list[0])
        return ret + _sanitize_url_components(comp_list, field)
182489
def filtered(self):
        """"""
        if not is_tagged(self.tags, self.opt.tags):
            LOG.info("Skipping %s as it does not have requested tags",
                     self.path)
            return False

        if not specific_path_check(self.path, self.opt):
            LOG.info("Skipping %s as it does not match specified paths",
                     self.path)
            return False

        return True
505766
def filter(self, record):
        """"""
        if isinstance(record.msg, basestring):
            message = record.msg.lower()
            if all(kw in message for kw in self.KEYWORDS):
                record.levelname = 'DEBUG'
                record.levelno = logging.DEBUG
        return 1
253749
def user_parse(data):
        """"""
        for email in data.get('emails', []):
            if email.get('primary'):
                yield 'id', email.get('email')
                yield 'email', email.get('email')
                break
843628
def clean_url(url, base_url=None):
    """"""
    parsed_url = urlparse(url)

    fragment = '{url.fragment}'.format(url=parsed_url)
    if fragment:
        url = url.split(fragment)[0]

    # Identify internal URLs and fix their format
    netloc = '{url.netloc}'.format(url=parsed_url)
    if base_url is not None and not netloc:
        parsed_base = urlparse(base_url)
        split_base = '{url.scheme}://{url.netloc}{url.path}/'.format(url=parsed_base)
        url = urljoin(split_base, url)
        netloc = '{url.netloc}'.format(url=urlparse(url))

    if 'www.' in netloc:
        url = url.replace(netloc, netloc.replace('www.', ''))
    return url.rstrip(string.punctuation)
774342
def delete(self, urls=None, **overrides):
        """"""
        if urls is not None:
            overrides['urls'] = urls
        return self.where(accept='DELETE', **overrides)