PageRenderTime 3745ms queryTime 116ms sortTime 2ms getByIdsTime 548ms findMatchingLines 312ms

100+ results results for 'email regex lang:python' (3745 ms)

Not the results you expected?
completions.py https://gitlab.com/vectorci/gitsome | Python | 330 lines
                    
58    },
                    
59    'emails': {
                    
60        'desc': "Lists all the user's registered emails.",
                    
310    '10': 'limit: int (opt) limits the posts displayed',
                    
311    '"(?i)(Python|Django)"': ('regex_query: string (opt) applies a regular '
                    
312                              'expression comment filter'),
                    
                
http.py https://gitlab.com/briankiragu/django | Python | 376 lines
                    
9from binascii import Error as BinasciiError
                    
10from email.utils import formatdate
                    
11
                    
134    """
                    
135    # emails.Util.parsedate does the job for RFC1123 dates; unfortunately
                    
136    # RFC7231 makes it mandatory to support RFC850 dates too. So we roll
                    
137    # our own RFC-compliant parsing.
                    
138    for regex in RFC1123_DATE, RFC850_DATE, ASCTIME_DATE:
                    
139        m = regex.match(date)
                    
                
forms.py https://github.com/chengwang/kitsune.git | Python | 195 lines
                    
49                        'max_length': USERNAME_LONG})
                    
50    email = forms.EmailField(label=_lazy(u'Email address:'),
                    
51                             error_messages={'required': EMAIL_REQUIRED,
                    
80        email = self.cleaned_data['email']
                    
81        if User.objects.filter(email=email).exists():
                    
82            raise forms.ValidationError(_('A user with that email address '
                    
178    """A simple form that requires an email address."""
                    
179    email = forms.EmailField(label=_lazy(u'Email address:'))
                    
180
                    
184    not the current user's email."""
                    
185    email = forms.EmailField(label=_lazy(u'Email address:'))
                    
186
                    
191    def clean_email(self):
                    
192        if self.user.email == self.cleaned_data['email']:
                    
193            raise forms.ValidationError(_('This is your current email.'))
                    
                
find_domain_arch.py https://github.com/ntamas/gfam.git | Python | 295 lines
                    
17__author__  = "Tamas Nepusz"
                    
18__email__   = "tamas@cs.rhul.ac.uk"
                    
19__copyright__ = "Copyright (c) 2010, Tamas Nepusz"
                    
70                default=None)
                    
71        parser.add_option("-r", "--seq-id-regexp", metavar="REGEXP",
                    
72                help="remap sequence IDs using REGEXP",
                    
72                help="remap sequence IDs using REGEXP",
                    
73                config_key="sequence_id_regexp",
                    
74                dest="sequence_id_regexp")
                    
205        unassigned_app = FindUnassignedApp()
                    
206        unassigned_app.set_sequence_id_regexp(self.options.sequence_id_regexp)
                    
207        unassigned_app.process_sequences_file(self.options.sequences_file)
                    
                
pages.py https://github.com/laurentb/weboob.git | Python | 207 lines
                    
27from weboob.browser.elements import ListElement, ItemElement, method
                    
28from weboob.browser.filters.standard import CleanText, Format, Regexp, Env, DateTime, Filter
                    
29from weboob.browser.filters.html import Link, Attr
                    
69            form = self.get_form(xpath='//form[@action="https://twitter.com/sessions"]')
                    
70            form['session[username_or_email]'] = login
                    
71            form['session[password]'] = passwd
                    
85    def get_me(self):
                    
86        return Regexp(Link('//a[@data-nav="view_profile"]'), '/(.+)')(self.doc)
                    
87
                    
100                                     replace=[('@ ', '@'), ('# ', '#'), ('http:// ', 'http://')]))
                    
