ramifice 0.8.21__py3-none-any.whl → 0.8.25__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.
Files changed (84) hide show
  1. ramifice/__init__.py +8 -1
  2. ramifice/commons/__init__.py +2 -2
  3. ramifice/commons/general.py +11 -11
  4. ramifice/commons/indexes.py +8 -8
  5. ramifice/commons/many.py +6 -6
  6. ramifice/commons/one.py +8 -8
  7. ramifice/commons/tools.py +4 -4
  8. ramifice/commons/unit_manager.py +3 -3
  9. ramifice/fields/__init__.py +1 -1
  10. ramifice/fields/bool_field.py +4 -4
  11. ramifice/fields/choice_float_dyn_field.py +5 -5
  12. ramifice/fields/choice_float_field.py +5 -5
  13. ramifice/fields/choice_float_mult_dyn_field.py +5 -5
  14. ramifice/fields/choice_float_mult_field.py +5 -5
  15. ramifice/fields/choice_int_dyn_field.py +5 -5
  16. ramifice/fields/choice_int_field.py +5 -5
  17. ramifice/fields/choice_int_mult_dyn_field.py +5 -5
  18. ramifice/fields/choice_int_mult_field.py +5 -5
  19. ramifice/fields/choice_text_dyn_field.py +5 -5
  20. ramifice/fields/choice_text_field.py +5 -5
  21. ramifice/fields/choice_text_mult_dyn_field.py +5 -5
  22. ramifice/fields/choice_text_mult_field.py +5 -5
  23. ramifice/fields/color_field.py +4 -4
  24. ramifice/fields/date_field.py +7 -7
  25. ramifice/fields/date_time_field.py +7 -7
  26. ramifice/fields/email_field.py +4 -4
  27. ramifice/fields/file_field.py +6 -6
  28. ramifice/fields/float_field.py +4 -4
  29. ramifice/fields/general/__init__.py +1 -1
  30. ramifice/fields/general/choice_group.py +9 -10
  31. ramifice/fields/general/date_group.py +11 -11
  32. ramifice/fields/general/field.py +13 -13
  33. ramifice/fields/general/file_group.py +10 -10
  34. ramifice/fields/general/number_group.py +8 -8
  35. ramifice/fields/general/text_group.py +10 -10
  36. ramifice/fields/id_field.py +7 -7
  37. ramifice/fields/image_field.py +6 -6
  38. ramifice/fields/integer_field.py +4 -4
  39. ramifice/fields/ip_field.py +4 -4
  40. ramifice/fields/password_field.py +7 -7
  41. ramifice/fields/phone_field.py +4 -4
  42. ramifice/fields/slug_field.py +4 -4
  43. ramifice/fields/text_field.py +5 -5
  44. ramifice/fields/url_field.py +4 -4
  45. ramifice/models/__init__.py +1 -1
  46. ramifice/models/decorator.py +3 -3
  47. ramifice/models/model.py +16 -16
  48. ramifice/paladins/__init__.py +2 -2
  49. ramifice/paladins/add_valid.py +3 -3
  50. ramifice/paladins/check.py +3 -3
  51. ramifice/paladins/delete.py +3 -3
  52. ramifice/paladins/groups/__init__.py +1 -1
  53. ramifice/paladins/groups/bool_group.py +3 -3
  54. ramifice/paladins/groups/choice_group.py +3 -3
  55. ramifice/paladins/groups/date_group.py +3 -3
  56. ramifice/paladins/groups/file_group.py +3 -3
  57. ramifice/paladins/groups/id_group.py +3 -3
  58. ramifice/paladins/groups/img_group.py +3 -3
  59. ramifice/paladins/groups/num_group.py +3 -3
  60. ramifice/paladins/groups/pass_group.py +3 -3
  61. ramifice/paladins/groups/slug_group.py +3 -3
  62. ramifice/paladins/groups/text_group.py +3 -3
  63. ramifice/paladins/hooks.py +8 -8
  64. ramifice/paladins/indexing.py +3 -3
  65. ramifice/paladins/password.py +4 -4
  66. ramifice/paladins/refrash.py +3 -3
  67. ramifice/paladins/save.py +3 -3
  68. ramifice/paladins/tools.py +6 -6
  69. ramifice/paladins/validation.py +4 -4
  70. ramifice/utils/__init__.py +13 -1
  71. ramifice/utils/constants.py +1 -1
  72. ramifice/utils/errors.py +23 -23
  73. ramifice/utils/fixtures.py +2 -2
  74. ramifice/utils/migration.py +8 -8
  75. ramifice/utils/{mixins/json_converter.py → mixins.py} +6 -6
  76. ramifice/utils/tools.py +12 -12
  77. ramifice/utils/translations.py +5 -5
  78. ramifice/utils/unit.py +10 -10
  79. {ramifice-0.8.21.dist-info → ramifice-0.8.25.dist-info}/METADATA +3 -2
  80. ramifice-0.8.25.dist-info/RECORD +83 -0
  81. ramifice/utils/mixins/__init__.py +0 -5
  82. ramifice-0.8.21.dist-info/RECORD +0 -84
  83. {ramifice-0.8.21.dist-info → ramifice-0.8.25.dist-info}/WHEEL +0 -0
  84. {ramifice-0.8.21.dist-info → ramifice-0.8.25.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking boolean fields.
1
+ """Group for checking boolean fields.
2
2
 
3
3
  Supported fields:
4
4
  BooleanField
@@ -12,14 +12,14 @@ from ramifice.paladins.tools import panic_type_error
12
12
 
13
13
 
14
14
  class BoolGroupMixin:
15
- """Ramifice - Group for checking boolean fields.
15
+ """Group for checking boolean fields.
16
16
 
17
17
  Supported fields:
18
18
  BooleanField
19
19
  """
20
20
 
21
21
  def bool_group(self, params: dict[str, Any]) -> None:
22
- """Ramifice - Checking boolean fields."""
22
+ """Checking boolean fields."""
23
23
  field = params["field_data"]
24
24
  # Get current value.
25
25
  value = field.value
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking choice fields.
1
+ """Group for checking choice fields.
2
2
 
3
3
  Supported fields:
4
4
  ChoiceTextMultField | ChoiceTextMultDynField | ChoiceTextField
@@ -16,7 +16,7 @@ from ramifice.utils import translations
16
16
 
17
17
 
18
18
  class ChoiceGroupMixin:
19
- """Ramifice - Group for checking choice fields.
19
+ """Group for checking choice fields.
20
20
 
21
21
  Supported fields:
22
22
  ChoiceTextMultField | ChoiceTextMultDynField | ChoiceTextField
@@ -26,7 +26,7 @@ class ChoiceGroupMixin:
26
26
  """
27
27
 
28
28
  def choice_group(self, params: dict[str, Any]) -> None:
29
- """Ramifice - Checking choice fields."""
29
+ """Checking choice fields."""
30
30
  field = params["field_data"]
31
31
  is_migrate = params["is_migration_process"]
32
32
  # Get current value.
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking date fields.
1
+ """Group for checking date fields.
2
2
 
3
3
  Supported fields:
4
4
  DateTimeField | DateField
@@ -19,14 +19,14 @@ from ramifice.utils import translations
19
19
 
20
20
 
21
21
  class DateGroupMixin:
22
- """Ramifice - Group for checking date fields.
22
+ """Group for checking date fields.
23
23
 
24
24
  Supported fields:
25
25
  DateTimeField | DateField
26
26
  """
27
27
 
28
28
  def date_group(self, params: dict[str, Any]) -> None:
29
- """Ramifice - Checking date fields."""
29
+ """Checking date fields."""
30
30
  field = params["field_data"]
31
31
  # Get current value.
32
32
  value = field.value or field.default or None
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking file fields.
1
+ """Group for checking file fields.
2
2
 
3
3
  Supported fields: FileField
4
4
  """
@@ -16,13 +16,13 @@ from ramifice.utils.tools import to_human_size
16
16
 
17
17
 
18
18
  class FileGroupMixin:
19
- """Ramifice - Group for checking file fields.
19
+ """Group for checking file fields.
20
20
 
21
21
  Supported fields: FileField
22
22
  """
23
23
 
24
24
  async def file_group(self, params: dict[str, Any]) -> None:
25
- """Ramifice - Checking file fields."""
25
+ """Checking file fields."""
26
26
  field = params["field_data"]
27
27
  value = field.value or None
28
28
 
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking id fields.
1
+ """Group for checking id fields.
2
2
 
3
3
  Supported fields:
4
4
  IDField
@@ -15,14 +15,14 @@ from ramifice.utils import translations
15
15
 
16
16
 
17
17
  class IDGroupMixin:
18
- """Ramifice - Group for checking id fields.
18
+ """Group for checking id fields.
19
19
 
20
20
  Supported fields:
21
21
  IDField
22
22
  """
23
23
 
24
24
  def id_group(self, params: dict[str, Any]) -> None:
25
- """Ramifice - Checking id fields."""
25
+ """Checking id fields."""
26
26
  field = params["field_data"]
27
27
  # Get current value.
28
28
  value = field.value
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking image fields.
1
+ """Group for checking image fields.
2
2
 
3
3
  Supported fields: ImageField
4
4
  """
@@ -16,13 +16,13 @@ from ramifice.utils.tools import to_human_size
16
16
 
17
17
 
18
18
  class ImgGroupMixin:
19
- """Ramifice - Group for checking image fields.
19
+ """Group for checking image fields.
20
20
 
21
21
  Supported fields: ImageField
22
22
  """
23
23
 
24
24
  async def img_group(self, params: dict[str, Any]) -> None:
25
- """Ramifice - Checking image fields."""
25
+ """Checking image fields."""
26
26
  field = params["field_data"]
27
27
  value = field.value or None
28
28
 
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking integer fields.
1
+ """Group for checking integer fields.
2
2
 
3
3
  Supported fields:
4
4
  IntegerField | FloatField
@@ -17,14 +17,14 @@ from ramifice.utils import translations
17
17
 
18
18
 
19
19
  class NumGroupMixin:
20
- """Ramifice - Group for checking integer fields.
20
+ """Group for checking integer fields.
21
21
 
22
22
  Supported fields:
23
23
  IntegerField | FloatField
24
24
  """
25
25
 
26
26
  async def num_group(self, params: dict[str, Any]) -> None:
27
- """Ramifice - Checking number fields."""
27
+ """Checking number fields."""
28
28
  field = params["field_data"]
29
29
  field_name = field.name
30
30
  # Get current value.
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking password fields.
1
+ """Group for checking password fields.
2
2
 
3
3
  Supported fields: PasswordField
4
4
  """
@@ -15,13 +15,13 @@ from ramifice.utils.tools import is_password
15
15
 
16
16
 
17
17
  class PassGroupMixin:
18
- """Ramifice - Group for checking password fields.
18
+ """Group for checking password fields.
19
19
 
20
20
  Supported fields: PasswordField
21
21
  """
22
22
 
23
23
  def pass_group(self, params: dict[str, Any]) -> None:
24
- """Ramifice - Checking password fields."""
24
+ """Checking password fields."""
25
25
  field = params["field_data"]
26
26
  # When updating the document, skip the verification.
27
27
  if params["is_update"]:
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking slug fields.
1
+ """Group for checking slug fields.
2
2
 
3
3
  Supported fields:
4
4
  SlugField
@@ -18,14 +18,14 @@ logger = logging.getLogger(__name__)
18
18
 
19
19
 
20
20
  class SlugGroupMixin:
21
- """Ramifice - Group for checking slug fields.
21
+ """Group for checking slug fields.
22
22
 
23
23
  Supported fields:
24
24
  SlugField
25
25
  """
26
26
 
27
27
  async def slug_group(self, params: dict[str, Any]) -> None:
28
- """Ramifice - Checking slug fields."""
28
+ """Checking slug fields."""
29
29
  if not params["is_save"]:
30
30
  return
31
31
  #
@@ -1,4 +1,4 @@
1
- """Ramifice - Group for checking text fields.
1
+ """Group for checking text fields.
2
2
 
3
3
  Supported fields:
4
4
  URLField | TextField | PhoneField
@@ -30,7 +30,7 @@ from ramifice.utils.tools import (
30
30
 
31
31
 
32
32
  class TextGroupMixin:
33
- """Ramifice - Group for checking text fields.
33
+ """Group for checking text fields.
34
34
 
35
35
  Supported fields:
36
36
  URLField | TextField | PhoneField
@@ -38,7 +38,7 @@ class TextGroupMixin:
38
38
  """
39
39
 
40
40
  async def text_group(self, params: dict[str, Any]) -> None:
41
- """Ramifice - Checking text fields."""
41
+ """Checking text fields."""
42
42
  field = params["field_data"]
43
43
  field_name = field.name
44
44
  field_type: str = field.field_type
@@ -1,4 +1,4 @@
1
- """Ramifice - HooksMixin - Contains abstract methods for creating hooks."""
1
+ """HooksMixin - Contains abstract methods for creating hooks."""
2
2
 
3
3
  __all__ = ("HooksMixin",)
4
4
 
@@ -6,22 +6,22 @@ from abc import ABCMeta
6
6
 
7
7
 
8
8
  class HooksMixin(metaclass=ABCMeta):
9
- """Ramifice - A set of abstract methods for creating hooks."""
9
+ """A set of abstract methods for creating hooks."""
10
10
 
11
11
  async def pre_create(self) -> None:
12
- """Ramifice - Called before a new document is created in the database."""
12
+ """Called before a new document is created in the database."""
13
13
 
14
14
  async def post_create(self) -> None:
15
- """Ramifice - Called after a new document has been created in the database."""
15
+ """Called after a new document has been created in the database."""
16
16
 
17
17
  async def pre_update(self) -> None:
18
- """Ramifice - Called before updating an existing document in the database."""
18
+ """Called before updating an existing document in the database."""
19
19
 
20
20
  async def post_update(self) -> None:
21
- """Ramifice - Called after an existing document in the database is updated."""
21
+ """Called after an existing document in the database is updated."""
22
22
 
23
23
  async def pre_delete(self) -> None:
24
- """Ramifice - Called before deleting an existing document in the database."""
24
+ """Called before deleting an existing document in the database."""
25
25
 
26
26
  async def post_delete(self) -> None:
27
- """Ramifice - Called after an existing document in the database has been deleted."""
27
+ """Called after an existing document in the database has been deleted."""
@@ -1,4 +1,4 @@
1
- """Ramifice - IndexMixin - Contains abstract method for indexing the model in the database."""
1
+ """IndexMixin - Contains abstract method for indexing the model in the database."""
2
2
 
3
3
  __all__ = ("IndexMixin",)
4
4
 
@@ -6,8 +6,8 @@ from abc import ABCMeta
6
6
 
7
7
 
8
8
  class IndexMixin(metaclass=ABCMeta):
9
- """Ramifice - Contains the method for indexing the model in the database."""
9
+ """Contains the method for indexing the model in the database."""
10
10
 
11
11
  @classmethod
12
12
  async def indexing(cls) -> None:
13
- """Ramifice - Set up and start indexing."""
13
+ """Set up and start indexing."""
@@ -1,4 +1,4 @@
1
- """Ramifice - Verification, replacement and recoverang of password."""
1
+ """Verification, replacement and recoverang of password."""
2
2
 
3
3
  __all__ = ("PasswordMixin",)
4
4
 
@@ -15,14 +15,14 @@ logger = logging.getLogger(__name__)
15
15
 
16
16
 
17
17
  class PasswordMixin:
18
- """Ramifice - Verification, replacement and recoverang of password."""
18
+ """Verification, replacement and recoverang of password."""
19
19
 
20
20
  async def verify_password(
21
21
  self,
22
22
  password: str,
23
23
  field_name: str = "password",
24
24
  ) -> bool:
25
- """Ramifice - For password verification."""
25
+ """For password verification."""
26
26
  cls_model = self.__class__
27
27
  # Get documet ID.
28
28
  doc_id = self._id.value
@@ -76,7 +76,7 @@ class PasswordMixin:
76
76
  new_password: str,
77
77
  field_name: str = "password",
78
78
  ) -> None:
