ramifice 0.3.25__py3-none-any.whl → 0.3.27__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.
@@ -6,7 +6,7 @@ Supported fields: FileField
6
6
  from typing import Any
7
7
 
8
8
  from ... import translations
9
- from ...utilities import to_human_size
9
+ from ...tools import to_human_size
10
10
  from ..tools import accumulate_error, panic_type_error
11
11
 
12
12
 
@@ -8,7 +8,7 @@ from typing import Any
8
8
  from PIL import Image
9
9
 
10
10
  from ... import translations
11
- from ...utilities import to_human_size
11
+ from ...tools import to_human_size
12
12
  from ..tools import accumulate_error, panic_type_error
13
13
 
14
14
 
@@ -8,7 +8,7 @@ from typing import Any
8
8
  from argon2 import PasswordHasher
9
9
 
10
10
  from ... import translations
11
- from ...utilities import is_password
11
+ from ...tools import is_password
12
12
  from ..tools import accumulate_error, panic_type_error
13
13
 
14
14
 
@@ -10,7 +10,7 @@ from typing import Any
10
10
  from email_validator import EmailNotValidError, validate_email
11
11
 
12
12
  from ... import translations
13
- from ...utilities import is_color, is_ip, is_phone, is_url
13
+ from ...tools import is_color, is_ip, is_phone, is_url
14
14
  from ..tools import accumulate_error, check_uniqueness, panic_type_error
15
15
 
16
16
 
@@ -29,13 +29,17 @@ def to_human_size(size: int) -> str:
29
29
 
30
30
 
31
31
  def get_file_size(path: str) -> int:
32
- """Get human readable version of file size."""
32
+ """Get file size in bytes."""
33
33
  size: int = os.path.getsize(path)
34
34
  return size
35
35
 
36
36
 
37
37
  def normal_email(email: str | None) -> str | None:
38
- """Normalizing email address."""
38
+ """Normalizing email address.
39
+
40
+ Use this before requeste to a database.
41
+ For example, on the login page.
42
+ """
39
43
  normal: str | None = None
40
44
  try:
