Skip to content

Commit 17b6907

Browse files
authored
Update __init__.py
* fix some style issues * add missing docstrings * remove commented code
1 parent 5e4581f commit 17b6907

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

p3exporter/collector/__init__.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ def __init__(self, **kwargs):
2020
self.exporter_name = kwargs.pop('exporter_name', None)
2121
self.collectors = kwargs.pop('collectors', [])
2222
self.collector_opts = kwargs.pop('collector_opts', {})
23-
self.credentials = kwargs.pop('credentials', None)
24-
25-
# do some fancy checks on configuration parameters
26-
if self.credentials is None:
27-
self.credentials = {}
28-
elif self.credentials is not None and (
29-
self.credentials['ssh_key'] is None or (
30-
self.credentials['username'] is None or self.credentials['password'] is None)):
31-
raise Exception('Credential is not fully configured.')
3223

3324

3425
class CollectorBase(object):
@@ -38,10 +29,10 @@ class CollectorBase(object):
3829
"""
3930

4031
def __init__(self, config: CollectorConfig):
32+
"""Instantiates an CollectorBase object"""
4133
self.collector_name = self.collector_name_from_class
4234
self.opts = config.collector_opts.pop(self.collector_name, {})
4335

44-
4536
@property
4637
def collector_name_from_class(self):
4738
"""Convert class name to controller name.
@@ -53,7 +44,6 @@ def collector_name_from_class(self):
5344
5445
This will convert MyCollector class name to my collector name.
5546
"""
56-
5747
return re.sub(r'([A-Z][a-z]+)', r'_\g<0>', self.__class__.__name__).lower().strip('_').split('_')[0]
5848

5949

@@ -68,6 +58,7 @@ class Collector(object):
6858
"""
6959

7060
def __init__(self, config: CollectorConfig):
61+
"""Instantiates an CollectorBase object"""
7162
for c in config.collectors:
7263
try:
7364
collector_module = import_module("p3exporter.collector.{}".format(c), package=None)

0 commit comments

Comments
 (0)