Skip to content

Commit a1c90ab

Browse files
committed
Split exceptions_types.py into exceptions.py and types.py
1 parent dbcf07c commit a1c90ab

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

email_validator/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from typing import TYPE_CHECKING
22

33
# Export the main method, helper methods, and the public data types.
4-
from .exceptions_types import ValidatedEmail, EmailNotValidError, \
5-
EmailSyntaxError, EmailUndeliverableError
4+
from .exceptions import EmailNotValidError, EmailSyntaxError, EmailUndeliverableError
5+
from .types import ValidatedEmail
66
from .validate_email import validate_email
77
from .version import __version__
88

email_validator/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from .validate_email import validate_email, _Resolver
2323
from .deliverability import caching_resolver
24-
from .exceptions_types import EmailNotValidError
24+
from .exceptions import EmailNotValidError
2525

2626

2727
def main(dns_resolver: Optional[_Resolver] = None) -> None:

email_validator/deliverability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import ipaddress
44

5-
from .exceptions_types import EmailUndeliverableError
5+
from .exceptions import EmailUndeliverableError
66

77
import dns.resolver
88
import dns.exception

email_validator/exceptions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class EmailNotValidError(ValueError):
2+
"""Parent class of all exceptions raised by this module."""
3+
pass
4+
5+
6+
class EmailSyntaxError(EmailNotValidError):
7+
"""Exception raised when an email address fails validation because of its form."""
8+
pass
9+
10+
11+
class EmailUndeliverableError(EmailNotValidError):
12+
"""Exception raised when an email address fails validation because its domain name does not appear deliverable."""
13+
pass

email_validator/syntax.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from .exceptions_types import EmailSyntaxError, ValidatedEmail
1+
from .exceptions import EmailSyntaxError
2+
from .types import ValidatedEmail
23
from .rfc_constants import EMAIL_MAX_LENGTH, LOCAL_PART_MAX_LENGTH, DOMAIN_MAX_LENGTH, \
34
DOT_ATOM_TEXT, DOT_ATOM_TEXT_INTL, ATEXT_RE, ATEXT_INTL_DOT_RE, ATEXT_HOSTNAME_INTL, QTEXT_INTL, \
45
DNS_LABEL_LENGTH_LIMIT, DOT_ATOM_TEXT_HOSTNAME, DOMAIN_NAME_REGEX, DOMAIN_LITERAL_CHARS

email_validator/exceptions_types.py renamed to email_validator/types.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@
22
from typing import Any, Dict, List, Optional, Tuple, Union
33

44

5-
class EmailNotValidError(ValueError):
6-
"""Parent class of all exceptions raised by this module."""
7-
pass
8-
9-
10-
class EmailSyntaxError(EmailNotValidError):
11-
"""Exception raised when an email address fails validation because of its form."""
12-
pass
13-
14-
15-
class EmailUndeliverableError(EmailNotValidError):
16-
"""Exception raised when an email address fails validation because its domain name does not appear deliverable."""
17-
pass
18-
19-
205
class ValidatedEmail:
216
"""The validate_email function returns objects of this type holding the normalized form of the email address
227
and other information."""

email_validator/validate_email.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from typing import Optional, Union, TYPE_CHECKING
22
import unicodedata
33

4-
from .exceptions_types import EmailSyntaxError, ValidatedEmail
4+
from .exceptions import EmailSyntaxError
5+
from .types import ValidatedEmail
56
from .syntax import split_email, validate_email_local_part, validate_email_domain_name, validate_email_domain_literal, validate_email_length
67
from .rfc_constants import CASE_INSENSITIVE_MAILBOX_NAMES
78

0 commit comments

Comments
 (0)