@@ -124,11 +124,11 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp
124
124
# Check for invalid characters against the non-internationalized
125
125
# permitted character set.
126
126
# (RFC 5322 3.2.3)
127
- bad_chars = set (
127
+ bad_chars = {
128
128
safe_character_display (c )
129
129
for c in local
130
130
if not ATEXT_RE .match (c )
131
- )
131
+ }
132
132
if bad_chars :
133
133
raise EmailSyntaxError ("Internationalized characters before the @-sign are not supported: " + ", " .join (sorted (bad_chars )) + "." )
134
134
@@ -148,20 +148,20 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp
148
148
# (RFC 5321 4.1.2. RFC 5322 lists additional permitted *obsolete*
149
149
# characters which are *not* allowed here. RFC 6531 section 3.3
150
150
# extends the range to UTF8 strings.)
151
- bad_chars = set (
151
+ bad_chars = {
152
152
safe_character_display (c )
153
153
for c in local
154
154
if not QTEXT_INTL .match (c )
155
- )
155
+ }
156
156
if bad_chars :
157
157
raise EmailSyntaxError ("The email address contains invalid characters in quotes before the @-sign: " + ", " .join (sorted (bad_chars )) + "." )
158
158
159
159
# See if any characters are outside of the ASCII range.
160
- bad_chars = set (
160
+ bad_chars = {
161
161
safe_character_display (c )
162
162
for c in local
163
163
if not (32 <= ord (c ) <= 126 )
164
- )
164
+ }
165
165
if bad_chars :
166
166
requires_smtputf8 = True
167
167
@@ -213,11 +213,11 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp
213
213
214
214
# Check for invalid characters.
215
215
# (RFC 5322 3.2.3, plus RFC 6531 3.3)
216
- bad_chars = set (
216
+ bad_chars = {
217
217
safe_character_display (c )
218
218
for c in local
219
219
if not ATEXT_INTL_RE .match (c )
220
- )
220
+ }
221
221
if bad_chars :
222
222
raise EmailSyntaxError ("The email address contains invalid characters before the @-sign: " + ", " .join (sorted (bad_chars )) + "." )
223
223
@@ -306,11 +306,11 @@ def validate_email_domain_name(domain, test_environment=False, globally_delivera
306
306
307
307
# Check for invalid characters before normalization.
308
308
# (RFC 952 plus RFC 6531 section 3.3 for internationalized addresses)
309
- bad_chars = set (
309
+ bad_chars = {
310
310
safe_character_display (c )
311
311
for c in domain
312
312
if not ATEXT_HOSTNAME_INTL .match (c )
313
- )
313
+ }
314
314
if bad_chars :
315
315
raise EmailSyntaxError ("The part after the @-sign contains invalid characters: " + ", " .join (sorted (bad_chars )) + "." )
316
316
@@ -437,11 +437,11 @@ def validate_email_domain_name(domain, test_environment=False, globally_delivera
437
437
438
438
# Check for invalid characters after normalization. These
439
439
# should never arise. See the similar checks above.
440
- bad_chars = set (
440
+ bad_chars = {
441
441
safe_character_display (c )
442
442
for c in domain
443
443
if not ATEXT_HOSTNAME_INTL .match (c )
444
- )
444
+ }
445
445
if bad_chars :
446
446
raise EmailSyntaxError ("The part after the @-sign contains invalid characters: " + ", " .join (sorted (bad_chars )) + "." )
447
447
check_unsafe_chars (domain )
@@ -544,11 +544,11 @@ def validate_email_domain_literal(domain_literal):
544
544
545
545
# Check for permitted ASCII characters. This actually doesn't matter
546
546
# since there will be an exception after anyway.
547
- bad_chars = set (
547
+ bad_chars = {
548
548
safe_character_display (c )
549
549
for c in domain_literal
550
550
if not DOMAIN_LITERAL_CHARS .match (c )
551
- )
551
+ }
552
552
if bad_chars :
553
553
raise EmailSyntaxError ("The part after the @-sign contains invalid characters in brackets: " + ", " .join (sorted (bad_chars )) + "." )
554
554
0 commit comments