41
45
  emailinfo = validate_email(str(email), check_deliverability=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ramifice
3
- Version: 0.3.25
3
+ Version: 0.3.27
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/
@@ -513,7 +513,7 @@ await user.delete(remove_files=False)
513
513
  # Verification, replacement and recoverang of password.
514
514
  user = User()
515
515
  await user.verify_password(password="12345678")
516
- await user.update_password( # uses verify_password
516
+ await user.update_password( # + verify_password
517
517
  old_password="12345678",
518
518
  new_password="O2eA4GIr38KGGlS",
519
519
  )
@@ -522,7 +522,7 @@ await user.update_password( # uses verify_password
522
522
  ## General auxiliary methods
523
523
 
524
524
  ```python
525
- from ramifice.utilities import (
525
+ from ramifice.tools import (
526
526
  get_file_size,
527
527
  hash_to_obj_id,
528
528
  is_color,
@@ -536,34 +536,47 @@ from ramifice.utilities import (
536
536
  to_human_size,
537
537
  )
538
538
 
539
+ # Validate Password.
539
540
  if is_password("12345678"):
540
541
  ...
541
542
 
543
+ # Validate Email address.
542
544
  if is_email("kebasyaty@gmail.com"):
543
545
  ...
544
546
 
545
- email = normal_email("kebasyaty@gmail.com") # + validate_email
547
+ # Normalizing email address.
548
+ # Use this before requeste to a database.
549
+ # For example, on the login page.
550
+ email: str | None = normal_email("kebasyaty@gmail.com") # None, if not valid
546
551
 
552
+ # Validate URL address.
547
553
  if is_url("https://www.google.com"):
548
554
  ...
549
555
 
556
+ # Validate IP address.
550
557
  if is_ip("127.0.0.1"):
551
558
  ...
552
559
 
560
+ # Validate Color code.
553
561
  if is_color("#000"):
554
562
  ...
555
563
 
564
+ # Validate Phone number.
556
565
  if is_phone("+447986123456"):
557
566
  ...
558
567
 
568
+ # Validation of the Mongodb identifier.
559
569
  if is_mongo_id("666f6f2d6261722d71757578"):
560
570
  ...
561
571
 
572
+ # Get ObjectId from hash string.
562
573
  from bson.objectid import ObjectId
563
574
  _id: ObjectId | None = hash_to_obj_id("666f6f2d6261722d71757578")
564
575
 
576
+ # Convert number of bytes to readable format.
565
577
  size: str = to_human_size(2097152) # => 2.0 MB
566
578
 
579
+ # Get file size in bytes.
567
580
  path = "public/media/default/no_doc.odt"
568
581
  size: int = get_file_size(path) # => 9843
569
582
  ```
@@ -11,9 +11,9 @@ ramifice/model.py,sha256=xhLKosxnT3HkPr6j_BSkB7pvG2WNY_7uylcHo3Oq0vM,6521
11
11
  ramifice/pseudo_model.py,sha256=K00TqtrO6QScfAswM3Rr5Y017PfbtEXHymGSJYYgA40,6744
12
12
  ramifice/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  ramifice/store.py,sha256=MpDEPvUvbs11FXjakNtHPm9MekIv5p1U3as2Y80lTyc,1860
14
+ ramifice/tools.py,sha256=NX4mtXBi6H3UNlYcTMdlfltJ0MikTPa7kpB3F0qmUpM,2731
14
15
  ramifice/translations.py,sha256=GNGE0ULAA0aOY5pTxUd3MQW-nVaKvp6BeXWEcsR0s0o,4048
15
16
  ramifice/types.py,sha256=ljo6VscUGWEJ4Km4JYo8GEfxd1YK1CUbS8CfHp_MlEA,2390
16
- ramifice/utilities.py,sha256=2qfdSvqlL3rhT8-7MW83IoMjKQ0CZz0e24UTxMcOq90,2654
17
17
  ramifice/commons/__init__.py,sha256=LHCsdpl4z8W-xUvAlOr1ad0ras9hspvCpuce4SAdfP0,472
18
18
  ramifice/commons/general.py,sha256=fTnIRA3IGbi0lMKBCgeqkI7BGJWTbZVu0nOJYoNRSRU,4571
19
19
  ramifice/commons/indexes.py,sha256=ABNRXeWZSreAE4_EDlsTN9aS8QiZbzhsatUJFn2EuOo,3849
@@ -69,14 +69,14 @@ ramifice/paladins/groups/__init__.py,sha256=hpqmWLsYAMvZHAbmMXluQSqLhkHOSTUAgLHy
69
69
  ramifice/paladins/groups/bool_group.py,sha256=oJc9mw9KGrnK_Pj7uXixYYQAJphcXLr_xSQv3PMUlcU,792
70
70
  ramifice/paladins/groups/choice_group.py,sha256=ZV6t6qgh__BzWGRUSx2RdXH_K9BtBOo0eAZ3Yon0tfY,1723
71
71
  ramifice/paladins/groups/date_group.py,sha256=bVhzmwsN3sKbmzvm4jI0i_Mzjwn8gdx4kxCUWq-0Yqs,3736
72
- ramifice/paladins/groups/file_group.py,sha256=AtGu2sQ9A64dPo2Kpt4milp5HWPdULdPdQycwFW8ZgE,2925
72
+ ramifice/paladins/groups/file_group.py,sha256=mK12CeQPtbvckAeFApmT1TyG0dxh1rLMv7EmL4zuP-8,2921
73
73
  ramifice/paladins/groups/id_group.py,sha256=zAlJrDTOdRY9e7eFYSXPjjsD05A4EsgSE6ibN3KKOMU,1263
74
- ramifice/paladins/groups/img_group.py,sha256=o0bMI1WIA6t1QrhLaR2bBAAJUKCgHg7SiIFQsGTr2Cg,5535
74
+ ramifice/paladins/groups/img_group.py,sha256=J5ZR_9h3ZUZcKlJ9cCgwWr36V1DGHqqSjU8A-1okcto,5531
75
75
  ramifice/paladins/groups/num_group.py,sha256=lpyFG9a6WGOzu9f_9jwYVWZNFHxG0B0AVWvvbv_2mV0,2224
76
- ramifice/paladins/groups/pass_group.py,sha256=tjBSovPSCKATF46FazT0a1EQ2YiztRqOjBq0uu2nTU8,1852
76
+ ramifice/paladins/groups/pass_group.py,sha256=Vh2guTwRsMK82Gkqhg2jYhk68OjL3Cjz9NxxJ6z_1D8,1848
77
77
  ramifice/paladins/groups/slug_group.py,sha256=SVYxHcSSgCA51C18LVGxMQYuUw-6ryQlTi6B9T8Dzsw,2185
78
- ramifice/paladins/groups/text_group.py,sha256=o5DnlptN93vsHtb36qO-noEnPv7CSAiqVj1j603zKw0,3159
79
- ramifice-0.3.25.dist-info/METADATA,sha256=RCix9UrN67JO5bCxjhQ4lgWYtiX-RlQJHzm7erzuuN8,20303
80
- ramifice-0.3.25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
81
- ramifice-0.3.25.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
82
- ramifice-0.3.25.dist-info/RECORD,,
78
+ ramifice/paladins/groups/text_group.py,sha256=lveVuDMcQwLNUtQBlOjfwFzEWH5_F8L6JxIf936lIQ0,3155
79
+ ramifice-0.3.27.dist-info/METADATA,sha256=txVWbR0T_4Ab1-lrKIUiyHBuHTCIHAFTzM5FQcv-P18,20702
80
+ ramifice-0.3.27.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
81
+ ramifice-0.3.27.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
82
+ ramifice-0.3.27.dist-info/RECORD,,