79
- """Ramifice - For replace or recover password."""
79
+ """For replace or recover password."""
80
80
  cls_model = self.__class__
81
81
  if not await self.verify_password(old_password, field_name):
82
82
  logger.warning("Old password does not match!")
@@ -1,4 +1,4 @@
1
- """Ramifice - Update Model instance from database."""
1
+ """Update Model instance from database."""
2
2
 
3
3
  __all__ = ("RefrashMixin",)
4
4
 
@@ -15,10 +15,10 @@ logger = logging.getLogger(__name__)
15
15
 
16
16
 
17
17
  class RefrashMixin:
18
- """Ramifice - Update Model instance from database."""
18
+ """Update Model instance from database."""
19
19
 
20
20
  async def refrash_from_db(self) -> None:
21
- """Ramifice - Update Model instance from database."""
21
+ """Update Model instance from database."""
22
22
  cls_model = self.__class__
23
23
  # Get collection.
24
24
  collection: AsyncCollection = constants.MONGO_DATABASE[cls_model.META["collection_name"]]
ramifice/paladins/save.py CHANGED
@@ -1,4 +1,4 @@
1
- """Ramifice - Create or update document in database."""
1
+ """Create or update document in database."""
2
2
 
3
3
  __all__ = ("SaveMixin",)
