Completed
Push — develop ( 0a86d2...dd3b25 )
by Jace
02:48
created

ModelMixin   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 82.35%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 7
c 1
b 0
f 1
dl 0
loc 29
ccs 14
cts 17
cp 0.8235
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 2 1
A find() 0 3 1
A create() 0 3 1
A load() 0 2 1
A new() 0 5 1
A save() 0 2 1
A match() 0 3 1
1 1
import warnings
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
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):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
11 1
        return utilities.create(cls, *args, **kwargs)
12
13 1
    @classmethod
14
    def new(cls, *args, **kwargs):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
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):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
21 1
        return utilities.find(cls, *args, **kwargs)
22
23 1
    @classmethod
24
    def match(cls, *args, **kwargs):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
25 1
        return utilities.match(cls, *args, **kwargs)
26
27 1
    def load(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
28 1
        return utilities.load(self)
29
30 1
    def save(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
31 1
        return utilities.save(self)
32
33 1
    def delete(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
34
        return utilities.delete(self)
35