@@ -124,11 +124,11 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp
124124 # Check for invalid characters against the non-internationalized
125125 # permitted character set.
126126 # (RFC 5322 3.2.3)
127- bad_chars = set (
127+ bad_chars = {
128128 safe_character_display (c )
129129 for c in local
130130 if not ATEXT_RE .match (c )
131- )
131+ }
132132 if bad_chars :
133133 raise EmailSyntaxError ("Internationalized characters before the @-sign are not supported: " + ", " .join (sorted (bad_chars )) + "." )
134134
@@ -148,20 +148,20 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp
148148 # (RFC 5321 4.1.2. RFC 5322 lists additional permitted *obsolete*
149149 # characters which are *not* allowed here. RFC 6531 section 3.3
150150 # extends the range to UTF8 strings.)
151- bad_chars = set (
151+ bad_chars = {
152152 safe_character_display (c )
153153 for c in local
154154 if not QTEXT_INTL .match (c )
155- )
155+ }
156156 if bad_chars :
157157 raise EmailSyntaxError ("The email address contains invalid characters in quotes before the @-sign: " + ", " .join (sorted (bad_chars )) + "." )
158158
159159 # See if any characters are outside of the ASCII range.
160- bad_chars = set (
160+ bad_chars = {
161161 safe_character_display (c )
162162 for c in local
163163 if not (32 <= ord (c ) <= 126 )
164- )
164+ }
165165 if bad_chars :
166166 requires_smtputf8 = True
167167
@@ -213,11 +213,11 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp
213213
214214 # Check for invalid characters.
215215 # (RFC 5322 3.2.3, plus RFC 6531 3.3)
216- bad_chars = set (
216+ bad_chars = {
217217 safe_character_display (c )
218218 for c in local
219219 if not ATEXT_INTL_RE .match (c )
220- )
220+ }
221221 if bad_chars :
222222 raise EmailSyntaxError ("The email address contains invalid characters before the @-sign: " + ", " .join (sorted (bad_chars )) + "." )
223223
@@ -306,11 +306,11 @@ def validate_email_domain_name(domain, test_environment=False, globally_delivera
306306
307307 # Check for invalid characters before normalization.
308308 # (RFC 952 plus RFC 6531 section 3.3 for internationalized addresses)
309- bad_chars = set (
309+ bad_chars = {
310310 safe_character_display (c )
311311 for c in domain
312312 if not ATEXT_HOSTNAME_INTL .match (c )
313- )
313+ }
314314 if bad_chars :
315315 raise EmailSyntaxError ("The part after the @-sign contains invalid characters: " + ", " .join (sorted (bad_chars )) + "." )
316316
@@ -437,11 +437,11 @@ def validate_email_domain_name(domain, test_environment=False, globally_delivera
437437
438438 # Check for invalid characters after normalization. These
439439 # should never arise. See the similar checks above.
440- bad_chars = set (
440+ bad_chars = {
441441 safe_character_display (c )
442442 for c in domain
443443 if not ATEXT_HOSTNAME_INTL .match (c )
444- )
444+ }
445445 if bad_chars :
446446 raise EmailSyntaxError ("The part after the @-sign contains invalid characters: " + ", " .join (sorted (bad_chars )) + "." )
447447 check_unsafe_chars (domain )
@@ -544,11 +544,11 @@ def validate_email_domain_literal(domain_literal):
544544
545545 # Check for permitted ASCII characters. This actually doesn't matter
546546 # since there will be an exception after anyway.
547- bad_chars = set (
547+ bad_chars = {
548548 safe_character_display (c )
549549 for c in domain_literal
550550 if not DOMAIN_LITERAL_CHARS .match (c )
551- )
551+ }
552552 if bad_chars :
553553 raise EmailSyntaxError ("The part after the @-sign contains invalid characters in brackets: " + ", " .join (sorted (bad_chars )) + "." )
554554
0 commit comments