4
4
 
@@ -16,10 +16,10 @@ logger = logging.getLogger(__name__)
16
16
 
17
17
 
18
18
  class SaveMixin:
19
- """Ramifice - Create or update document in database."""
19
+ """Create or update document in database."""
20
20
 
21
21
  async def save(self) -> bool:
22
- """Ramifice - Create or update document in database.
22
+ """Create or update document in database.
23
23
 
24
24
  This method pre-uses the `check` method.
25
25
  """
@@ -1,4 +1,4 @@
1
- """Ramifice - Tool of Paladins - A set of auxiliary methods."""
1
+ """Tool of Paladins - A set of auxiliary methods."""
2
2
 
3
3
  __all__ = (
4
4
  "ignored_fields_to_none",
@@ -17,14 +17,14 @@ logger = logging.getLogger(__name__)
17
17
 
18
18
 
19
19
  def ignored_fields_to_none(inst_model: Any) -> None:
20
- """Ramifice - Reset the values of ignored fields to None."""
20
+ """Reset the values of ignored fields to None."""
21
21
  for _, field_data in inst_model.__dict__.items():
22
22
  if not callable(field_data) and field_data.ignored:
23
23
  field_data.value = None
24
24
 
25
25
 
26
26
  def refresh_from_mongo_doc(inst_model: Any, mongo_doc: dict[str, Any]) -> None:
27
- """Ramifice - Update object instance from Mongo document."""
27
+ """Update object instance from Mongo document."""
28
28
  lang: str = translations.CURRENT_LOCALE
29
29
  model_dict = inst_model.__dict__
30
30
  for name, data in mongo_doc.items():
@@ -38,7 +38,7 @@ def refresh_from_mongo_doc(inst_model: Any, mongo_doc: dict[str, Any]) -> None:
38
38
 
39
39
 
40
40
  def panic_type_error(value_type: str, params: dict[str, Any]) -> None:
41
- """Ramifice - Unacceptable type of value."""
41
+ """Unacceptable type of value."""
42
42
  msg = (
43
43
  f"Model: `{params['full_model_name']}` > "
44
44
  + f"Field: `{params['field_data'].name}` > "
@@ -49,7 +49,7 @@ def panic_type_error(value_type: str, params: dict[str, Any]) -> None:
49
49
 
50
50
 
51
51
  def accumulate_error(err_msg: str, params: dict[str, Any]) -> None:
52
- """Ramifice - Accumulating errors to ModelName.field_name.errors ."""
52
+ """Accumulating errors to ModelName.field_name.errors ."""
53
53
  if not params["field_data"].hide:
54
54
  params["field_data"].errors.append(err_msg)
55
55
  if not params["is_error_symptom"]:
@@ -70,7 +70,7 @@ async def check_uniqueness(
70
70
  field_name: str | None = None,
71
71
  is_multi_language: bool = False,
72
72
  ) -> bool:
73
- """Ramifice - Checking the uniqueness of the value in the collection."""
73
+ """Checking the uniqueness of the value in the collection."""
74
74
  q_filter = None
75
75
  if is_multi_language:
76
76
  lang_filter = [{f"{field_name}.{lang}": value} for lang in translations.LANGUAGES]
@@ -1,4 +1,4 @@
1
- """Ramifice - Validation of Model and printing errors to console."""
1
+ """Validation of Model and printing errors to console."""
2
2
 
3
3
  __all__ = ("ValidationMixin",)
4
4
 
@@ -8,10 +8,10 @@ from termcolor import colored
8
8
 
9
9
 
10
10
  class ValidationMixin:
11
- """Ramifice - Validation of Model and printing errors to console."""
11
+ """Validation of Model and printing errors to console."""
12
12
 
13
13
  async def is_valid(self) -> bool:
14
- """Ramifice - Check data validity.
14
+ """Check data validity.
15
15
 
16
16
  The main use is to check data from web forms.
17
17
  It is also used to verify Models that do not migrate to the database.
@@ -20,7 +20,7 @@ class ValidationMixin:
20
20
  return result_check["is_valid"]
21
21
 
22
22
  def print_err(self) -> None:
23
- """Ramifice - Printing errors to console.
23
+ """Printing errors to console.
24
24
 
25
25
  Convenient to use during development.
26
26
  """
