Passed
Pull Request — 2.x (#1778)
by Ramon
05:34
created

senaite.core.interfaces.datamanager   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 12
dl 0
loc 42
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A NO_VALUE.__repr__() 0 2 1
A IDataManager.query() 0 2 1
A IDataManager.can_write() 0 2 1
A IDataManager.get() 0 2 1
A IDataManager.set() 0 2 1
A IDataManager.can_read() 0 2 1
1
# -*- coding: utf-8 -*-
2
3
from zope import interface
4
5
6
class NO_VALUE(object):
7
    def __repr__(self):
8
        return "<NO_VALUE>"
9
10
11
NO_VALUE = NO_VALUE()
12
13
14
class IDataManager(interface.Interface):
15
    """Data manager."""
16
17
    def get(name):
18
        """Get the value.
19
20
        If no value can be found, raise an error
21
        """
22
23
    def query(name, default=NO_VALUE):
24
        """Query the name for its value
25
26
        If no value can be found, return the default value.
27
        If read is forbidden, raise an error.
28
        """
29
30
    def set(name, value):
31
        """Set the value by name
32
33
        Returns a list of updated objects
34
        """
35
36
    def can_read():
37
        """Checks if the object is readable
38
        """
39
40
    def can_write():
41
        """Checks if the object is writable
42
        """
43