Passed
Pull Request — dev (#1193)
by Patrik
06:44
created

solph._facades   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 15
dl 0
loc 37
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A Facade.__init__() 0 4 1
A Facade.define_subnetwork() 0 2 1
A Facade.add_subnetwork() 0 3 1
A Facade.sub_label_error() 0 7 1
1
# -*- coding: utf-8 -*-
2
3
"""
4
Solph Facade based on oemof.network.SubNetwork
5
6
SPDX-FileCopyrightText: Uwe Krien <[email protected]>
7
SPDX-FileCopyrightText: Pierre-François Duc
8
9
SPDX-License-Identifier: MIT
10
11
"""
12
13
from oemof.network import SubNetwork
14
15
16
class Facade(SubNetwork):
17
    # attributes
18
    def __init__(self, label, facade_type, *args, **kwargs):
19
        super().__init__(label=label)
20
        self.facade_type = facade_type
21
        self.define_subnetwork()
22
23
    def define_subnetwork(self):
24
        pass
25
26
    def add_subnetwork(self):
27
        """Instanciate and add Node instance to the sub network"""
28
        pass
29
30
    def sub_label_error(self, sub_component):
31
        msg = (
32
            f"Sublabel ERROR in Facade instance:\n{self.label}, "
33
            f"{self.facade_type}, {sub_component}, "
34
            f"{sub_component.custom_properties}"
35
        )
36
        raise AttributeError(msg)
37