@@ -1 +1,13 @@
1
- """Ramifice - A set of Ramifice useful utilities."""
1
+ """A set of Ramifice useful utilities.
2
+
3
+ This module includes:
4
+
5
+ - `constants` - Global variables.
6
+ - `errors` - Custom Exceptions for Ramifice.
7
+ - `fixtures` - To populate the database with pre-created data.
8
+ - `migration` - Migration of models to database.
9
+ - `mixins` - Set of mixins for Models and Fields.
10
+ - `tools` - Global collection of auxiliary methods.
11
+ - `translations` - Localization of translations.
12
+ - `unit` - Data management in dynamic fields.
13
+ """
@@ -1,4 +1,4 @@
1
- """Ramifice - Global variables.
1
+ """Global variables.
2
2
 
3
3
  List of variables:
4
4
 
ramifice/utils/errors.py CHANGED
@@ -1,18 +1,18 @@
1
- """Ramifice - Custom Exceptions for Ramifice."""
1
+ """Custom Exceptions for Ramifice."""
2
2
 
3
3
 
4
4
  class RamificeException(Exception):
5
- """Ramifice - Root Exception for Ramifice."""
5
+ """Root Exception for Ramifice."""
6
6
 
7
- def __init__(self, *args, **kwargs) -> None: # type: ignore[no-untyped-def]# noqa: D107
7
+ def __init__(self, *args, **kwargs) -> None: # type: ignore[no-untyped-def] # noqa: D107
8
8
  super().__init__(*args, **kwargs)
