1 | 1 | import warnings |
|
2 | |||
3 | 1 | from yorm import utilities |
|
4 | |||
5 | |||
6 | 1 | class ModelMixin: |
|
7 | """Adds ORM methods to a mapped class.""" |
||
8 | |||
9 | 1 | @classmethod |
|
10 | def create(cls, *args, **kwargs): |
||
11 | 1 | return utilities.create(cls, *args, **kwargs) |
|
12 | |||
13 | 1 | @classmethod |
|
14 | def new(cls, *args, **kwargs): |
||
0 ignored issues
–
show
|
|||
15 | msg = "ModelMixin.new() has been renamed to ModelMixin.create()" |
||
16 | warnings.warn(msg, DeprecationWarning) |
||
17 | return utilities.create(cls, *args, **kwargs) |
||
18 | |||
19 | 1 | @classmethod |
|
20 | def find(cls, *args, **kwargs): |
||
21 | 1 | return utilities.find(cls, *args, **kwargs) |
|
22 | |||
23 | 1 | @classmethod |
|
24 | def match(cls, *args, **kwargs): |
||
25 | 1 | return utilities.match(cls, *args, **kwargs) |
|
26 | |||
27 | 1 | def load(self): |
|
28 | 1 | return utilities.load(self) |
|
29 | |||
30 | 1 | def save(self): |
|
31 | 1 | return utilities.save(self) |
|
32 | |||
33 | 1 | def delete(self): |
|
34 | return utilities.delete(self) |
||
35 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.