octoprint_auth_ldap.tweaks   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 8

7 Methods

Rating   Name   Duplication   Size   Complexity  
A SettingsPlugin.logger() 0 7 2
A SettingsPlugin.settings() 0 3 1
A DependentOnSettingsPlugin.logger() 0 3 1
A DependentOnSettingsPlugin.settings() 0 3 1
A DependentOnSettingsPlugin.plugin() 0 3 1
A DependentOnSettingsPlugin.__init__() 0 2 1
A SettingsPlugin.identifier() 0 3 1
1
# coding=utf-8
2
from __future__ import absolute_import
3
4
import logging
5
6
from octoprint.plugin import SettingsPlugin as OctoPrintSettingPlugin
7
8
9
class SettingsPlugin(OctoPrintSettingPlugin):
10
    @property
11
    def settings(self):
12
        return self._settings
13
14
    @property
15
    def identifier(self):
16
        return self._identifier
17
18
    @property
19
    def logger(self):
20
        if "_logger" in self.__dict__:
21
            return self._logger
22
        else:
23
            # FIXME vexingly, sometimes we want to log things before the logger is injected
24
            return logging.getLogger("octoprint.plugins.auth_ldap")
25
26
27
class DependentOnSettingsPlugin:
28
    def __init__(self, plugin):
29
        self._plugin = plugin
30
31
    @property
32
    def plugin(self):
33
        return self._plugin
34
35
    @property
36
    def logger(self):
37
        return self._plugin.logger
38
39
    @property
40
    def settings(self):
41
        return self._plugin.settings
42