101        obj_date = DateTime(Regexp(CleanText('//div[has-class("permalink-inner permalink-tweet-container")]/div/div/div[@class="client-and-actions"]/span/span'),
                    
102                                   '(\d+:\d+).+- (.+\d{4})',
                    
111
                    
112            obj_id = Regexp(Link('./div/div/small/a', default=''), '/.+/status/(.+)', default=None)
                    
113
                    
                
diffcommit.py https://github.com/reviewboard/reviewboard.git | Python | 393 lines
                    
41    uri_object_key = 'commit_id'
                    
42    uri_object_key_regex = r'[A-Za-z0-9]{1,%s}' % COMMIT_ID_LENGTH
                    
43
                    
65        },
                    
66        'author_email': {
                    
67            'type': StringFieldType,
                    
83        },
                    
84        'committer_email': {
                    
85            'type': StringFieldType,
                    
                
app.py https://github.com/dimagi/aremind.git | Python | 242 lines
                    
32
                    
33def daily_email_callback(router, *args, **kwargs):
                    
34    """
                    
34    """
                    
35    Send out daily email report of confirmed/unconfirmed appointments.
                    
36    """
                    
54        subject = subject_template.format(**context)
                    
55        body = render_to_string('reminders/emails/daily_report_message.html', context)
                    
56        group_name = settings.DEFAULT_DAILY_REPORT_GROUP_NAME
                    
58        if not created:
                    
59            emails = [c.email for c in group.contacts.all() if c.email]
                    
60            if emails:
                    
60            if emails:
                    
61                send_mail(subject, body, None, emails, fail_silently=True)
                    
62
                    
                
__init__.py https://github.com/ceberhardt/surf.git | Python | 403 lines
                    
5# author: Cosmin Basca
                    
6# email: cosmin.basca@gmail.com
                    
7
                    
85    @classmethod
                    
86    def regex(cls, var, pattern, flag = None):
                    
87        if type(var) in [str, unicode] and var.startswith('?'): pass
                    
100
                    
101        return Filter('regex(%s,"%s"%s)' % (var, pattern, ',"%s"' % flag))
                    
102
                    
                
deploy.py https://gitlab.com/gregtyka/server | Python | 283 lines
                    
71    else:
                    
72        email = raw_input("App Engine Email: ")
                    
73        password = getpass.getpass("Password for %s: " % email)
                    
73        password = getpass.getpass("Password for %s: " % email)
                    
74        return (email, password)
                    
75
                    
121    # to verify deploy is being sent from correct directory.
                    
122    regex = re.compile("^facebook_app_secret = '4362.+'$", re.MULTILINE)
                    
123    return regex.search(content)
                    
163
                    
164def deploy(version, email, password):
                    
165    print "Deploying version " + str(version)
                    
165    print "Deploying version " + str(version)
                    
166    return 0 == popen_return_code(['appcfg.py', '-V', str(version), "--no_oauth2", "-e", email, "--passin", "update", "."], "%s\n" % password)
                    
167
                    
                
scrub.py https://gitlab.com/mailman/django-mailman3 | Python | 284 lines
                    
22from email.header import decode_header, make_header
                    
23from email.message import EmailMessage
                    
24from enum import Enum
                    
32SRE = re.compile(r'[^-\w.]')
                    
33# Regexp to strip out leading dots
                    
34DRE = re.compile(r'^\.*')
                    
58    """
                    
59    Given an EmailMessage, extract all the attachments including text/html
                    
60    parts and return the text.
                    
65    def __init__(self, msg):
                    
66        assert isinstance(msg, EmailMessage)
                    
67        self.msg = msg
                    
69    def scrub(self):
                    
70        """Given a EmailMessage, extracts the text from the body and all the
                    
71        attachments.
                    
                
forms.py https://github.com/ron-panduwana/test_gae.git | Python | 131 lines
                    
20    domain = forms.RegexField(
                    
21        required=True, regex=regexps.RE_DOMAIN, label='www.',
                    
22        error_messages={'invalid': regexps.ERROR_DOMAIN})
                    
76    account = forms.RegexField(
                    
77        regex=regexps.RE_USERNAME, label=_('Administrator account'),
                    
78        error_messages={'invalid': regexps.ERROR_USERNAME})
                    
101            old_credentials = {
                    
102                'email': apps_domain.admin_email,
                    
103                'password': apps_domain.admin_password,
                    
107            if old_credentials:
                    
108                apps_domain.admin_email = old_credentials['email']
                    
109                apps_domain.admin_password = old_credentials['password']
                    
113            domain, self.service.service))
                    
114        apps_domain.admin_email = email
                    
115        apps_domain.admin_password = password
                    
                
__init__.py https://bitbucket.org/jspatrick/emacs.git | Python | 451 lines
                    
135In order to hone the accuracy of the translation of global variables, you will find two dictionary parameters below --
                    
136`global_var_include_regex` and `global_var_exclude_regex` -- which you can use to set a regular expression string
                    
137to tell the translator which global variables to share with the mel environment (i.e. which will use the get and set
                    
177are many more that i need to fix.  you'll know you hit the problem when you get this error: 'TypeError: iteration
                    
178over non-sequence'. just email me with commands that are giving you problems and i'll fix them as
                    
179quickly as i can.
                    
                
forms.py https://github.com/MediaSapiens/autonormix.git | Python | 214 lines
                    
13    """
                    
14    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
15        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
47class UserChangeForm(forms.ModelForm):
                    
48    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
49        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
106class PasswordResetForm(forms.Form):
                    
107    email = forms.EmailField(label=_("E-mail"), max_length=75)
                    
108
                    
112        """
                    
113        email = self.cleaned_data["email"]
                    
114        self.users_cache = User.objects.filter(email__iexact=email)
                    
118
                    
119    def save(self, domain_override=None, email_template_name='registration/password_reset_email.html',
                    
120             use_https=False, token_generator=default_token_generator, from_email=None, request=None):
                    
                
test_membership.py https://gitlab.com/fpeyre/mailman | Python | 274 lines
                    
101                          system_preferences.preferred_language))
                    
102        self.assertEqual(member.address.email, 'anne@example.com')
                    
103
                    
192        # mixed case address can't be subscribed.
                    
193        email = 'APerson@example.com'
                    
194        add_member(
                    
195            self._mlist,
                    
196            RequestRecord(email.lower(), 'Ann Person',
                    
197                          DeliveryMode.regular,
                    
204                              system_preferences.preferred_language))
                    
205        self.assertEqual(cm.exception.email, email)
                    
206
                    
222                              system_preferences.preferred_language))
                    
223        self.assertEqual(cm.exception.email, email.lower())
                    
224
                    
                
tests.py https://code.google.com/p/pageforest/ | Python | 324 lines
                    
18
                    
19TAG_REGEX = re.compile(r'<[/!\w][^>]*>')
                    
20
                    
43
                    
44    Users: peter, paul (not email verified)
                    
45    Apps: www, myapp
                    
60        self.peter = User(key_name='peter', username='Peter',
                    
61                          email='peter@example.com',
                    
62                          email_verified=datetime.datetime.now())
                    
65        self.paul = User(key_name='paul', username='Paul',
                    
66                         email='paul@example.com')
                    
67        self.paul.set_password('paul_secret')
                    
141        """Extract the most meaningful parts from the response."""
                    
142        text = TAG_REGEX.sub(' ', response.content)
                    
143        lines = [line.strip() for line in text.splitlines() if line.strip()]
                    
                
__init__.py https://github.com/jchris/portable-google-app-engine-sdk.git | Python | 396 lines
                    
29  [('name', str),
                    
30   ('email', datastore_types.Email),
                    
31   ('birthdate', lambda x: datetime.datetime.fromtimestamp(float(x))),
                    
40  urlmap:
                    
41  - regex: /load
                    
42    handler:
                    
177         ('id_number', int),
                    
178         ('email', datastore_types.Email),
                    
179         ('user', users.User),
                    
                
mail_mail.py https://gitlab.com/padjis/mapan | Python | 106 lines
                    
8
                    
9from odoo.addons.link_tracker.models.link_tracker import URL_REGEX
                    
10
                    
38
                    
39    def _get_unsubscribe_url(self, email_to):
                    
40        base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
                    
46                    'res_id': self.res_id,
                    
47                    'email': email_to,
                    
48                    'token': self.mailing_id._unsubscribe_token(
                    
48                    'token': self.mailing_id._unsubscribe_token(
                    
49                        self.res_id, email_to),
                    
50                }),
                    
88        if self.mailing_id and res.get('body') and res.get('email_to'):
                    
89            emails = tools.email_split(res.get('email_to')[0])
                    
90            email_to = emails and emails[0] or False
                    
                
forms.py https://bitbucket.org/xtchenhui/horizon-zte.git | Python | 196 lines
                    
62    name = forms.CharField(label=_("User Name"))
                    
63    email = forms.EmailField(label=_("Email"))
                    
64    password = forms.RegexField(
                    
66            widget=forms.PasswordInput(render_value=False),
                    
67            regex=validators.password_validator(),
                    
68            error_messages={'invalid': validators.password_validator_msg()})
                    
90                                                data['name'],
                    
91                                                data['email'],
                    
92                                                data['password'],
                    
115    name = forms.CharField(label=_("User Name"))
                    
116    email = forms.EmailField(label=_("Email"))
                    
117    password = forms.RegexField(label=_("Password"),
                    
118            widget=forms.PasswordInput(render_value=False),
                    
119            regex=validators.password_validator(),
                    
120            required=False,
                    
                
command.py https://gitlab.com/noc0lour/mailman | Python | 234 lines
                    
20# See the delivery diagram in IncomingRunner.py.  This module handles all
                    
21# email destined for mylist-request, -join, and -leave.  It no longer handles
                    
22# bounce messages (i.e. -admin or -bounces), nor does it handle mail to
                    
28from contextlib import suppress
                    
29from email.errors import HeaderParseError
                    
30from email.header import decode_header, make_header
                    
30from email.header import decode_header, make_header
                    
31from email.iterators import typed_subpart_iterator
                    
32from io import StringIO
                    
36from mailman.core.runner import Runner
                    
37from mailman.email.message import UserNotification
                    
38from mailman.interfaces.command import ContinueProcessing, IEmailResults
                    
64        elif subaddress == 'confirm':
                    
65            mo = re.match(config.mta.verp_confirm_regexp, msg.get('to', ''))
                    
66            if mo:
                    
                
forms.py https://bitbucket.org/rattray/anonbox.git | Python | 218 lines
                    
13    """
                    
14    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
15        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
47class UserChangeForm(forms.ModelForm):
                    
48    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
49        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
107class PasswordResetForm(forms.Form):
                    
108    email = forms.EmailField(label=_("E-mail"), max_length=75)
                    
109
                    
113        """
                    
114        email = self.cleaned_data["email"]
                    
115        self.users_cache = User.objects.filter(
                    
115        self.users_cache = User.objects.filter(
                    
116                                email__iexact=email,
                    
117                                is_active=True
                    
                
test_db.py https://gitlab.com/unofficial-mirrors/edx-platform | Python | 239 lines
                    
68                    try:
                    
69                        User.objects.get(username='student', email='student@edx.org')
                    
70                    except User.DoesNotExist:
                    
77
                    
78                    __, created = User.objects.get_or_create(username='student', email='student@edx.org')
                    
79                except Exception as exception:  # pylint: disable=broad-except
                    
113
                    
114        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot be inside an atomic block.'):
                    
115            with atomic():
                    
117
                    
118        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot be inside an atomic block.'):
                    
119            with outer_atomic():
                    
134
                    
135        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot change isolation level when nested.'):
                    
136            with commit_on_success():
                    
                
test_error_messages.py https://gitlab.com/asmjahid/django | Python | 274 lines
                    
6    BooleanField, CharField, ChoiceField, DateField, DateTimeField,
                    
7    DecimalField, EmailField, FileField, FloatField, Form,
                    
8    GenericIPAddressField, IntegerField, ModelChoiceField,
                    
8    GenericIPAddressField, IntegerField, ModelChoiceField,
                    
9    ModelMultipleChoiceField, MultipleChoiceField, RegexField,
                    
10    SplitDateTimeField, TimeField, URLField, ValidationError, utils,
                    
111
                    
112    def test_regexfield(self):
                    
113        e = {
                    
118        }
                    
119        f = RegexField(r'^[0-9]+$', min_length=5, max_length=10, error_messages=e)
                    
120        self.assertFormErrors(['REQUIRED'], f.clean, '')
                    
124
                    
125    def test_emailfield(self):
                    
126        e = {
                    
                
common.py https://gitlab.com/adam.lukaitis/muzei | Python | 397 lines
                    
31import datetime
                    
32from email import utils as email_utils
                    
33import logging
                    
43_GCS_BUCKET_REGEX_BASE = r'[a-z0-9\.\-_]{3,63}'
                    
44_GCS_BUCKET_REGEX = re.compile(_GCS_BUCKET_REGEX_BASE + r'$')
                    
45_GCS_BUCKET_PATH_REGEX = re.compile(r'/' + _GCS_BUCKET_REGEX_BASE + r'$')
                    
45_GCS_BUCKET_PATH_REGEX = re.compile(r'/' + _GCS_BUCKET_REGEX_BASE + r'$')
                    
46_GCS_PATH_PREFIX_REGEX = re.compile(r'/' + _GCS_BUCKET_REGEX_BASE + r'.*')
                    
47_GCS_FULLPATH_REGEX = re.compile(r'/' + _GCS_BUCKET_REGEX_BASE + r'/.*')
                    
178  _validate_path(name)
                    
179  if not _GCS_BUCKET_REGEX.match(name):
                    
180    raise ValueError('Bucket should be 3-63 characters long using only a-z,'
                    
295  if http_time is not None:
                    
296    return email_utils.mktime_tz(email_utils.parsedate_tz(http_time))
                    
297
                    
                
views.py https://github.com/eric-brechemier/django.git | Python | 191 lines
                    
38            # not be allowed, but things like /view/?param=http://example.com 
                    
39            # should be allowed. This regex checks if there is a '//' *before* a
                    
40            # question mark.
                    
105def password_reset(request, is_admin_site=False, template_name='registration/password_reset_form.html',
                    
106        email_template_name='registration/password_reset_email.html',
                    
107        password_reset_form=PasswordResetForm, token_generator=default_token_generator,
                    
107        password_reset_form=PasswordResetForm, token_generator=default_token_generator,
                    
108        post_reset_redirect=None, from_email=None):
                    
109    if post_reset_redirect is None:
                    
116            opts['token_generator'] = token_generator
                    
117            opts['from_email'] = from_email
                    
118            if is_admin_site:
                    
120            else:
                    
121                opts['email_template_name'] = email_template_name
                    
122                if not Site._meta.installed:
                    
                
validators.py https://bitbucket.org/ssaltzman/poet.git | Python | 190 lines
                    
25        if regex is not None:
                    
26            self.regex = regex
                    
27        if message is not None:
                    
32        if isinstance(self.regex, basestring):
                    
33            self.regex = re.compile(regex)
                    
34
                    
45
                    
46class URLValidator(RegexValidator):
                    
47    regex = re.compile(
                    
115
                    
116class EmailValidator(RegexValidator):
                    
117
                    
137    r')@(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?$', re.IGNORECASE)  # domain
                    
138validate_email = EmailValidator(email_re, _(u'Enter a valid e-mail address.'), 'invalid')
                    
139
                    
                
admin.py https://github.com/pombredanne/django-sentry.git | Python | 344 lines
                    
132    list_filter = ("auth_provider__provider",)
                    
133    search_fields = ("user__email", "user__username", "auth_provider__organization__name")
                    
134    raw_id_fields = ("user", "auth_provider")
                    
161class UserChangeForm(UserChangeForm):
                    
162    username = forms.RegexField(
                    
163        label=_("Username"),
                    
164        max_length=128,
                    
165        regex=r"^[\w.@+-]+$",
                    
166        help_text=_("Required. 128 characters or fewer. Letters, digits and " "@/./+/-/_ only."),
                    
175class UserCreationForm(UserCreationForm):
                    
176    username = forms.RegexField(
                    
177        label=_("Username"),
                    
178        max_length=128,
                    
179        regex=r"^[\w.@+-]+$",
                    
180        help_text=_("Required. 128 characters or fewer. Letters, digits and " "@/./+/-/_ only."),
                    
                
models.py https://github.com/kd7lxl/memrec.git | Python | 149 lines
                    
1from django.db import models
                    
2from django.core.validators import RegexValidator
                    
3
                    
7phone_re = re.compile(r'^[\d]{10}$')
                    
8validate_phone = RegexValidator(phone_re, (u"Enter a 10-digit phone number with no punctuation."), 'invalid')
                    
9
                    
10hostname_re = re.compile(r'^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$')
                    
11validate_hostname = RegexValidator(hostname_re, (u"Enter a valid hostname."), 'invalid')
                    
12
                    
91
                    
92class EmailAddress(models.Model):
                    
93    person = models.ForeignKey(Person)
                    
93    person = models.ForeignKey(Person)
                    
94    email_address = models.EmailField()
                    
95    
                    
                
inlinepatterns.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 371 lines
                    
9
                    
10    pattern.getCompiledRegExp() # returns a regular expression
                    
11
                    
135
                    
136    def getCompiledRegExp (self):
                    
137        """ Return a compiled regular expression. """
                    
350        el = markdown.etree.Element('a')
                    
351        email = m.group(2)
                    
352        if email.startswith("mailto:"):
                    
352        if email.startswith("mailto:"):
                    
353            email = email[len("mailto:"):]
                    
354
                    
362
                    
363        letters = [codepoint2name(ord(letter)) for letter in email]
                    
364        el.text = markdown.AtomicString(''.join(letters))
                    
                
__init__.py https://gitlab.com/gregtyka/server | Python | 226 lines
                    
19
                    
20from wtforms.validators import Email, email, EqualTo, equal_to, \
                    
21    IPAddress, ip_address, Length, length, NumberRange, number_range, \
                    
21    IPAddress, ip_address, Length, length, NumberRange, number_range, \
                    
22    Optional, optional, Required, required, Regexp, regexp, \
                    
23    URL, url, AnyOf, any_of, NoneOf, none_of
                    
                
lecturio.py https://gitlab.com/vitalii.dr/yt-dlp | Python | 236 lines
                    
37        login_form = {
                    
38            'signin[email]': username,
                    
39            'signin[password]': password,
                    
50
                    
51        errors = self._html_search_regex(
                    
52            r'(?s)<ul[^>]+class=["\']error_list[^>]+>(.+?)</ul>', response,
                    
152            cc_label = cc.get('translatedCode')
                    
153            lang = cc.get('languageCode') or self._search_regex(
                    
154                r'/([a-z]{2})_', cc_url, 'lang',
                    
155                default=cc_label.split()[0] if cc_label else 'en')
                    
156            original_lang = self._search_regex(
                    
157                r'/[a-z]{2}_([a-z]{2})_', cc_url, 'original lang',
                    
232
                    
233        title = self._search_regex(
                    
234            r'<h1[^>]*>([^<]+)', webpage, 'title', default=None)
                    
                
utils.py https://gitlab.com/mstolarczyk/master_thesis | Python | 372 lines
                    
3__copyright__ = "Copyright 2015, Johannes Köster"
                    
4__email__ = "koester@jimmy.harvard.edu"
                    
5__license__ = "MIT"
                    
18
                    
19from snakemake.io import regex, Namedlist, Wildcards
                    
20from snakemake.logging import logger
                    
64        dirname = os.path.dirname(pattern)
                    
65    pattern = re.compile(regex(pattern))
                    
66    for dirpath, dirnames, filenames in os.walk(dirname):
                    
131        template (str):     An optional path to a docutils HTML template.
                    
132        metadata (str):     E.g. an optional author name or email address.
                    
133
                    
                
controller.py https://gitlab.com/e0/cachecontrol | Python | 353 lines
                    
7import time
                    
8from email.utils import parsedate_tz
                    
9
                    
21def parse_uri(uri):
                    
22    """Parses a URI using the regex given in Appendix B of RFC 3986.
                    
23
                    
                
operations.py git://github.com/django/django.git | Python | 288 lines
                    
94        if lookup_type in ('iexact', 'contains', 'icontains', 'startswith',
                    
95                           'istartswith', 'endswith', 'iendswith', 'regex', 'iregex'):
                    
96            if internal_type in ('IPAddressField', 'GenericIPAddressField'):
                    
97                lookup = "HOST(%s)"
                    
98            elif internal_type in ('CICharField', 'CIEmailField', 'CITextField'):
                    
99                lookup = '%s::citext'
                    
                
player_alert.py https://gitlab.com/rgorham1/fantasy-player-alert | Python | 237 lines
                    
42            sign_in.click()
                    
43            user_name = self.browser.find_element_by_name('email')
                    
44            pw = self.browser.find_element_by_name('password')
                    
137            news_container = player_news.find_elements_by_class_name('pb')
                    
138            # TODO: change keywords to regex expressions
                    
139            keywords = ['DFS', 'boost', 'usage', 'ruled', '(', ')']
                    
170    @staticmethod
                    
171    def email(message):
                    
172        key = 'key-01577a41c5abaf547dfcdf0bc021c1f7'
                    
186        response.raise_for_status()
                    
187        print 'email sent'
                    
188
                    
204        insight = self.get_news(fd_players, pages, analysis)
                    
205        # email(insight)
                    
206
                    
                
mail_global.py https://gitlab.com/yaojian/RenjuAI | Python | 295 lines
                    
15        self.__register_macro_define()
                    
16        self.__register_regex()
                    
17        self.__register_etc(etc_file)
                    
54
                    
55    def __register_regex(self):
                    
56        self.email_reg = re.compile('[^@|\s]+@[^@]+\.[^@|\s]+')
                    
56        self.email_reg = re.compile('[^@|\s]+@[^@]+\.[^@|\s]+')
                    
57        self.email_reg_2 = re.compile(u"[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-.]+)+")
                    
58        self.email_addr_ignore = re.compile(u'undisclosed-recipients|Mail Delivery Subsystem|Mail Delivery System',
                    
59                                            flags=re.IGNORECASE)
                    
60        self.email_html_br_tag = re.compile(u"<br.*?>|<p.*?>", flags=re.IGNORECASE | re.DOTALL)
                    
61        self.email_html_tag = re.compile(u'<style.*?style>|<script.*?script>|<.*?>|[\r\t]{2,}|&nbsp;', flags=re.IGNORECASE | re.DOTALL)
                    
66
                    
67        # time regex
                    
68        """
                    
                
scrub.py https://gitlab.com/mathuin/hyperkitty | Python | 311 lines
                    
26from mimetypes import guess_all_extensions
                    
27from email.header import decode_header, make_header
                    
28from email.errors import HeaderParseError
                    
34sre = re.compile(r'[^-\w.]')
                    
35# Regexp to strip out leading dots
                    
36dre = re.compile(r'^\.*')
                    
56    Get the message charset.
                    
57    From: http://ginstrom.com/scribbles/2007/11/19/parsing-multilingual-email-with-python/
                    
58    """
                    
93    attachments.
                    
94    See also: http://ginstrom.com/scribbles/2007/11/19/parsing-multilingual-email-with-python/
                    
95    """
                    
170                    ctype.decode("ascii")
                    
171                # XXX Under email 2.5, it is possible that payload will be None.
                    
172                # This can happen when you have a Content-Type: multipart/* with
                    
                
views.py https://github.com/gorner/myewb2.git | Python | 207 lines
                    
17from account.utils import get_default_redirect
                    
18from emailconfirmation.models import EmailAddress, EmailConfirmation
                    
19from pinax.apps.account.forms import ResetPasswordKeyForm
                    
79@login_required
                    
80def email(request, form_class=AddEmailForm, template_name="account/email.html",
                    
81          username=None):
                    
109                        })
                    
110                    EmailConfirmation.objects.send_confirmation(email_address)
                    
111                except EmailAddress.DoesNotExist:
                    
113            elif request.POST["action"] == "remove":
                    
114                email = request.POST["email"]
                    
115                try:
                    
127            elif request.POST["action"] == "primary":
                    
128                email = request.POST["email"]
                    
129                email_address = EmailAddress.objects.get(
                    
                
validators.py https://github.com/sgammon/Young-Voter-Revolution.git | Python | 329 lines
                    
6    'Length', 'length', 'NumberRange', 'number_range', 'Optional', 'optional',
                    
7    'Required', 'required', 'Regexp', 'regexp', 'URL', 'url', 'AnyOf',
                    
8    'any_of', 'NoneOf', 'none_of'
                    
191        if isinstance(regex, basestring):
                    
192            regex = re.compile(regex, flags)
                    
193        self.regex = regex
                    
241    """
                    
242    Simple regexp based url validation. Much like the email validator, you
                    
243    probably want to validate the url later by other means if the url must
                    
318
                    
319email = Email
                    
320equal_to = EqualTo
                    
325required = Required
                    
326regexp = Regexp
                    
327url = URL
                    
                
common.py https://gitlab.com/llndhlov/journly | Python | 174 lines
                    
42        if user_agent is not None:
                    
43            for user_agent_regex in settings.DISALLOWED_USER_AGENTS:
                    
44                if user_agent_regex.search(user_agent):
                    
117
                    
118class BrokenLinkEmailsMiddleware(MiddlewareMixin):
                    
119
                    
120    def process_response(self, request, response):
                    
121        """Send broken link emails for relevant 404 NOT FOUND responses."""
                    
122        if response.status_code == 404 and not settings.DEBUG:
                    
                
_encoded_words.py https://gitlab.com/Alioth-Project/clang-r445002 | Python | 233 lines
                    
46from string import ascii_letters, digits
                    
47from email import errors
                    
48
                    
62
                    
63# regex based decoder.
                    
64_q_byte_subber = functools.partial(re.compile(br'=([a-fA-F0-9]{2})').sub,
                    
                
command.py https://gitlab.com/aadityashukla1989/mailman | Python | 235 lines
                    
20# See the delivery diagram in IncomingRunner.py.  This module handles all
                    
21# email destined for mylist-request, -join, and -leave.  It no longer handles
                    
22# bounce messages (i.e. -admin or -bounces), nor does it handle mail to
                    
27
                    
28from email.errors import HeaderParseError
                    
29from email.header import decode_header, make_header
                    
29from email.header import decode_header, make_header
                    
30from email.iterators import typed_subpart_iterator
                    
31from io import StringIO
                    
35from mailman.core.runner import Runner
                    
36from mailman.email.message import UserNotification
                    
37from mailman.interfaces.command import ContinueProcessing, IEmailResults
                    
63        elif subaddress == 'confirm':
                    
64            mo = re.match(config.mta.verp_confirm_regexp, msg.get('to', ''))
                    
65            if mo:
                    
                
safari.py https://gitlab.com/angelbirth/youtube-dl | Python | 192 lines
                    
18    _LOGIN_URL = 'https://www.safaribooksonline.com/accounts/login/'
                    
19    _SUCCESSFUL_LOGIN_REGEX = r'<a href="/accounts/logout/"[^>]*>Sign Out</a>'
                    
20    _NETRC_MACHINE = 'safari'
                    
47
                    
48        csrf = self._html_search_regex(
                    
49            r"name='csrfmiddlewaretoken'\s+value='([^']+)'",
                    
53            'csrfmiddlewaretoken': csrf,
                    
54            'email': username,
                    
55            'password1': password,
                    
64
                    
65        if re.search(self._SUCCESSFUL_LOGIN_REGEX, login_page) is None:
                    
66            raise ExtractorError(
                    
104        webpage = self._download_webpage(url, video_id)
                    
105        reference_id = self._search_regex(
                    
106            r'data-reference-id=(["\'])(?P<id>(?:(?!\1).)+)\1',
                    
                
test_helpers.py https://gitlab.com/EnLab/zulip | Python | 350 lines
                    
229        if email not in API_KEYS:
                    
230            API_KEYS[email] =  get_user_profile_by_email(email).api_key
                    
231        return API_KEYS[email]
                    
242        """
                    
243        user_profile = get_user_profile_by_email(email)
                    
244        subs = Subscription.objects.filter(
                    
323    def subscribe_to_stream(self, email, stream_name, realm=None):
                    
324        realm = Realm.objects.get(domain=resolve_email_to_domain(email))
                    
325        stream, _ = create_stream_if_needed(realm, stream_name)
                    
325        stream, _ = create_stream_if_needed(realm, stream_name)
                    
326        user_profile = get_user_profile_by_email(email)
                    
327        do_add_subscription(user_profile, stream, no_log=True)
                    
345        msg = Message.objects.filter().order_by('-id')[0]
                    
346        self.assertEqual(msg.sender.email, email)
                    
347        self.assertEqual(get_display_recipient(msg.recipient), stream_name)
                    
                
0001_initial.py https://gitlab.com/alfadil/my | Python | 53 lines
                    
42                ('Address', models.TextField()),
                    
43                ('Phone1', models.CharField(blank=True, max_length=9, validators=[django.core.validators.RegexValidator(message=b"Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.", regex=b'^\\+?1?\\d{9,15}$')])),
                    
44                ('Phone2', models.CharField(blank=True, max_length=9, validators=[django.core.validators.RegexValidator(message=b"Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.", regex=b'^\\+?1?\\d{9,15}$')])),
                    
44                ('Phone2', models.CharField(blank=True, max_length=9, validators=[django.core.validators.RegexValidator(message=b"Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.", regex=b'^\\+?1?\\d{9,15}$')])),
                    
45                ('email', models.CharField(max_length=140)),
                    
46            ],
                    
                
scrub.py https://gitlab.com/thelinuxguy/django-mailman3 | Python | 277 lines
                    
29from mimetypes import guess_all_extensions
                    
30from email.header import decode_header, make_header
                    
31from email.errors import HeaderParseError
                    
37sre = re.compile(r'[^-\w.]')
                    
38# Regexp to strip out leading dots
                    
39dre = re.compile(r'^\.*')
                    
60
                    
61    http://ginstrom.com/scribbles/2007/11/19/parsing-multilingual-email-with-python/
                    
62    """
                    
98
                    
99    http://ginstrom.com/scribbles/2007/11/19/parsing-multilingual-email-with-python/
                    
100    """
                    
139                    ctype.decode("ascii")
                    
140                # XXX Under email 2.5, it is possible that payload will be
                    
141                # None. This can happen when you have a Content-Type:
                    
                
suggestnominations.py https://gitlab.com/x33n/phantomjs | Python | 305 lines
                    
172        counter_by_name = analysis['counters_by_name'].get(author_name)
                    
173        counter_by_email = analysis['counters_by_email'].get(author_email)
                    
174        if counter_by_name:
                    
181                    counter_by_name['names'] |= counter_by_email['names']
                    
182                    counter_by_name['emails'] |= counter_by_email['emails']
                    
183                    counter_by_name['count'] += counter_by_email.get('count', 0)
                    
195                # Create new counter
                    
196                new_counter = {'names': set([author_name]), 'emails': set([author_email]), 'latest_name': author_name, 'latest_email': author_email, 'commits': ""}
                    
197                analysis['counters_by_name'][author_name] = new_counter
                    
226
                    
227            contributor = self._committer_list.contributor_by_email(author_email)
                    
228
                    
282            counter['names'] = counter['names'] - set([author_name])
                    
283            counter['emails'] = counter['emails'] - set([author_email])
                    
284
                    
                
forms.py https://github.com/tgavankar/kitsune.git | Python | 336 lines
                    
228    """A simple form that requires an email address."""
                    
229    email = forms.EmailField(label=_lazy(u'Email address:'))
                    
230
                    
234    not the current user's email."""
                    
235    email = forms.EmailField(label=_lazy(u'Email address:'))
                    
236
                    
244            raise forms.ValidationError(_('This is your current email.'))
                    
245        if User.objects.filter(email=email).exists():
                    
246            raise forms.ValidationError(_('A user with that email address '
                    
282    Requires an email address."""
                    
283    email = forms.EmailField(label=_lazy(u'Email address:'))
                    
284
                    
297
                    
298    def save(self, email_template='users/email/forgot_username.ltxt',
                    
299             use_https=False, request=None):
                    
                
forms.py https://github.com/pbs-education/django.git | Python | 218 lines
                    
13    """
                    
14    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
15        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
47class UserChangeForm(forms.ModelForm):
                    
48    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
49        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
107class PasswordResetForm(forms.Form):
                    
108    email = forms.EmailField(label=_("E-mail"), max_length=75)
                    
109
                    
122
                    
123    def save(self, domain_override=None, email_template_name='registration/password_reset_email.html',
                    
124             use_https=False, token_generator=default_token_generator, from_email=None, request=None):
                    
146            send_mail(_("Password reset on %s") % site_name,
                    
147                t.render(Context(c)), from_email, [user.email])
                    
148
                    
                
teachable.py https://gitlab.com/vitalii.dr/yt-dlp | Python | 297 lines
                    
65        login_form.update({
                    
66            'user[email]': username,
                    
67            'user[password]': password,
                    
69
                    
70        post_url = self._search_regex(
                    
71            r'<form[^>]+action=(["\'])(?P<url>(?:(?!\1).)+)\1', login_page,
                    
180        chapter_number = None
                    
181        section_item = self._search_regex(
                    
182            r'(?s)(?P<li><li[^>]+\bdata-lecture-id=["\']%s[^>]+>.+?</li>)' % video_id,
                    
184        if section_item:
                    
185            chapter_number = int_or_none(self._search_regex(
                    
186                r'data-ss-position=["\'](\d+)', section_item, 'section id',
                    
272                continue
                    
273            lecture_url = self._search_regex(
                    
274                r'<a[^>]+href=(["\'])(?P<url>(?:(?!\1).)+)\1', li,
                    
                
test_membership.py https://gitlab.com/noc0lour/mailman | Python | 237 lines
                    
100                          system_preferences.preferred_language))
                    
101        self.assertEqual(member.address.email, 'anne@example.com')
                    
102
                    
103    def test_add_member_banned_by_pattern(self):
                    
104        # Addresses matching regexp ban patterns cannot subscribe.
                    
105        IBanManager(self._mlist).ban('^.*@example.com')
                    
187
                    
188    def test_add_member_with_mixed_case_email(self):
                    
189        # LP: #1425359 - Mailman is case-perserving, case-insensitive.  This
                    
203                              system_preferences.preferred_language))
                    
204        self.assertEqual(cm.exception.email, email)
                    
205
                    
221                              system_preferences.preferred_language))
                    
222        self.assertEqual(cm.exception.email, email.lower())
                    
223
                    
                
models.py https://github.com/pnajafi/myewb2.git | Python | 107 lines
                    
19
                    
20from emailconfirmation.models import EmailAddress
                    
21
                    
26""" Thanks to http://www.djangosnippets.org/snippets/176/ """
                    
27class CurrencyField (forms.RegexField):
                    
28    currencyRe = re.compile(r'^[0-9]{1,5}(.[0-9][0-9])?$')
                    
93    phone = models.CharField(_('phone number'), max_length=45)
                    
94    email = models.EmailField(_('email address'))
                    
95    
                    
                
forms.py https://github.com/botum/sabelo.git | Python | 194 lines
                    
104    user   = forms.CharField(required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
                    
105    email  = forms.CharField(required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
                    
106    def __init__(self, question, *args, **kwargs):
                    
160class EditUserForm(forms.Form):
                    
161    email = forms.EmailField(label=u'Email', help_text=_('this email does not have to be linked to gravatar'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
                    
162    realname = forms.CharField(label=_('Real name'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35}))
                    
169        super(EditUserForm, self).__init__(*args, **kwargs)
                    
170        self.fields['email'].initial = user.email
                    
171        self.fields['realname'].initial = user.real_name
                    
183        """For security reason one unique email in database"""
                    
184        if self.user.email != self.cleaned_data['email']:
                    
185            if 'email' in self.cleaned_data:
                    
186                try:
                    
187                    user = User.objects.get(email = self.cleaned_data['email'])
                    
188                except User.DoesNotExist:
                    
                
trash.py https://gitlab.com/billyprice1/dump-scraper | Python | 233 lines
                    
39        # Let's compile some regexes to speed up the execution
                    
40        self.regex['emailsOnly'] = re.compile(r'^[\s"]?[a-z0-9\-\._]+@[a-z0-9\-\.]+\.[a-z]{2,4}[\s|\t]?$', re.I | re.M)
                    
41        self.regex['debugHex'] = re.compile(r'0x[a-f0-9]{8}', re.I)
                    
41        self.regex['debugHex'] = re.compile(r'0x[a-f0-9]{8}', re.I)
                    
42        self.regex['winPath'] = re.compile(r'[A-Z]:\\\.*?\\\.*?\\\\', re.M)
                    
43
                    
112
                    
113    def detectEmailsOnly(self):
                    
114        """
                    
114        """
                    
115        Detect full list of email addresses only, useless for us
                    
116        :return:
                    
117        """
                    
118        emails = re.findall(self.regex['emailsOnly'], self.data)
                    
119
                    
                
models.py https://gitlab.com/fscons/ticketshop | Python | 220 lines
                    
5
                    
6from django.core.validators import RegexValidator
                    
7from django.db import models
                    
11from .mails import (
                    
12    send_payment_confirmation_email,
                    
13    send_cancellation_email)
                    
146        max_length=200)
                    
147    contact_email = models.EmailField(
                    
148            verbose_name="E-mail")
                    
150            default=False,
                    
151            verbose_name="I would like to get emails about future conferences")
                    
152    additional_information = models.TextField(
                    
160                           default=randrefnumber,
                    
161                           validators=[RegexValidator(regex=r"^\d{10}$")])
                    
162
                    
                
forms.py https://github.com/hafeez3000/django.git | Python | 227 lines
                    
16    """
                    
17    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
18        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
50class UserChangeForm(forms.ModelForm):
                    
51    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
                    
52        help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
                    
110class PasswordResetForm(forms.Form):
                    
111    email = forms.EmailField(label=_("E-mail"), max_length=75)
                    
112
                    
143            c = {
                    
144                'email': user.email,
                    
145                'domain': domain,
                    
155            email = loader.render_to_string(email_template_name, c)
                    
156            send_mail(subject, email, from_email, [user.email])
                    
157
                    
                
test_data_forceschedulers.py https://gitlab.com/murder187ss/buildbot | Python | 166 lines
                    
31                                'name': 'username',
                    
32                                'need_email': True,
                    
33                                'regex': None,
                    
43                                'name': 'reason',
                    
44                                'regex': None,
                    
45                                'required': False,
                    
54                    'name': '',
                    
55                    'regex': None,
                    
56                    'required': False,
                    
66                                'name': 'project',
                    
67                                'regex': None,
                    
68                                'required': False,
                    
77                                'name': 'repository',
                    
78                                'regex': None,
                    
79                                'required': False,
                    
                
mailerdaemon.py https://gitlab.com/abhi1tb/build | Python | 246 lines
                    
85# list of re's used to find reasons (error messages).
                    
86# if a string, "<>" is replaced by a copy of the email address.
                    
87# The expressions are searched for in order.  After the first match,
                    
118                        break
                    
119                    emails.append(res.group('email'))
                    
120                break
                    
123            if res is not None:
                    
124                emails.append(res.group('email'))
                    
125                try:
                    
139                    email = emails[i]
                    
140                    exp = re.compile(re.escape(email).join(regexp.split('<>')), re.MULTILINE)
                    
141                    res = exp.search(data)
                    
149                break
                    
150    for email in emails:
                    
151        errors.append(' '.join((email.strip()+': '+reason).split()))
                    
                
app.py https://github.com/afrims/afrims.git | Python | 317 lines
                    
34
                    
35def daily_email_callback(router, *args, **kwargs):
                    
36    """
                    
36    """
                    
37    Send out daily email report of confirmed/unconfirmed appointments.
                    
38    """
                    
42    except ValueError:
                    
43        logging.debug('ValueError for specified days in daily_email_callback. Value used was %s. Using default value:7' % days)
                    
44        days = 7
                    
57        subject = subject_template.format(**context)
                    
58        body = render_to_string('reminders/emails/daily_report_message.html', context)
                    
59        group_name = settings.DEFAULT_DAILY_REPORT_GROUP_NAME
                    
61        if not created:
                    
62            emails = [c.email for c in group.contacts.all() if c.email]
                    
63            if emails:
                    
                
error_messages.py https://github.com/theosp/google_appengine.git | Python | 253 lines
                    
102
                    
103    def test_regexfield(self):
                    
104        e = {
                    
109        }
                    
110        f = RegexField(r'^\d+$', min_length=5, max_length=10, error_messages=e)
                    
111        self.assertFormErrors([u'REQUIRED'], f.clean, '')
                    
115
                    
116    def test_emailfield(self):
                    
117        e = {
                    
122        }
                    
123        f = EmailField(min_length=8, max_length=10, error_messages=e)
                    
124        self.assertFormErrors([u'REQUIRED'], f.clean, '')
                    
                
views.py https://github.com/theosp/google_appengine.git | Python | 188 lines
                    
38            # not be allowed, but things like /view/?param=http://example.com
                    
39            # should be allowed. This regex checks if there is a '//' *before* a
                    
40            # question mark.
                    
105def password_reset(request, is_admin_site=False, template_name='registration/password_reset_form.html',
                    
106        email_template_name='registration/password_reset_email.html',
                    
107        password_reset_form=PasswordResetForm, token_generator=default_token_generator,
                    
116            opts['token_generator'] = token_generator
                    
117            opts['email_template_name'] = email_template_name
                    
118            opts['request'] = request
                    
                
0001_initial.py https://gitlab.com/rmishra7/chhout.web.backend | Python | 85 lines
                    
29                ('name', models.CharField(max_length=120, verbose_name='Your Name')),
                    
30                ('email', models.EmailField(max_length=70, unique=True, verbose_name='Email')),
                    
31                ('username', models.CharField(max_length=32, unique=True, verbose_name='Profilename')),
                    
31                ('username', models.CharField(max_length=32, unique=True, verbose_name='Profilename')),
                    
32                ('contact_no', models.CharField(max_length=15, validators=[django.core.validators.RegexValidator('^\\s*(?:\\+?(\\d{1,3}))?[-. (]*(\\d{3})[-. )]*(\\d{3})[-. ]*(\\d{4})(?: *x(\\d+))?\\s*$'), django.core.validators.MinLengthValidator(6), django.core.validators.MaxLengthValidator(15)], verbose_name='Contact Number')),
                    
33                ('image', models.FileField(default='user-default.png', upload_to=accounts.models.user_image_upload, verbose_name='Image')),
                    
37                ('role', models.CharField(choices=[('1', 'Admin'), ('2', 'Customer/User'), ('3', 'Delivery Boy')], default=2, max_length=1, verbose_name='Profile Role')),
                    
38                ('email_alerts', models.BooleanField(default=False, verbose_name='Email Alerts')),
                    
39                ('sms_alerts', models.BooleanField(default=False, verbose_name='SMS Alerts')),
                    
                
validators.py https://github.com/etianen/django.git | Python | 289 lines
                    
27        if regex is not None:
                    
28            self.regex = regex
                    
29        if message is not None:
                    
41        if isinstance(self.regex, six.string_types):
                    
42            self.regex = re.compile(self.regex, self.flags)
                    
43
                    
56            self.regex.pattern == other.regex.pattern and
                    
57            self.regex.flags == other.regex.flags and
                    
58            (self.message == other.message) and
                    
67@deconstructible
                    
68class URLValidator(RegexValidator):
                    
69    regex = re.compile(
                    
183
                    
184validate_email = EmailValidator()
                    
185
                    
                
myflaskapp.py https://gitlab.com/vschmidt94/ubiquitous-octo-wookie | Python | 195 lines
                    
60
                    
61    error = None    # to implement validation later - should validate email
                    
62
                    
71    lname = request.form['lname']
                    
72    email = request.form['email']
                    
73    favs = request.form['fav_genres']
                    
83                    "lname": lname,
                    
84                    "email": email,
                    
85                    "fav_genres": favs,
                    
156
                    
157    # TODO - add regex validation of name, alpha chars at least length 4
                    
158
                    
                
convert.py https://gitlab.com/jeffglover/contactsjsonmod | Python | 111 lines
                    
28
                    
29    supports validating rows, currently when enabled expects an email column
                    
30    '''
                    
31
                    
32    valid_email = re.compile(
                    
33        r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$")
                    
42        if self.santize_rows:
                    
43            # initilize the RowSantizer to run a regex match on the 'email'
                    
44            # column
                    
44            # column
                    
45            self.email_column = "email"
                    
46            self.email_sanitizer = RowSanitizer(
                    
46            self.email_sanitizer = RowSanitizer(
                    
47                self.email_column, self.valid_email.match)
                    
48
                    
                
forms.py https://gitlab.com/andreweua/timtec | Python | 166 lines
                    
17
                    
18    email = forms.RegexField(label=_("email"), max_length=75, regex=r"^[\w.@+-]+$")
                    
19
                    
54        model = get_user_model()
                    
55        fields = ('ifid', 'first_name', 'last_name', 'email', 'campus', 'city', 'course', 'klass')
                    
56
                    
82        model = get_user_model()
                    
83        fields = ('first_name', 'last_name', 'email', 'campus', 'city', 'siape', 'cpf')
                    
84
                    
109        model = get_user_model()
                    
110        fields = ('first_name', 'last_name', 'email', 'campus', 'city', 'course', 'klass')
                    
111
                    
                
debugerror.py https://github.com/protez/Readable-Feeds.git | Python | 355 lines
                    
10
                    
11__all__ = ["debugerror", "djangoerror", "emailerrors"]
                    
12
                    
87        strClassName = strClassName.replace(/\-/g, "\\-");
                    
88        var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$$)");
                    
89        var oElement;
                    
91            oElement = arrElements[i];
                    
92            if(oRegExp.test(oElement.className)){
                    
93                arrReturnElements.push(oElement);
                    
300
                    
301def emailerrors(email_address, olderror):
                    
302    """
                    
303    Wraps the old `internalerror` handler (pass as `olderror`) to 
                    
304    additionally email all errors to `email_address`, to aid in 
                    
305    debugging production websites.
                    
                
forms.py https://github.com/qualitio/qualitio.git | Python | 174 lines
                    
28
                    
29    slug = forms.RegexField(
                    
30        regex="^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$",
                    
51class NewMemberForm(core.BaseForm):
                    
52    email = forms.EmailField(required=True, label="E-mail address")
                    
53
                    
54    def clean_email(self):
                    
55        email = self.cleaned_data.get('email')
                    
56        if auth.User.objects.filter(
                    
57            organization_member__organization=THREAD.organization,
                    
58            email=self.cleaned_data.get('email')
                    
59        ):
                    
74
                    
75        email = self.cleaned_data.get('email')
                    
76        if auth.User.objects.filter(username=email).exists():
                    
                
utils.py https://github.com/rlr/kitsune.git | Python | 136 lines
                    
55                subject=subject,
                    
56                email_data=email_data,
                    
57                volunteer_interest=form.cleaned_data['interested'],
                    
62                # so there is no race condition.
                    
63                User.objects.filter(email=form.instance.email).delete()
                    
64            else:
                    
87
                    
88    @email_utils.safe_translation
                    
89    def _make_mail(locale):
                    
94            context_vars={'contributor': user},
                    
95            from_email=settings.DEFAULT_FROM_EMAIL,
                    
96            to_email=user.email)
                    
106    username_regex = r'^{0}[0-9]*$'.format(username)
                    
107    users = User.objects.filter(username__iregex=username_regex)
                    
108
                    
                
validators.py https://github.com/theosp/google_appengine.git | Python | 197 lines
                    
25        if regex is not None:
                    
26            self.regex = regex
                    
27        if message is not None:
                    
33        if isinstance(self.regex, six.string_types):
                    
34            self.regex = re.compile(self.regex)
                    
35
                    
39        """
                    
40        if not self.regex.search(force_text(value)):
                    
41            raise ValidationError(self.message, code=self.code)
                    
80
                    
81class EmailValidator(RegexValidator):
                    
82
                    
103    r'|\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$', re.IGNORECASE)  # literal form, ipv4 address (SMTP 4.1.3)
                    
104validate_email = EmailValidator(email_re, _('Enter a valid email address.'), 'invalid')
                    
105
                    
                
forms.py https://github.com/pcraciunoiu/kitsune.git | Python | 198 lines
                    
24EMAIL_REQUIRED = _lazy(u'Email address is required.')
                    
25EMAIL_SHORT = _lazy(u'Email address is too short (%(show_value)s characters). '
                    
26                    'It must be at least %(limit_value)s characters.')
                    
49                        'max_length': USERNAME_LONG})
                    
50    email = forms.EmailField(label=_lazy(u'Email address:'),
                    
51                             error_messages={'required': EMAIL_REQUIRED,
                    
79    def clean_email(self):
                    
80        email = self.cleaned_data['email']
                    
81        if User.objects.filter(email=email).exists():
                    
178    """A simple form that requires an email address."""
                    
179    email = forms.EmailField(label=_lazy(u'Email address:'))
                    
180
                    
184    not the current user's email."""
                    
185    email = forms.EmailField(label=_lazy(u'Email address:'))
                    
186
                    
                
link_collect.py https://bitbucket.org/clarifiednetworks/graphingwiki/ | Python | 332 lines
                    
10
                    
11from graphingwiki.util import category_regex
                    
12from wiki_form import Parser as listParser
                    
28        self.in_dd = 0
                    
29        self.cat_re=category_regex(request)
                    
30
                    
197
                    
198    def _email_repl(self, word, groups):
                    
199        self.__add_meta(word, groups)
                    
                
changelog.py https://gitlab.com/x33n/phantomjs | Python | 459 lines
                    
148    def _split_author_names_with_emails(cls, text):
                    
149        regex = '>' + ChangeLogEntry.split_names_regexp
                    
150        names = re.split(regex, text)
                    
164        match = re.match(r'(?P<name>.+?)\s+<(?P<email>[^>]+)>', author_name_and_email)
                    
165        return {'name': match.group("name"), 'email': match.group("email")}
                    
166
                    
215        self._reviewers = self._fuzz_match_reviewers(self._reviewers_text_list)
                    
216        self._author = self._committer_list.contributor_by_email(self.author_email()) or self._committer_list.contributor_by_name(self.author_name())
                    
217
                    
326        date_line_regexp = re.compile(ChangeLogEntry.date_line_regexp)
                    
327        rolled_over_regexp = re.compile(ChangeLogEntry.rolled_over_regexp)
                    
328
                    
331        assert(isinstance(first_line, unicode))
                    
332        if not date_line_regexp.match(cls.svn_blame_regexp.sub('', first_line)):
                    
333            raise StopIteration
                    
                
forcesched.py https://gitlab.com/murder187ss/buildbot | Python | 780 lines
                    
17
                    
18import email.utils as email_utils
                    
19import re
                    
112
                    
113        @param regex: (optional) regex to validate the value with. Not used by
                    
114                      all subclasses
                    
114                      all subclasses
                    
115        @type regex: unicode or regex
                    
116        """
                    
123        if regex:
                    
124            self.regex = re.compile(regex)
                    
125        if 'value' in kw:
                    
266                raise ValidationError("%s: please fill in email address in the "
                    
267                                      "form 'User <email@email.com>'" % (self.name,))
                    
268        return s
                    
                
javascripttokenizer.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 363 lines
                    
87  # Comment text is anything that we are not going to parse into another special
                    
88  # token like (inline) flags or end comments. Complicated regex to match
                    
89  # most normal characters, and '*', '{', '}', and '@' when we are sure that
                    
91  # match everything before @, and we won't match @'s that aren't part of flags
                    
92  # like in email addresses in the @author tag.
                    
93  DOC_COMMENT_TEXT = re.compile(r'([^*{}\s]@|[^*{}@]|\*(?!/))+')
                    
123                     (?=\s*(%s))
                    
124                     """ % (REGEX_CHARACTER_CLASS, '|'.join(POST_REGEX_LIST)),
                    
125                     re.VERBOSE)
                    
222        # of which could be intertwined.  'string with /regex/',
                    
223        # /regex with 'string'/, /* comment with /regex/ and string */ (and so
                    
224        # on)
                    
236                JavaScriptModes.DOUBLE_QUOTE_STRING_MODE),
                    
237        Matcher(REGEX, Type.REGEX),
                    
238
                    
                
error_fixer.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 447 lines
                    
36
                    
37# Regex to represent common mistake inverting author name and email as
                    
38# @author User Name (user@company)
                    
42                                  '\('
                    
43                                  '(?P<email>[^\s]+@[^)\s]+)'
                    
44                                  '\)'
                    
295        token.string = '%s%s%s(%s)%s' % (match.group('leading_whitespace'),
                    
296                                         match.group('email'),
                    
297                                         match.group('whitespace_after_name'),
                    
                
gmock_doctor.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 617 lines
                    
40
                    
41_EMAIL = 'googlemock@googlegroups.com'
                    
42
                    
52    'Contains',
                    
53    'ContainsRegex',
                    
54    'DoubleEq',
                    
68    'Matches',
                    
69    'MatchesRegex',
                    
70    'NanSensitiveDoubleEq',
                    
129
                    
130# Regex for matching source file path and line number in the compiler's errors.
                    
131_GCC_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):\s+'
                    
136
                    
137def _FindAllMatches(regex, s):
                    
138  """Generates all matches of regex in string s."""
                    
                
tableForm.py https://gitlab.com/tim-jyu/tim | Python | 759 lines
                    
26)
                    
27from timApp.plugin.tableform.comparatorFilter import RegexOrComparator
                    
28from timApp.plugin.taskid import TaskId
                    
103    dataCollection: str | Missing | None = missing
                    
104    emails: bool | Missing = missing
                    
105    addedDates: bool | Missing = missing
                    
105    addedDates: bool | Missing = missing
                    
106    emailUsersButtonText: str | Missing | None = missing
                    
107    filterRow: bool | Missing | None = missing
                    
212                id=-100000,
                    
213                email="",
                    
214            )
                    
346usernames: false  # Show user name column
                    
347emails: false     # Show email column
                    
348addedDates: false # Show the date the user was added
                    
                
99_regex_reference.py https://gitlab.com/varunkothamachu/DAT3 | Python | 251 lines
                    
1'''
                    
2Regular Expressions (regex) Reference Guide
                    
3
                    
135
                    
136s = 'my email is john-doe@gmail.com'
                    
137
                    
172
                    
173s = 'my email is john-doe@gmail.com'
                    
174
                    
190
                    
191s = 'emails: joe@gmail.com, bob@gmail.com'
                    
192
                    
216
                    
217s = 'emails: nicole@ga.co, joe@gmail.com, PAT@GA.CO'
                    
218
                    
                
lynda.py https://gitlab.com/vitalii.dr/yt-dlp | Python | 334 lines
                    
32    def _perform_login_step(self, form_html, fallback_action_url, extra_form_data, note, referrer_url):
                    
33        action_url = self._search_regex(
                    
34            r'<form[^>]+action=(["\'])(?P<url>.+?)\1', form_html,
                    
50
                    
51        self._check_error(response, ('email', 'password', 'ErrorMessage'))
                    
52
                    
64
                    
65        # Step 2: submit email
                    
66        signin_form = self._search_regex(
                    
69        signin_page, signin_url = self._login_step(
                    
70            signin_form, self._PASSWORD_URL, {'email': username},
                    
71            'Submitting email', self._SIGNIN_URL)
                    
75        self._login_step(
                    
76            password_form, self._USER_URL, {'email': username, 'password': password},
                    
77            'Submitting password', signin_url)
                    
                
test_old_mailbox.py https://github.com/rpattabi/ironruby.git | Python | 160 lines
                    
102        ### should be better!
                    
103        import email.parser
                    
104        fname = self.createMessage("cur", True)
                    
106        for msg in mailbox.PortableUnixMailbox(open(fname),
                    
107                                               email.parser.Parser().parse):
                    
108            n += 1
                    
120
                    
121    def test_from_regex (self):
                    
122        # Testing new regex from bug #1633678
                    
                
forms.py https://github.com/Karaage-Cluster/karaage.git | Python | 431 lines
                    
141                % settings.ACCOUNTS_EMAIL)
                    
142        clean_email(email)
                    
143        return email
                    
253class UnauthenticatedInviteUserApplicationForm(forms.Form):
                    
254    email = forms.EmailField()
                    
255    captcha = CaptchaField(
                    
259    def clean_email(self):
                    
260        email = self.cleaned_data['email']
                    
261
                    
261
                    
262        query = Person.active.filter(email=email)
                    
263        if query.count() > 0:
                    
267
                    
268        clean_email(email)
                    
269        return email
                    
                
fields.py https://bitbucket.org/tskarthik/clienttracker.git | Python | 158 lines
                    
123    
                    
124class RegexField(DojoFieldMixin, fields.RegexField):
                    
125    widget = widgets.ValidationTextInput
                    
125    widget = widgets.ValidationTextInput
                    
126    js_regex = None # we additionally have to define a custom javascript regexp, because the python one is not compatible to javascript
                    
127    
                    
128    def __init__(self, js_regex=None, *args, **kwargs):
                    
129        self.js_regex = js_regex
                    
130        super(RegexField, self).__init__(*args, **kwargs)
                    
146    
                    
147class EmailField(DojoFieldMixin, fields.EmailField):
                    
148    widget = widgets.EmailTextInput
                    
157    widget = widgets.ValidationTextInput
                    
158    js_regex = '^[-\w]+$' # we cannot extract the original regex input from the python regex
                    
159
                    
                
forms.py https://github.com/jcrobak/hue.git | Python | 207 lines
                    
13    """
                    
14    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
                    
15        help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
                    
46class UserChangeForm(forms.ModelForm):
                    
47    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
                    
48        help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
                    
99class PasswordResetForm(forms.Form):
                    
100    email = forms.EmailField(label=_("E-mail"), max_length=75)
                    
101
                    
105        """
                    
106        email = self.cleaned_data["email"]
                    
107        self.users_cache = User.objects.filter(email__iexact=email)
                    
111
                    
112    def save(self, domain_override=None, email_template_name='registration/password_reset_email.html',
                    
113             use_https=False, token_generator=default_token_generator):
                    
                
fields.py https://bitbucket.org/rattray/anonbox.git | Python | 961 lines
                    
38    'DEFAULT_DATETIME_INPUT_FORMATS', 'DateTimeField', 'TimeField',
                    
39    'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',
                    
40    'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',
                    
                
fields.py https://bitbucket.org/signonsandiego/django.git | Python | 955 lines
                    
36    'DateField', 'TimeField', 'DateTimeField', 'TimeField',
                    
37    'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',
                    
38    'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',
                    
                
forms.py https://github.com/sandroden/baruwa.git | Python | 235 lines
                    
32    from django.core.validators import email_re
                    
33from baruwa.utils.regex import ADDRESS_RE
                    
34
                    
40    """
                    
41    def clean_email(self):
                    
42        """
                    
45        """
                    
46        email = self.cleaned_data["email"]
                    
47        self.users_cache = User.objects.filter(email__iexact=email)
                    
116    """
                    
117    address = forms.RegexField(regex=ADDRESS_RE,
                    
118        widget=forms.TextInput(attrs={'size': '50'}))
                    
139            if not email_re.match(address):
                    
140                error_msg = _('provide a valid email address')
                    
141                self._errors["address"] = ErrorList([error_msg])
                    
                
module.py https://gitlab.com/phyks/weboob | Python | 196 lines
                    
36    MAINTAINER = u'Romain Bignon'
                    
37    EMAIL = 'romain@weboob.org'
                    
38    VERSION = '1.3'
                    
40    DESCRIPTION = "phpBB forum"
                    
41    CONFIG = BackendConfig(Value('url',                     label='URL of forum', regexp='https?://.*'),
                    
42                           Value('username',                label='Username', default=''),
                    
                
utils.py https://gitlab.com/pooja043/Globus_Docker_3 | Python | 967 lines
                    
55import re
                    
56import email.mime.multipart
                    
57import email.mime.base
                    
57import email.mime.base
                    
58import email.mime.text
                    
59import email.utils
                    
59import email.utils
                    
60import email.encoders
                    
61import gzip
                    
97
                    
98_first_cap_regex = re.compile('(.)([A-Z][a-z]+)')
                    
99_number_cap_regex = re.compile('([a-z])([0-9]+)')
                    
99_number_cap_regex = re.compile('([a-z])([0-9]+)')
                    
100_end_cap_regex = re.compile('([a-z0-9])([A-Z])')
                    
101
                    
                
admin.py https://github.com/Kamlani/reviewboard.git | Python | 225 lines
                    
28        (_('General Information'), {
                    
29            'fields': ('name', 'file_regex'),
                    
30            'classes': ['wide'],
                    
41    )
                    
42    list_display = ('name', 'file_regex')
                    
43
                    
87        (_('State'), {
                    
88            'fields': ('email_message_id', 'time_emailed'),
                    
89            'classes': ('collapse',)
                    
119                             'modified unless something is wrong.</p>'),
                    
120            'fields': ('email_message_id', 'time_emailed',
                    
121                       'last_review_timestamp', 'shipit_count', 'local_id'),
                    
                
header.py https://gitlab.com/abhi1tb/build | Python | 578 lines
                    
2# Author: Ben Gertzfield, Barry Warsaw
                    
3# Contact: email-sig@python.org
                    
4
                    
15
                    
16import email.quoprimime
                    
17import email.base64mime
                    
18
                    
19from email.errors import HeaderParseError
                    
20from email import charset as _charset
                    
44
                    
45# Field name regexp, including trailing colon, but not separating whitespace,
                    
46# according to RFC 2822.  Character range is from tilde to exclamation mark.
                    
56# Helpers
                    
57_max_append = email.quoprimime._max_append
                    
58
                    
                
test_sdist.py https://gitlab.com/abhi1tb/build | Python | 492 lines
                    
80                        'url': 'xxx', 'author': 'xxx',
                    
81                        'author_email': 'xxx'}
                    
82        dist = Distribution(metadata)
                    
193        self.write_file((hg_dir, 'last-message.txt'), '#')
                    
194        # a buggy regex used to prevent this from working on windows (#6884)
                    
195        self.write_file((self.tmp_dir, 'buildout.cfg'), '#')
                    
                
dist.py https://gitlab.com/abhi1tb/build | Python | 1203 lines
                    
9import re
                    
10from email import message_from_file
                    
11
                    
22
                    
23# Regex to define acceptable Distutils command names.  This is not *quite*
                    
24# the same as a Python NAME -- I don't allow leading underscores.  The fact
                    
95         "print the author's name"),
                    
96        ('author-email', None,
                    
97         "print the author's email address"),
                    
99         "print the maintainer's name"),
                    
100        ('maintainer-email', None,
                    
101         "print the maintainer's email address"),
                    
103         "print the maintainer's name if known, else the author's"),
                    
104        ('contact-email', None,
                    
105         "print the maintainer's email address if known, else the author's"),
                    
                
PatchCheck.py https://gitlab.com/envieidoc/Clover | Python | 613 lines
                    
124
                    
125            self.check_email_address(s[3])
                    
126
                    
131
                    
132    def check_email_address(self, email):
                    
133        email = email.strip()
                    
133        email = email.strip()
                    
134        mo = self.email_re1.match(email)
                    
135        if mo is None:
                    
135        if mo is None:
                    
136            self.error("Email format is invalid: " + email.strip())
                    
137            return
                    
150            self.error("There should be a space between the name and " +
                    
151                       "email address: " + email)
                    
152
                    
                
ConvertMasmToNasm.py https://gitlab.com/envieidoc/Clover | Python | 986 lines
                    
68            self.gitdir = clone.gitdir
                    
69            self.gitemail = clone.gitemail
                    
70
                    
101
                    
102    def MatchAndSetMo(self, regexp, string):
                    
103        self.mo = regexp.match(string)
                    
105
                    
106    def SearchAndSetMo(self, regexp, string):
                    
107        self.mo = regexp.search(string)
                    
133                self.gitdir = candidate
                    
134                self.gitemail = self.FormatGitEmailAddress()
                    
135                return
                    
137
                    
138    def FormatGitEmailAddress(self):
                    
139        if not self.git or not self.gitdir:
                    
                
header.py https://gitlab.com/envieidoc/Clover | Python | 514 lines
                    
2# Author: Ben Gertzfield, Barry Warsaw
                    
3# Contact: email-sig@python.org
                    
4
                    
15
                    
16import email.quoprimime
                    
17import email.base64mime
                    
18
                    
19from email.errors import HeaderParseError
                    
20from email.charset import Charset
                    
44
                    
45# Field name regexp, including trailing colon, but not separating whitespace,
                    
46# according to RFC 2822.  Character range is from tilde to exclamation mark.
                    
56# Helpers
                    
57_max_append = email.quoprimime._max_append
                    
58
                    
                
dist.py https://gitlab.com/envieidoc/Clover | Python | 1207 lines
                    
9import sys, os, re
                    
10from email import message_from_file
                    
11
                    
26
                    
27# Regex to define acceptable Distutils command names.  This is not *quite*
                    
28# the same as a Python NAME -- I don't allow leading underscores.  The fact
                    
85         "print the author's name"),
                    
86        ('author-email', None,
                    
87         "print the author's email address"),
                    
89         "print the maintainer's name"),
                    
90        ('maintainer-email', None,
                    
91         "print the maintainer's email address"),
                    
93         "print the maintainer's name if known, else the author's"),
                    
94        ('contact-email', None,
                    
95         "print the maintainer's email address if known, else the author's"),
                    
                
youtube.py https://gitlab.com/angelbirth/youtube-dl | Python | 1032 lines
                    
97            'checkConnection': 'youtube',
                    
98            'Email': username,
                    
99            'Passwd': password,
                    
108
                    
109        error_msg = self._html_search_regex(
                    
110            r'<[^>]+id="errormsg_0_Passwd"[^>]*>([^<]+)<',
                    
                
vimeo.py https://gitlab.com/angelbirth/youtube-dl | Python | 940 lines
                    
19    NO_DEFAULT,
                    
20    RegexNotFoundError,
                    
21    sanitized_Request,
                    
48            'action': 'login',
                    
49            'email': username,
                    
50            'password': password,
                    
80    def _extract_xsrft_and_vuid(self, webpage):
                    
81        xsrft = self._search_regex(
                    
82            r'(?:(?P<q1>["\'])xsrft(?P=q1)\s*:|xsrft\s*[=:])\s*(?P<q>["\'])(?P<xsrft>.+?)(?P=q)',
                    
83            webpage, 'login token', group='xsrft')
                    
84        vuid = self._search_regex(
                    
85            r'["\']vuid["\']\s*:\s*(["\'])(?P<vuid>.+?)\1',
                    
                
utils.py https://gitlab.com/angelbirth/youtube-dl | Python | 1539 lines
                    
12import datetime
                    
13import email.utils
                    
14import errno
                    
77# This is not clearly defined otherwise
                    
78compiled_regex_type = type(re.compile(''))
                    
79
                    
439    timestamp = None
                    
440    timetuple = email.utils.parsedate_tz(timestr)
                    
441    if timetuple is not None:
                    
441    if timetuple is not None:
                    
442        timestamp = email.utils.mktime_tz(timetuple)
                    
443    return timestamp
                    
                
fields.py https://gitlab.com/areema/myproject | Python | 1235 lines
                    
24    FILE_INPUT_CONTRADICTION, CheckboxInput, ClearableFileInput, DateInput,
                    
25    DateTimeInput, EmailInput, HiddenInput, MultipleHiddenInput,
                    
26    NullBooleanSelect, NumberInput, Select, SelectMultiple,
                    
43    'DateField', 'TimeField', 'DateTimeField', 'DurationField',
                    
44    'RegexField', 'EmailField', 'FileField', 'ImageField', 'URLField',
                    
45    'BooleanField', 'NullBooleanField', 'ChoiceField', 'MultipleChoiceField',
                    
                
mail_spam.py https://gitlab.com/yaojian/RenjuAI | Python | 500 lines
                    
101        if rule_data is not None:
                    
102            self.regex_rules = RuleBasedModel.regex_rule_data(rule_data)
                    
103        else:  # default value
                    
103        else:  # default value
                    
104            self.regex_rules = {'subj_kws': dict(), 'body_kws': dict(), 'subj_reg': None, 'body_reg': None}
                    
105
                    
106    @staticmethod
                    
107    def regex_rule_data(rules_dict):
                    
108        """
                    
108        """
                    
109            parse rule data to regex object
                    
110        :return:
                    
111        """
                    
112        # regex for subject and body
                    
113        regex_rules = dict()
                    
                
mail_signature.py https://gitlab.com/yaojian/RenjuAI | Python | 324 lines
                    
17
                    
18    KEY_EMAIL, KEY_PHONE, KEY_ADDRESS, KEY_ZIP_CODE, KEY_COMPANY = 'email', 'phone', 'address', 'zipcode', 'company'
                    
19    KEY_WEBSITE, KEY_PERSON, KEY_OTHER = 'website', 'person', 'other'
                    
35
                    
36    REG_EMAIL = MailGlobal.email_reg_2
                    
37    #  ex:  http://www.hylandslaw.com  or  www.hylandslaw.com
                    
59
                    
60    REGEX_MAP = {KEY_EMAIL: REG_EMAIL,
                    
61                 KEY_WEBSITE: REG_URL,
                    
73    REPLY_REGEX = re.compile(u'^\s*[>\*]{,3}\s*\*?(发件人|寄件者|From)[::]{1}.+', re.MULTILINE)
                    
74    REPLY_SEPARATE_REGEX = re.compile(u"^\s*(?:-|—){4,}\s*(?:原始邮件|Original Message)\s*(?:-|—){4,}\s*$",
                    
75                                      re.MULTILINE | re.IGNORECASE)
                    
96    def remove_reply_pos(mail_body):
                    
97        match_span = MailSignatureParser.REPLY_SEPARATE_REGEX.search(mail_body)
                    
98        if match_span is not None:
                    
                
mail_reply_parser.py https://gitlab.com/yaojian/RenjuAI | Python | 511 lines
                    
29                  }
                    
30    HEADER_REGEX = re.compile(u'^[ ]*[>\*]{,3}[ ]*\*?(%s)[::]{1}(.+)' % '|'.join(HEADER_MAP.keys()))
                    
31    Multi_HEADER_REGEX = re.compile(u'^[ ]*[>\*]{,3}[ ]*\*?(%s)[::]{1}.+' % '|'.join(HEADER_MAP.keys()), re.MULTILINE)
                    
31    Multi_HEADER_REGEX = re.compile(u'^[ ]*[>\*]{,3}[ ]*\*?(%s)[::]{1}.+' % '|'.join(HEADER_MAP.keys()), re.MULTILINE)
                    
32    SUBJECT_REGEX = re.compile(u'^[ ]*(回复|答复|回覆|re|转发|Fw)[::]{1}.+', re.IGNORECASE)
                    
33
                    
33
                    
34    HR_LINE_REGEX = re.compile(u'^[ ]*[>\*]{,2}[-]{2,}[ ]*(原始邮件|Original Message)[ ]*[-]{2,}.*', re.IGNORECASE)
                    
35
                    
77            line = mail_body_lines[idx]
                    
78            header_pair = MailReplyParser.HEADER_REGEX.findall(line)
                    
79            if len(header_pair) == 1:  # header part
                    
106                    reply_status = MailReplyParser.REPLY_STATUS_BODY
                    
107                if MailReplyParser.HR_LINE_REGEX.match(line):  # split line
                    
108                    body_fragment['body']['ed'] = idx - 1
                    
                
common.py https://bitbucket.org/pcelta/python-django.git | Python | 153 lines
                    
42        if 'HTTP_USER_AGENT' in request.META:
                    
43            for user_agent_regex in settings.DISALLOWED_USER_AGENTS:
                    
44                if user_agent_regex.search(request.META['HTTP_USER_AGENT']):
                    
92    def process_response(self, request, response):
                    
93        "Send broken link emails and calculate the Etag, if needed."
                    
94        if response.status_code == 404:
                    
94        if response.status_code == 404:
                    
95            if settings.SEND_BROKEN_LINK_EMAILS and not settings.DEBUG:
                    
96                # If the referrer was from an internal link or a non-search-engine site,
                    
                
gmock_doctor.py https://gitlab.com/CORP-RESELLER/googletest | Python | 640 lines
                    
40
                    
41_EMAIL = 'googlemock@googlegroups.com'
                    
42
                    
52    'Contains',
                    
53    'ContainsRegex',
                    
54    'DoubleEq',
                    
68    'Matches',
                    
69    'MatchesRegex',
                    
70    'NanSensitiveDoubleEq',
                    
129
                    
130# Regex for matching source file path and line number in the compiler's errors.
                    
131_GCC_FILE_LINE_RE = r'(?P<file>.*):(?P<line>\d+):(\d+:)?\s+'
                    
136
                    
137def _FindAllMatches(regex, s):
                    
138  """Generates all matches of regex in string s."""
                    
                
mathtext.py https://gitlab.com/sagarjhaa/matplotlib | Python | 1442 lines
                    
17If you find TeX expressions that don't parse or render properly,
                    
18please email mdroe@stsci.edu, but please check KNOWN ISSUES below first.
                    
19"""
                    
41     ParseResults, Suppress, oneOf, StringEnd, ParseFatalException, \
                    
42     FollowedBy, Regex, ParserElement, QuotedString, ParseBaseException
                    
43
                    
                
models.py https://github.com/gregmuellegger/django.git | Python | 93 lines
                    
27        settings.AUTH_PROFILE_MODULE = 'foo.bar'
                    
28        with self.assertRaisesRegexp(SiteProfileNotAvailable,
                    
29                "Unable to load the profile model"):
                    
69    def test_create_user(self):
                    
70        email_lowercase = 'normal@normal.com'
                    
71        user = User.objects.create_user('user', email_lowercase)
                    
71        user = User.objects.create_user('user', email_lowercase)
                    
72        self.assertEqual(user.email, email_lowercase)
                    
73        self.assertEqual(user.username, 'user')
                    
75
                    
76    def test_create_user_email_domain_normalize_rfc3696(self):
                    
77        # According to  http://tools.ietf.org/html/rfc3696#section-3
                    
86    def test_create_user_email_domain_normalize_with_whitespace(self):
                    
87        returned = UserManager.normalize_email('email\ with_whitespace@D.COM')
                    
88        self.assertEqual(returned, 'email\ with_whitespace@d.com')
                    
                
roots_test.py https://gitlab.com/ricardo.hernandez/salt | Python | 181 lines
                    
2'''
                    
3    :codeauthor: :email:`Mike Place <mp@saltstack.com>`
                    
4'''
                    
36                                         'fileserver_followsymlinks': False,
                    
37                                         'file_ignore_regex': False,
                    
38                                         'file_ignore_glob': False}):
                    
45                                         'fileserver_followsymlinks': False,
                    
46                                         'file_ignore_regex': False,
                    
47                                         'file_ignore_glob': False}):
                    
58                                        'fileserver_followsymlinks': False,
                    
59                                        'file_ignore_regex': False,
                    
60                                        'file_ignore_glob': False,
                    
93                                 'fileserver_followsymlinks': False,
                    
94                                 'file_ignore_regex': False,
                    
95                                 'file_ignore_glob': False,
                    
                
http.py https://bitbucket.org/aiti_india/travelindia.git | Python | 226 lines
                    
6import urlparse
                    
7from email.utils import formatdate
                    
8
                    
114    """
                    
115    # emails.Util.parsedate does the job for RFC1123 dates; unfortunately
                    
116    # RFC2616 makes it mandatory to support RFC850 dates too. So we roll
                    
117    # our own RFC-compliant parsing.
                    
118    for regex in RFC1123_DATE, RFC850_DATE, ASCTIME_DATE:
                    
119        m = regex.match(date)
                    
                
forms.py https://github.com/jgosier/RiverID.git | Python | 125 lines
                    
32    """
                    
33    username = forms.RegexField(regex=r'^\w+$',
                    
34                                max_length=30,
                    
37                                error_messages={'invalid': _("This value must contain only letters, numbers and underscores.")})
                    
38    email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict,
                    
39                                                               maxlength=75)),
                    
95        """
                    
96        if User.objects.filter(email__iexact=self.cleaned_data['email']):
                    
97            raise forms.ValidationError(_("This email address is already in use. Please supply a different email address."))
                    
121        """
                    
122        email_domain = self.cleaned_data['email'].split('@')[1]
                    
123        if email_domain in self.bad_domains:
                    
123        if email_domain in self.bad_domains:
                    
124            raise forms.ValidationError(_("Registration using free email addresses is prohibited. Please supply a different email address."))
                    
125        return self.cleaned_data['email']
                    
                
mail_mail.py https://gitlab.com/thanhchatvn/cloud-odoo | Python | 114 lines
                    
12
                    
13URL_REGEX = r'(\bhref=[\'"]([^\'"]+)[\'"])'
                    
14
                    
48
                    
49    def _get_unsubscribe_url(self, cr, uid, mail, email_to, context=None):
                    
50        base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
                    
53                'mailing_id': mail.mailing_id.id,
                    
54                'params': werkzeug.url_encode({'db': cr.dbname, 'res_id': mail.res_id, 'email': email_to})
                    
55            }
                    
68        if mail.mailing_id and body and mail.statistics_ids:
                    
69            for match in re.findall(URL_REGEX, mail.body_html):
                    
70
                    
100        if mail.mailing_id and res.get('body') and res.get('email_to'):
                    
101            emails = tools.email_split(res.get('email_to')[0])
                    
102            email_to = emails and emails[0] or False
                    
                
 

Source

Language