9
9
 
10
10
 
11
11
  class FileHasNoExtensionError(RamificeException):
12
- """Ramifice - Exception raised if the file has no extension.
12
+ """Exception raised if the file has no extension.
13
13
 
14
- Attributes:
15
- message -- explanation of the error
14
+ Args:
15
+ message: explanation of the error
16
16
  """
17
17
 
18
18
  def __init__(self, message: str = "File has no extension!") -> None: # noqa: D107
@@ -21,10 +21,10 @@ class FileHasNoExtensionError(RamificeException):
21
21
 
22
22
 
23
23
  class DoesNotMatchRegexError(RamificeException):
24
- """Ramifice - Exception raised if does not match the regular expression.
24
+ """Exception raised if does not match the regular expression.
25
25
 
26
- Attributes:
27
- regex_str -- regular expression in string representation
26
+ Args:
27
+ regex_str: regular expression in string representation
28
28
  """
29
29
 
30
30
  def __init__(self, regex_str: str) -> None: # noqa: D107
@@ -33,7 +33,7 @@ class DoesNotMatchRegexError(RamificeException):
33
33
 
34
34
 
35
35
  class NoModelsForMigrationError(RamificeException):
36
- """Ramifice - Exception raised if no Models for migration."""
36
+ """Exception raised if no Models for migration."""
37
37
 
