ramifice 0.6.0__py3-none-any.whl → 0.6.1__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.
@@ -8,7 +8,10 @@ Supported fields:
8
8
  import asyncio
9
9
  from typing import Any
10
10
 
11
- from email_validator import EmailNotValidError, validate_email
11
+ from email_validator import (
12
+ EmailNotValidError,
13
+ validate_email,
14
+ )
12
15
 
13
16
  from ramifice.paladins.tools import (
14
17
  accumulate_error,
@@ -70,7 +73,7 @@ class TextGroupMixin:
70
73
  err_msg = translations._("Is not unique !")
71
74
  accumulate_error(err_msg, params)
72
75
  # Validation Email, Url, IP, Color, Phone.
73
- if "EmailField" == field_type:
76
+ if field_type == "EmailField":
74
77
  try:
75
78
  emailinfo = await asyncio.to_thread(
76
79
  validate_email,
@@ -82,16 +85,16 @@ class TextGroupMixin:
82
85
  except EmailNotValidError:
83
86
  err_msg = translations._("Invalid Email address !")
84
87
  accumulate_error(err_msg, params)
85
- elif "URLField" == field_type and not is_url(value):
88
+ elif field_type == "URLField" and not is_url(value):
86
89
  err_msg = translations._("Invalid URL address !")
87
90
  accumulate_error(err_msg, params)
88
- elif "IPField" == field_type and not is_ip(value):
91
+ elif field_type == "IPField" and not is_ip(value):
89
92
  err_msg = translations._("Invalid IP address !")
90
93
  accumulate_error(err_msg, params)
91
- elif "ColorField" == field_type and not is_color(value):
94
+ elif field_type == "ColorField" and not is_color(value):
92
95
  err_msg = translations._("Invalid Color code !")
93
96
  accumulate_error(err_msg, params)
94
- elif "PhoneField" == field_type and not is_phone(value):
97
+ elif field_type == "PhoneField" and not is_phone(value):
95
98
  err_msg = translations._("Invalid Phone number !")
96
99
  accumulate_error(err_msg, params)
97
100
  # Insert result.
ramifice/utils/tools.py CHANGED
@@ -1,5 +1,6 @@
1
1
  """Global collection of auxiliary methods."""
2
2
 
3
+ import asyncio
3
4
  import ipaddress
4
5
  import math
5
6
  import os
@@ -49,10 +50,14 @@ def normal_email(email: str | None) -> str | None:
49
50
  return normal
50
51
 
51
52
 
52
- def is_email(email: str | None) -> bool:
53
+ async def is_email(email: str | None) -> bool:
53
54
  """Validate Email address."""
54
55
  try:
55
- validate_email(str(email), check_deliverability=True)
56
+ await asyncio.to_thread(
57
+ validate_email,
58
+ str(email),
59
+ check_deliverability=True,
60
+ )
56
61
  except EmailNotValidError:
57
62
  return False
58
63
  return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ramifice
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: ORM-like API MongoDB for Python language.
5
5
  Project-URL: Homepage, https://github.com/kebasyaty/ramifice
6
6
  Project-URL: Documentation, https://kebasyaty.github.io/ramifice/
@@ -557,7 +557,7 @@ if is_password("12345678"):
557
557
  ...
558
558
 
559
559
  # Validate Email address.
560
- if is_email("kebasyaty@gmail.com"):
560
+ if await is_email("kebasyaty@gmail.com"):
561
561
  ...
562
562
 
563
563
  # Normalizing email address.
@@ -64,13 +64,13 @@ ramifice/paladins/groups/img_group.py,sha256=YDJTvbRoqQ2nf7-2QbIQ72I4j_c98_d5LZN
64
64
  ramifice/paladins/groups/num_group.py,sha256=sbxzTdl33TVySfaNfqMixyBkJ69v6AqEgraFUN3Kftk,2317
65
65
  ramifice/paladins/groups/pass_group.py,sha256=uuIIqMBXsYG7vTHc_AhdgWuNCivxTgQMjkEu0-ElSmY,1887
66
66
  ramifice/paladins/groups/slug_group.py,sha256=ztiA2v7e5lQYRZtlLw8WGOhSWaYQfOdZ6wkKbx3ZbTM,2329
67
- ramifice/paladins/groups/text_group.py,sha256=FSrZbm3Fd0SU0IIFFBxs9XN2HPSFHshgwIRiLaUDwNY,4456
67
+ ramifice/paladins/groups/text_group.py,sha256=cdwUZoomw61A7CmDIbds_oOaia2tD-J5LLuj5b8E8O4,4472
68
68
  ramifice/utils/__init__.py,sha256=xixHoOX4ja5jIUZemem1qn4k4aonv3G3Q76azQK_pkU,43
69
69
  ramifice/utils/errors.py,sha256=iuhq7fzpUmsOyeXeg2fJjta8yAuqlXLKsZVMpfUhtHE,1901
70
70
  ramifice/utils/fixtures.py,sha256=IG55gdFUbrWRQ2cL3Df9mYBgjVlFrlRuWB7UeK1Nzd8,3173
71
71
  ramifice/utils/globals.py,sha256=uR20um3Qg_1SG1t7WyWbpq8kQD-9Mslyr_c1yh5Hw9w,1751
72
72
  ramifice/utils/migration.py,sha256=JUhYaJ61IS1W_Khof0sbqeHDQrI7-XcmTQ41PhCdjcQ,11017
73
- ramifice/utils/tools.py,sha256=1yFIOrkWToM55OpMMId9T26hZqPQWnxLU3_jQ4Ejazg,2743
73
+ ramifice/utils/tools.py,sha256=mEcLYdSM3x0Sj9d6ygYOfsOA7iXnmELoNNsCWtGIuGE,2841
74
74
  ramifice/utils/translations.py,sha256=aEkNKilD7RlJjBixqhh0cfIMw9lg13woaIwd3dyR8G4,4247
75
75
  ramifice/utils/unit.py,sha256=PPNKWYFJ8cz0nwbBPaTdL58_Nr7N0fIHFJBpKG2ZLKI,2482
76
76
  ramifice/utils/mixins/__init__.py,sha256=GrxJDsw73bEkitIh0-0BCxNnUK-N5uRXMCRlaPoaz1o,265
@@ -78,7 +78,7 @@ ramifice/utils/mixins/add_valid.py,sha256=TLOObedzXNA9eCylfAVbVCqIKE5sV-P5AdIN7a
78
78
  ramifice/utils/mixins/hooks.py,sha256=33jvJRhfnJeL2Hd_YFXk3M_7wjqHaByU2wRjKyboL6s,914
79
79
  ramifice/utils/mixins/indexing.py,sha256=Z0427HoaVRyNmSNN8Fx0mSICgAKV-gDdu3iR5qYUEbs,329
80
80
  ramifice/utils/mixins/json_converter.py,sha256=WhigXyDAV-FfILaZuwvRFRIk0D90Rv3dG5t-mv5fVyc,1107
81
- ramifice-0.6.0.dist-info/METADATA,sha256=mGAJxiS68kKIy6ZO94iagVCIAXPPVM2hoxSZnwHGKyk,20987
82
- ramifice-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
- ramifice-0.6.0.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
- ramifice-0.6.0.dist-info/RECORD,,
81
+ ramifice-0.6.1.dist-info/METADATA,sha256=oINmxfbfasgZhCMYMBRTUMErLb2Exx4l5khQjgXGusY,20993
82
+ ramifice-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
+ ramifice-0.6.1.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
+ ramifice-0.6.1.dist-info/RECORD,,