arpakitlib 1.8.239__py3-none-any.whl → 1.8.241__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,7 +72,7 @@ def raise_own_exception_if_exception(
72
72
  if kwargs_in_own_exception is not None:
73
73
  copied_kwargs_in_own_exception = kwargs_in_own_exception.copy()
74
74
  copied_kwargs_in_own_exception["caught_exception"] = caught_exception
75
- copied_kwargs_in_own_exception["caught_exception_type"] = type(caught_exception)
75
+ copied_kwargs_in_own_exception["caught_exception_type"] = str(type(caught_exception))
76
76
  copied_kwargs_in_own_exception["caught_exception_str"] = str(caught_exception)
77
77
  try:
78
78
  _kwargs = {}
@@ -97,7 +97,7 @@ def raise_own_exception_if_exception(
97
97
  if kwargs_in_own_exception is not None:
98
98
  copied_kwargs_in_own_exception = kwargs_in_own_exception.copy()
99
99
  copied_kwargs_in_own_exception["caught_exception"] = caught_exception
100
- copied_kwargs_in_own_exception["caught_exception_type"] = type(caught_exception)
100
+ copied_kwargs_in_own_exception["caught_exception_type"] = str(type(caught_exception))
101
101
  copied_kwargs_in_own_exception["caught_exception_str"] = str(caught_exception)
102
102
  try:
103
103
  _kwargs = {}
@@ -0,0 +1,47 @@
1
+ import logging
2
+
3
+ import email_validator
4
+ import pydantic
5
+
6
+ _logger = logging.getLogger(__name__)
7
+
8
+
9
+ class ReallyValidateEmailException(Exception):
10
+ def __init__(self, email: str, error_message: str):
11
+ self.email = email
12
+ self.error_message = error_message
13
+
14
+ def __str__(self) -> str:
15
+ return f"{self.__class__.__name__}, {self.email=}, {self.error_message}"
16
+
17
+ def __repr__(self) -> str:
18
+ return f"{self.__class__.__name__}, {self.email=}, {self.error_message}"
19
+
20
+
21
+ def really_validate_email(email: str, *, log_exception: bool = True):
22
+ try:
23
+ pydantic.validate_email(value=email)
24
+ email_validator.validate_email(email)
25
+ except Exception as exception:
26
+ if log_exception:
27
+ _logger.warning(exception)
28
+ raise ReallyValidateEmailException(
29
+ email=email,
30
+ error_message=str(exception)
31
+ )
32
+
33
+
34
+ def is_really_email_valid(email: str) -> bool:
35
+ try:
36
+ really_validate_email(email=email, log_exception=False)
37
+ except ReallyValidateEmailException:
38
+ return False
39
+ return True
40
+
41
+
42
+ def __example():
43
+ print(is_really_email_valid("asfas@mail.sex"))
44
+
45
+
46
+ if __name__ == '__main__':
47
+ __example()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: arpakitlib
3
- Version: 1.8.239
3
+ Version: 1.8.241
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  Keywords: arpakitlib,arpakit,arpakit-company,arpakitcompany,arpakit_company
@@ -422,9 +422,10 @@ arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,40
422
422
  arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
423
423
  arpakitlib/clone_pydantic_model_fields.py,sha256=xxLwtvJzDf8EWMvBE4psWIj8c-cyeCxLRX76oCY_4zk,1214
424
424
  arpakitlib/pydantic_schema_from_sqlalchemy_model.py,sha256=_5Y79kQ4lLIOL6_afIFVwxY1EXzTMpi-veRR-WkPFOs,2879
425
- arpakitlib/raise_own_exception_if_exception.py,sha256=NMZsURUtb07s0zxPySayk4bXymqhF7ng74dxgGnLBbw,5968
426
- arpakitlib-1.8.239.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
427
- arpakitlib-1.8.239.dist-info/METADATA,sha256=sDFT7bGpyWjEvMavq3bsvdGsGXGT9SUc1AvumYPvnE0,3741
428
- arpakitlib-1.8.239.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
429
- arpakitlib-1.8.239.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
430
- arpakitlib-1.8.239.dist-info/RECORD,,
425
+ arpakitlib/raise_own_exception_if_exception.py,sha256=A6TuNSBk1pHaQ_qxnUmE2LgsNGA1IGqX26b1_HEA4Nc,5978
426
+ arpakitlib/really_validate_email.py,sha256=HBfhyiDB3INI6Iq6hR2WOMKA5wVWWRl0Qun-x__OZ9o,1201
427
+ arpakitlib-1.8.241.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
428
+ arpakitlib-1.8.241.dist-info/METADATA,sha256=9zdoYCPTVYXqGyVzyYxF0Pgde5y0JldKABXsc0XSFj4,3741
429
+ arpakitlib-1.8.241.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
430
+ arpakitlib-1.8.241.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
431
+ arpakitlib-1.8.241.dist-info/RECORD,,