38
38
  def __init__(self) -> None: # noqa: D107
39
39
  self.message = "No Models for Migration!"
@@ -41,10 +41,10 @@ class NoModelsForMigrationError(RamificeException):
41
41
 
42
42
 
43
43
  class PanicError(RamificeException):
44
- """Ramifice - Exception raised for cases of which should not be.
44
+ """Exception raised for cases of which should not be.
45
45
 
46
- Attributes:
47
- message -- explanation of the error
46
+ Args:
47
+ message: explanation of the error
48
48
  """
49
49
 
50
50
  def __init__(self, message: str) -> None: # noqa: D107
@@ -53,7 +53,7 @@ class PanicError(RamificeException):
53
53
 
54
54
 
55
55
  class OldPassNotMatchError(RamificeException):
56
- """Ramifice - Exception is raised when trying to update the password.
56
+ """Exception is raised when trying to update the password.
57
57
 
58
58
  Hint: If old password does not match.
59
59
  """
@@ -64,10 +64,10 @@ class OldPassNotMatchError(RamificeException):
64
64
 
65
65
 
66
66
  class ForbiddenDeleteDocError(RamificeException):
67
- """Ramifice - Exception is raised when trying to delete the document.
67
+ """Exception is raised when trying to delete the document.
68
68
 
