ramifice 0.8.29__py3-none-any.whl → 0.8.30__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/__init__.py CHANGED
@@ -23,21 +23,20 @@ The project is more concentrated for web development or for applications with a
23
23
 
24
24
  __all__ = (
25
25
  "NamedTuple",
26
+ "to_human_size",
26
27
  "model",
27
28
  "translations",
28
29
  "Migration",
29
- "to_human_size",
30
30
  "Unit",
31
31
  )
32
32
 
33
33
  import logging
34
34
 
35
- from xloft import NamedTuple
35
+ from xloft import NamedTuple, to_human_size
36
36
 
37
37
  from ramifice.models.decorator import model
38
38
  from ramifice.utils import translations
39
39
  from ramifice.utils.migration import Migration
40
- from ramifice.utils.tools import to_human_size
41
40
  from ramifice.utils.unit import Unit
42
41
 
43
42
  logging.basicConfig(
@@ -7,12 +7,13 @@ __all__ = ("FileGroupMixin",)
7
7
 
8
8
  from typing import Any
9
9
 
10
+ from xloft import to_human_size
11
+
10
12
  from ramifice.paladins.tools import (
11
13
  accumulate_error,
12
14
  panic_type_error,
13
15
  )
14
16
  from ramifice.utils import translations
15
- from ramifice.utils.tools import to_human_size
16
17
 
17
18
 
18
19
  class FileGroupMixin:
@@ -9,10 +9,10 @@ from asyncio import to_thread
9
9
  from typing import Any
10
10
 
11
11
  from PIL import Image
12
+ from xloft import to_human_size
12
13
 
13
14
  from ramifice.paladins.tools import accumulate_error, panic_type_error
14
15
  from ramifice.utils import translations
15
- from ramifice.utils.tools import to_human_size
16
16
 
17
17
 
18
18
  class ImgGroupMixin:
ramifice/utils/tools.py CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  __all__ = (
4
4
  "is_password",
5
- "to_human_size",
6
5
  "get_file_size",
7
6
  "normal_email",
8
7
  "is_email",
@@ -15,7 +14,6 @@ __all__ = (
15
14
  )
16
15
 
17
16
  import ipaddress
18
- import math
19
17
  from asyncio import to_thread
20
18
  from os.path import getsize
21
19
  from typing import Any
@@ -35,14 +33,6 @@ def is_password(password: str | None) -> bool:
35
33
  return True
36
34
 
37
35
 
38
- def to_human_size(size: int) -> str:
39
- """Convert number of bytes to readable format."""
40
- idx = int(math.floor(math.log(size) / math.log(1024))) # noqa: RUF046
41
- size = size if size < 1024 else abs(round(size / pow(1024, idx), 2))
42
- order = ["bytes", "KB", "MB", "GB", "TB"][idx]
43
- return f"{size} {order}"
44
-
45
-
46
36
  async def get_file_size(path: str) -> int:
47
37
  """Get file size in bytes."""
48
38
  size: int = await to_thread(getsize, path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ramifice
3
- Version: 0.8.29
3
+ Version: 0.8.30
4
4
  Summary: ORM-pseudo-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/
@@ -1,4 +1,4 @@
1
- ramifice/__init__.py,sha256=XdLGeKCFqIVRyaj4M_dpdVvQ8Kx8rL3FtyuR08Ehnc4,1590
1
+ ramifice/__init__.py,sha256=Nikv9qaOVLEwtxWIKB9rS6v1SPLgkM2DqQ9PtOlt-x0,1557
2
2
  ramifice/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  ramifice/commons/__init__.py,sha256=HwOckqlNkt4OzFbYqnLw9x0VXLbwO_mJaJ9MLYgSvtI,545
4
4
  ramifice/commons/general.py,sha256=ZryiRH-qf_cH9HCul7EP11UU-k4YO_rp_kku2FWAwj4,5433
@@ -61,9 +61,9 @@ ramifice/paladins/groups/__init__.py,sha256=GdIBJaMKz7L8pBKMAA__a4m-p0g0_RlzCcvD
61
61
  ramifice/paladins/groups/bool_group.py,sha256=X8P4YDh02gNzxTo9rgeCnmnV88jApUPqPLYIkpf5vGg,841
62
62
  ramifice/paladins/groups/choice_group.py,sha256=NkD2sKqBkdUMHY36pFdvL4uQ-81LXByRHF_lhCEAI6Y,1848
63
63
  ramifice/paladins/groups/date_group.py,sha256=3i6U2mwFMxW8s5rRi7RtSr7my6a5Cdy5MRWe601hjGA,3780
64
- ramifice/paladins/groups/file_group.py,sha256=vDeW5JCqKHWa43LILcVWJSU1TG-CrwKXQZhchWsZgM8,2975
64
+ ramifice/paladins/groups/file_group.py,sha256=_BbAveMZiwII7ZkCdePUSHzdkz3jVsKP2Aiop7lfedI,2962
65
65
  ramifice/paladins/groups/id_group.py,sha256=9iurBTOuhG1_8Wmxc5piTMcUNxAW3H0ZavA1sW7uopY,1321
66
- ramifice/paladins/groups/img_group.py,sha256=xSrDYqviuMt7mxOZiO0jKll1WnVlWRaSynk7ZvdEJ4c,6131
66
+ ramifice/paladins/groups/img_group.py,sha256=5kmdkVnXKCeCiOnuO5T8Rq3U_R6gwXsHLYi7CtMfMfI,6116
67
67
  ramifice/paladins/groups/num_group.py,sha256=oiBqm9lFsyHBKZgxfWvcQUpePPIT_0TBGPVrt0ae57s,2285
68
68
  ramifice/paladins/groups/pass_group.py,sha256=54kvAyoUCEjujTw0Dh6oUrtv3RU80sWEem_b-3Ytv0k,1920
69
69
  ramifice/paladins/groups/slug_group.py,sha256=sf-9CebDLoCDsaxyPVJKMhi6D_tWFeg3ET8Qk5E8pU8,2505
@@ -74,10 +74,10 @@ ramifice/utils/errors.py,sha256=eEV7-aVR0U19vKqTd9JRHFJXcOv6N1HtXSzqeQpdciE,2796
74
74
  ramifice/utils/fixtures.py,sha256=0hdJGu895zDvVg5HUmRVUqDLZbvM-7BlhwTF6vhRqJI,3374
75
75
  ramifice/utils/migration.py,sha256=rA6RMIB7xrLNGUJHPuvxA5O0B3NkmG155et82kOtu7g,11316
76
76
  ramifice/utils/mixins.py,sha256=XSkxJllqsMxN7xcP_9kn3-GRS4a1l_QQpFOlD3e-tIM,1123
77
- ramifice/utils/tools.py,sha256=EKNJAV9Ch17IrmghLcu7-I69gDNkDSqPepG9GKU7WkA,3163
77
+ ramifice/utils/tools.py,sha256=d5S38ksia6avBpLzXM3e3fzmRUMd8gM43JGAzJ7Nh6w,2799
78
78
  ramifice/utils/translations.py,sha256=EWITTDd4uXukRubOchqGwNjmZWt5HxoxRgq_kKeGsR8,4646
79
79
  ramifice/utils/unit.py,sha256=fxeWGWh5GkI8E9lxsf80HOh-NihSrqEmIQAQlUKMIaE,2497
80
- ramifice-0.8.29.dist-info/METADATA,sha256=hfYwYXqfRfVsffnIR8v6hpZ7xrqOL83KMSYJ0ZHyy_s,21066
81
- ramifice-0.8.29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
82
- ramifice-0.8.29.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
83
- ramifice-0.8.29.dist-info/RECORD,,
80
+ ramifice-0.8.30.dist-info/METADATA,sha256=WjLIL9XaylonlVc_5Vb0HBM64Ka6bJqGN5uTiOIyJ5c,21066
81
+ ramifice-0.8.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
82
+ ramifice-0.8.30.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
83
+ ramifice-0.8.30.dist-info/RECORD,,