ramifice 0.8.28__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,6 +23,7 @@ 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",
@@ -31,7 +32,7 @@ __all__ = (
31
32
 
32
33
  import logging
33
34
 
34
- from xloft import NamedTuple
35
+ from xloft import NamedTuple, to_human_size
35
36
 
36
37
  from ramifice.models.decorator import model
37
38
  from ramifice.utils import translations
@@ -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.28
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/
@@ -63,7 +63,6 @@ Description-Content-Type: text/markdown
63
63
  <a href="https://mypy-lang.org/" alt="Types: Mypy"><img src="https://img.shields.io/badge/types-Mypy-202235.svg?color=0c7ebf" alt="Types: Mypy"></a>
64
64
  <a href="https://docs.astral.sh/ruff/" alt="Code style: Ruff"><img src="https://img.shields.io/badge/code%20style-Ruff-FDD835.svg" alt="Code style: Ruff"></a>
65
65
  <a href="https://github.com/kebasyaty/ramifice" alt="PyPI implementation"><img src="https://img.shields.io/pypi/implementation/ramifice" alt="PyPI implementation"></a>
66
- <a href="https://github.com/kebasyaty/ramifice" alt="GitHub repository"><img src="https://img.shields.io/badge/--ecebeb?logo=github&logoColor=000000" alt="GitHub repository"></a>
67
66
  <br>
68
67
  <a href="https://pypi.org/project/ramifice"><img src="https://img.shields.io/pypi/format/ramifice" alt="Format"></a>
69
68
  <a href="https://github.com/kebasyaty/ramifice"><img src="https://img.shields.io/github/languages/top/kebasyaty/ramifice" alt="Top"></a>
@@ -97,7 +96,7 @@ Online browsable documentation is available at [https://kebasyaty.github.io/rami
97
96
 
98
97
  ## Requirements
99
98
 
100
- [View the list of requirements.](https://github.com/kebasyaty/ramifice/blob/v0/REQUIREMENTS.md "View the list of requirements.")
99
+ [View the list of requirements](https://github.com/kebasyaty/ramifice/blob/v0/REQUIREMENTS.md "Requirements").
101
100
 
102
101
  ## Installation
103
102
 
@@ -106,7 +105,7 @@ Online browsable documentation is available at [https://kebasyaty.github.io/rami
106
105
  [![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white)](https://github.com/kebasyaty/ramifice/blob/v0/assets/UBUNTU_INSTALL_MONGODB.md)
107
106
  [![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)](https://www.mongodb.com/try/download/community)
108
107
 
109
- 1. Run:
108
+ 2. Run:
110
109
 
111
110
  ```shell
112
111
  # Fedora:
@@ -129,14 +128,14 @@ uv add ramifice
129
128
 
130
129
  ## Usage
131
130
 
132
- It is recommended to look at examples [here](https://github.com/kebasyaty/ramifice/tree/v0/examples "here").
131
+ [It is recommended to look at examples here](https://github.com/kebasyaty/ramifice/tree/v0/examples "It is recommended to look at examples here").
133
132
 
134
133
  ```python
135
134
  import re
136
135
  import asyncio
137
136
  from typing import Any
138
137
  from datetime import datetime
139
- import pprint
138
+ from pprint import pprint as pp
140
139
 
141
140
  from pymongo import AsyncMongoClient
142
141
  from ramifice import (
@@ -144,13 +143,13 @@ from ramifice import (
144
143
  model,
145
144
  translations,
146
145
  Migration,
146
+ to_human_size,
147
147
  )
148
148
  from ramifice.fields import (
149
149
  ImageField,
150
150
  PasswordField,
151
151
  TextField,
152
152
  )
153
- from ramifice.utils.tools import to_human_size
154
153
 
155
154
 
156
155
  @model(service_name="Accounts")
@@ -246,7 +245,7 @@ async def main():
246
245
  {f"username": user.username.value}
247
246
  )
248
247
  if user_details is not None:
249
- pprint.pprint(user_details)
248
+ pp(user_details)
250
249
  else:
251
250
  print("No User!")
252
251
 
@@ -324,9 +323,9 @@ uv run pybabel compile -d config/translations/ramifice
324
323
 
325
324
  ## Model Parameters
326
325
 
327
- See the documentation [here](https://kebasyaty.github.io/ramifice/ "here").
326
+ [See the documentation here.](https://kebasyaty.github.io/ramifice/ "See the documentation here.")
328
327
 
329
- ###### ( only `service_name` is a required parameter )
328
+ ( only `service_name` is a required parameter )
330
329
 
331
330
  <div>
332
331
  <table>
@@ -615,7 +614,7 @@ size: int = get_file_size(path) # => 9843
615
614
 
616
615
  ## Changelog
617
616
 
618
- [View the change history.](https://github.com/kebasyaty/ramifice/blob/v0/CHANGELOG.md "Changelog")
617
+ [View the change history](https://github.com/kebasyaty/ramifice/blob/v0/CHANGELOG.md "Changelog").
619
618
 
620
619
  ## License
621
620
 
@@ -1,4 +1,4 @@
1
- ramifice/__init__.py,sha256=rTkA9TUWsis-q056oslAcalr3rwNChMUcpQX5Q43Pzs,1520
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.28.dist-info/METADATA,sha256=X_XGDUwRgnmu1K2qcI9zlEzKoKQSWbbquGD1DMsT28Q,21236
81
- ramifice-0.8.28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
82
- ramifice-0.8.28.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
83
- ramifice-0.8.28.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,,