69
- Attributes:
70
- message -- explanation of the error
69
+ Args:
70
+ message: explanation of the error
71
71
  """
72
72
 
73
73
  def __init__(self, message: str) -> None: # noqa: D107
@@ -76,10 +76,10 @@ class ForbiddenDeleteDocError(RamificeException):
76
76
 
77
77
 
78
78
  class NotPossibleAddUnitError(RamificeException):
79
- """Ramifice - Exception is raised when not possible to add Unit.
79
+ """Exception is raised when not possible to add Unit.
80
80
 
81
- Attributes:
82
- message -- explanation of the error
81
+ Args:
82
+ message: explanation of the error
83
83
  """
84
84
 
85
85
  def __init__(self, message: str) -> None: # noqa: D107
@@ -88,10 +88,10 @@ class NotPossibleAddUnitError(RamificeException):
88
88
 
89
89
 
90
90
  class NotPossibleDeleteUnitError(RamificeException):
91
- """Ramifice - Exception is raised when not possible to delete Unit.
91
+ """Exception is raised when not possible to delete Unit.
92
92
 
93
- Attributes:
94
- message -- explanation of the error
93
+ Args:
94
+ message: explanation of the error
95
95
  """
96
96
 
97
97
  def __init__(self, message: str) -> None: # noqa: D107
@@ -1,4 +1,4 @@
1
- """Ramifice - Fixtures - To populate the database with pre-created data.
1
+ """Fixtures - To populate the database with pre-created data.
2
2
 
3
3
  Runs automatically during Model migration.
4
4
  """
