ramifice 0.3.25__py3-none-any.whl → 0.3.26__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.
ramifice/utilities.py CHANGED
@@ -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.26
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
  )
@@ -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
  ```
@@ -13,7 +13,7 @@ ramifice/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  ramifice/store.py,sha256=MpDEPvUvbs11FXjakNtHPm9MekIv5p1U3as2Y80lTyc,1860
14
14
  ramifice/translations.py,sha256=GNGE0ULAA0aOY5pTxUd3MQW-nVaKvp6BeXWEcsR0s0o,4048
15
15
  ramifice/types.py,sha256=ljo6VscUGWEJ4Km4JYo8GEfxd1YK1CUbS8CfHp_MlEA,2390
16
- ramifice/utilities.py,sha256=2qfdSvqlL3rhT8-7MW83IoMjKQ0CZz0e24UTxMcOq90,2654
16
+ ramifice/utilities.py,sha256=NX4mtXBi6H3UNlYcTMdlfltJ0MikTPa7kpB3F0qmUpM,2731
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
@@ -76,7 +76,7 @@ ramifice/paladins/groups/num_group.py,sha256=lpyFG9a6WGOzu9f_9jwYVWZNFHxG0B0AVWv
76
76
  ramifice/paladins/groups/pass_group.py,sha256=tjBSovPSCKATF46FazT0a1EQ2YiztRqOjBq0uu2nTU8,1852
77
77
  ramifice/paladins/groups/slug_group.py,sha256=SVYxHcSSgCA51C18LVGxMQYuUw-6ryQlTi6B9T8Dzsw,2185
78
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,,
79
+ ramifice-0.3.26.dist-info/METADATA,sha256=RtWfTYrINWsELm_ilRSn8MYrv4He6xvlKJ9ete4zMT4,20706
80
+ ramifice-0.3.26.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
81
+ ramifice-0.3.26.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
82
+ ramifice-0.3.26.dist-info/RECORD,,