ramifice 0.7.0__py3-none-any.whl → 0.8.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.
ramifice/__init__.py CHANGED
@@ -16,5 +16,5 @@
16
16
 
17
17
  from ramifice.models.decorator import model
18
18
  from ramifice.utils import translations
19
- from ramifice.utils.migration import MigrationManager
19
+ from ramifice.utils.migration import Migration
20
20
  from ramifice.utils.unit import Unit
@@ -22,8 +22,8 @@ class FloatField(Field, NumberGroup, JsonMixin):
22
22
  required: bool = False,
23
23
  readonly: bool = False,
24
24
  unique: bool = False,
25
- max_number: int | None = None,
26
- min_number: int | None = None,
25
+ max_number: float | None = None,
26
+ min_number: float | None = None,
27
27
  step: float = 1.0,
28
28
  input_type: str = "number", # number | range
29
29
  ):
@@ -17,8 +17,8 @@ from ramifice.utils.errors import DoesNotMatchRegexError, NoModelsForMigrationEr
17
17
  from ramifice.utils.fixtures import apply_fixture
18
18
 
19
19
 
20
- class MigrationManager:
21
- """Monitoring and updating database state for application."""
20
+ class Migration:
21
+ """Migration of models to database."""
22
22
 
23
23
  def __init__(self, database_name: str, mongo_client: AsyncMongoClient): # noqa: D107
24
24
  constants.DEBUG = False
