memegen.services._base   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Exceptions.__init__() 0 6 1
A Service.__init__() 0 2 1
1
from abc import ABCMeta
2
3
4
class Exceptions:
5
6
    def __init__(self, *exceptions):
7
        kwargs = {e.__name__: e for e in exceptions}
8
        self.TemplateNotFound = kwargs.get('TemplateNotFound', KeyError)
9
        self.InvalidMaskedCode = kwargs.get('InvalidMaskedCode', ValueError)
10
        self.FilenameTooLong = kwargs.get('FilenameTooLong', ValueError)
11
        self.InvalidImageLink = kwargs.get('InvalidImageLink', ValueError)
12
13
14
class Service(metaclass=ABCMeta):
15
    """Base class for domain services."""
16
17
    def __init__(self, exceptions=None):
18
        self.exceptions = exceptions or Exceptions()
19