Skip to content

Commit 8102431

Browse files
committed
Rename some constants that were poorly named
1 parent d64b291 commit 8102431

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: email_validator/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
# addresses to also include three specific ranges of UTF8 defined in
2727
# RFC3629 section 4, which appear to be the Unicode code points from
2828
# U+0080 to U+10FFFF.
29-
ATEXT_UTF8 = ATEXT + u"\u0080-\U0010FFFF"
30-
DOT_ATOM_TEXT_UTF8 = '[' + ATEXT_UTF8 + ']+(?:\\.[' + ATEXT_UTF8 + ']+)*'
29+
ATEXT_INTL = ATEXT + u"\u0080-\U0010FFFF"
30+
DOT_ATOM_TEXT_INTL = '[' + ATEXT_INTL + ']+(?:\\.[' + ATEXT_INTL + ']+)*'
3131

3232
# The domain part of the email address, after IDNA (ASCII) encoding,
3333
# must also satisfy the requirements of RFC 952/RFC 1123 which restrict
@@ -400,11 +400,11 @@ def validate_email_local_part(local, allow_smtputf8=True, allow_empty_local=Fals
400400

401401
else:
402402
# The local part failed the ASCII check. Now try the extended internationalized requirements.
403-
m = re.match(DOT_ATOM_TEXT_UTF8 + "\\Z", local)
403+
m = re.match(DOT_ATOM_TEXT_INTL + "\\Z", local)
404404
if not m:
405405
# It's not a valid internationalized address either. Report which characters were not valid.
406406
bad_chars = ', '.join(sorted(set(
407-
unicodedata.name(c, repr(c)) for c in local if not re.match(u"[" + (ATEXT if not allow_smtputf8 else ATEXT_UTF8) + u"]", c)
407+
unicodedata.name(c, repr(c)) for c in local if not re.match(u"[" + (ATEXT if not allow_smtputf8 else ATEXT_INTL) + u"]", c)
408408
)))
409409
raise EmailSyntaxError("The email address contains invalid characters before the @-sign: %s." % bad_chars)
410410

@@ -420,7 +420,7 @@ def validate_email_local_part(local, allow_smtputf8=True, allow_empty_local=Fals
420420

421421
# Check for unsafe characters.
422422
# Some of this may be redundant with the range U+0080 to U+10FFFF that is checked
423-
# by DOT_ATOM_TEXT_UTF8.
423+
# by DOT_ATOM_TEXT_INTL.
424424
for i, c in enumerate(local):
425425
category = unicodedata.category(c)
426426
if category[0] in ("L", "N", "P", "S"):

0 commit comments

Comments
 (0)