@@ -43,7 +43,9 @@ class MigrationManager:
43
43
  """
44
44
  # Get access to super collection.
45
45
  # (Contains Model state and dynamic field data.)
46
- super_collection: AsyncCollection = constants.MONGO_DATABASE[constants.SUPER_COLLECTION_NAME]
46
+ super_collection: AsyncCollection = constants.MONGO_DATABASE[
47
+ constants.SUPER_COLLECTION_NAME
48
+ ]
47
49
  # Switch the `is_model_exist` parameter in `False`.
48
50
  async for model_state in super_collection.find():
49
51
  q_filter = {"collection_name": model_state["collection_name"]}
@@ -54,7 +56,9 @@ class MigrationManager:
54
56
  """Get the state of the current model from a super collection."""
55
57
  # Get access to super collection.
56
58
  # (Contains Model state and dynamic field data.)
57
- super_collection: AsyncCollection = constants.MONGO_DATABASE[constants.SUPER_COLLECTION_NAME]
59
+ super_collection: AsyncCollection = constants.MONGO_DATABASE[
60
+ constants.SUPER_COLLECTION_NAME
61
+ ]
58
62
  # Get state of current Model.
59
63
  model_state: dict[str, Any] | None = await super_collection.find_one(
60
64
  {"collection_name": metadata["collection_name"]}
@@ -89,7 +93,9 @@ class MigrationManager:
89
93
  database = constants.MONGO_DATABASE
90
94
  # Get access to super collection.
91
95
  # (Contains Model state and dynamic field data.)
92
- super_collection: AsyncCollection = constants.MONGO_DATABASE[constants.SUPER_COLLECTION_NAME]
96
+ super_collection: AsyncCollection = constants.MONGO_DATABASE[
97
+ constants.SUPER_COLLECTION_NAME
98
+ ]
93
99
  # Delete data for non-existent Models.
94
100
  async for model_state in super_collection.find():
95
101
  if model_state["is_model_exist"] is False:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ramifice
3
- Version: 0.7.0
3
+ Version: 0.8.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/
@@ -132,7 +132,7 @@ from datetime import datetime
132
132
  import pprint
133
133
 
134
134
  from pymongo import AsyncMongoClient
135
- from ramifice import model, translations, MigrationManager
135
+ from ramifice import model, translations, Migration
136
136
  from ramifice.fields import (
137
137
  ImageField,
138
138
  PasswordField,
@@ -207,7 +207,7 @@ class User:
207
207
  async def main():
208
208
  client = AsyncMongoClient()
209
209
 
210
- await MigrationManager(
210
+ await Migration(
211
211
  database_name="test_db",
212
212
  mongo_client=client,
213
213
  ).migrate()
@@ -1,4 +1,4 @@
1
- ramifice/__init__.py,sha256=DjzNF_-s3HHGIi2JU9Yyd5EOKhL1PrHWLjpsASvPclw,827
1
+ ramifice/__init__.py,sha256=Pm2v5QCHErdx0sWBFeJnoczz3fg_rzd8UB7AS_ICDL0,820
2
2
  ramifice/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  ramifice/commons/__init__.py,sha256=NZeqK9PEX7q8bVfiUaysdk_GShpA-5EfdM61mhj3wHg,513
4
4
  ramifice/commons/general.py,sha256=qqISFnLo6WvStQSbm--ayRHeNGJcugpk3W_2p14ELiM,5402
@@ -26,7 +26,7 @@ ramifice/fields/date_field.py,sha256=-M_dD8tVUXcDCQD5Hy5Ns9Z2QGlRya0qbvoWgA4qpmg
26
26
  ramifice/fields/date_time_field.py,sha256=ahjX-cD5Qj-V7JUi5QAZ8qgv9UePhYYYzJghiasKdqE,5312
27
27
  ramifice/fields/email_field.py,sha256=4Kxy1K6CXJUJ8Db0CQuopjodiY4ybe7V0GT756t7Nks,3481
28
28
  ramifice/fields/file_field.py,sha256=icckL_LGfPlotHO7j32lMre9J0O0k-WVjMQg5QdQav4,8130
29
- ramifice/fields/float_field.py,sha256=fj9TPe1IYlZG7gTPp0Hr8C4PZJU9XEZMEym9hfEbB7M,4633
29
+ ramifice/fields/float_field.py,sha256=JeVwoIi6j-dovXarZ3NgmSQI7f3qZzydlRs_yqp3Faw,4637
30
30
  ramifice/fields/id_field.py,sha256=YO5oIwXtqgURjjd2oYe2ouXxdpaiJp5ZhUgUA2pkNeo,4183
31
31
  ramifice/fields/image_field.py,sha256=qoUAkZW2b-EkU5IDvlbxEOFwWpLYFXs9ZFnxL55an6M,11549
32
32
  ramifice/fields/integer_field.py,sha256=xPwpdhYNz4MyHgOypqa29oGNdKZic05yyUYHg5CDD3E,4609
@@ -69,7 +69,7 @@ ramifice/utils/__init__.py,sha256=xixHoOX4ja5jIUZemem1qn4k4aonv3G3Q76azQK_pkU,43
69
69
  ramifice/utils/constants.py,sha256=uR20um3Qg_1SG1t7WyWbpq8kQD-9Mslyr_c1yh5Hw9w,1751
70
70
  ramifice/utils/errors.py,sha256=iuhq7fzpUmsOyeXeg2fJjta8yAuqlXLKsZVMpfUhtHE,1901
71
71
  ramifice/utils/fixtures.py,sha256=IG55gdFUbrWRQ2cL3Df9mYBgjVlFrlRuWB7UeK1Nzd8,3173
72
- ramifice/utils/migration.py,sha256=Sx0uaXHVwGAYbroYuiKPCHrFBjIzOxcY3PCeP0q3KmU,11064
72
+ ramifice/utils/migration.py,sha256=5VYYB7DFMzLCRYWdlwtqGRSUPFdXp5SMxuMWraofVCw,11106
73
73
  ramifice/utils/tools.py,sha256=dJjG92nevSq_US30pUdbBy37pvqBdxXHBeHZxpOInKM,2843
74
74
  ramifice/utils/translations.py,sha256=aEkNKilD7RlJjBixqhh0cfIMw9lg13woaIwd3dyR8G4,4247
75
75
  ramifice/utils/unit.py,sha256=PPNKWYFJ8cz0nwbBPaTdL58_Nr7N0fIHFJBpKG2ZLKI,2482
@@ -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=2K_PZ34AzpesusgyyQFOLXFPcjXez3TWn-m9CHIKwRo,1131
81
- ramifice-0.7.0.dist-info/METADATA,sha256=BAx1XVjis5nz7_9e9KQwRhcIQRwSqDC13vRcVsyjsUs,21030
82
- ramifice-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
- ramifice-0.7.0.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
- ramifice-0.7.0.dist-info/RECORD,,
81
+ ramifice-0.8.1.dist-info/METADATA,sha256=-7ipjUF7Fx9rMP5ISYyeO_oAUBC3nmku8wkMtu1SG1s,21016
82
+ ramifice-0.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
83
+ ramifice-0.8.1.dist-info/licenses/LICENSE,sha256=LrEL0aTZx90HDwFUQCJutORiDjJL9AnuVvCtspXIqt4,1095
84
+ ramifice-0.8.1.dist-info/RECORD,,