@@ -24,7 +24,7 @@ async def apply_fixture(
24
24
  cls_model: Any,
25
25
  collection: AsyncCollection,
26
26
  ) -> None:
27
- """Ramifice - Apply fixture for current Model.
27
+ """Apply fixture for current Model.
28
28
 
29
29
  Runs automatically during Model migration.
30
30
  """
@@ -1,4 +1,4 @@
1
- """Ramifice - Migration are `Ramifice` way of
1
+ """Migration are `Ramifice` way of
2
2
  propagating changes you make to
3
3
  your models (add or delete a Model, add or delete a field in Model, etc.) into
4
4
  your database schema.
@@ -23,9 +23,9 @@ logger = logging.getLogger(__name__)
23
23
 
24
24
 
25
25
  class Migration:
26
- """Ramifice - Migration of models to database."""
26
+ """Migration of models to database."""
27
27
 
28
- def __init__(self, database_name: str, mongo_client: AsyncMongoClient): # noqa: D107
28
+ def __init__(self, database_name: str, mongo_client: AsyncMongoClient) -> None: # noqa: D107
29
29
  constants.DEBUG = False
30
30
  #
31
31
  db_name_regex = constants.REGEX["database_name"]
@@ -46,7 +46,7 @@ class Migration:
46
46
  raise NoModelsForMigrationError()
47
47
 
48
48
  async def reset(self) -> None:
49
- """Ramifice - Reset the condition of the models in a super collection.
49
+ """Reset the condition of the models in a super collection.
50
50
 
51
51
  Switch the `is_model_exist` parameter in the condition `False`.
52
52
  """
@@ -62,7 +62,7 @@ class Migration:
62
62
  await super_collection.update_one(q_filter, update)
63
63
 
64
64
  async def model_state(self, metadata: dict[str, Any]) -> dict[str, Any]:
65
- """Ramifice - Get the state of the current model from a super collection."""
65
+ """Get the state of the current model from a super collection."""
66
66
  # Get access to super collection.
67
67
  # (Contains Model state and dynamic field data.)
68
68
  super_collection: AsyncCollection = constants.MONGO_DATABASE[
@@ -86,7 +86,7 @@ class Migration:
86
86
  return model_state
87
87
 
88
88
  def new_fields(self, metadata: dict[str, Any], model_state: dict[str, Any]) -> list[str]:
89
- """Ramifice - Get a list of new fields that were added to Model."""
89
+ """Get a list of new fields that were added to Model."""
90
90
  new_fields: list[str] = []
91
91
  for field_name, field_type in metadata["field_name_and_type"].items():
92
92
  old_field_type: str | None = model_state["field_name_and_type"].get(field_name)
@@ -95,7 +95,7 @@ class Migration:
95
95
  return new_fields
96
96
 
97
97
  async def napalm(self) -> None:
98
- """Ramifice - Delete data for non-existent Models from a super collection,
98
+ """Delete data for non-existent Models from a super collection,
99
99
  delete collections associated with those Models.
100
100
  """ # noqa: D205
101
101
  # Get access to database.
@@ -116,7 +116,7 @@ class Migration:
116
116
  await database.drop_collection(collection_name) # type: ignore[union-attr]
117
117
 
118
118
  async def migrate(self) -> None:
119
- """Ramifice - Run migration process.
119
+ """Run migration process.
120
120
 
121
121
  1) Update the state of Models in the super collection.
122
122
  2) Register new Models in the super collection.