@cryptotaxi247 / netdata-1 / commits / 0c0534b92

SimpleService cleanup: do not inherit from OldVersionCompatibility (#5594)

<!-- Describe the change in summary section, including rationale and degin decisions. Include "Fixes #nnn" if you are fixing an existing issue. In "Component Name" section write which component is changed in this PR. This will help us review your PR quicker. If you have more information you want to add, write them in "Additional Information" section. This is usually used to help others understand your motivation behind this change. A step-by-step reproduction of the problem is helpful if there is no related issue. --> ##### Summary python SimpleService cleanup 1 - remove OldVersionCompatibility ##### Component Name [`collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService`](collectors/python.d.plugin/python_modules/bases/FrameworkServices) ##### Additional Information it is dead code, no longer supported

Ilya Mashchenko committed Mar 10, 2019 at 22:20 UTC 0c0534b92e9a57167b6b32f14d4929c5632bff06
2 files changed +2 -64
collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
+2 -3
@@ -10,7 +10,7 @@ from time import sleep, time
10 from third_party.monotonic import monotonic
11
12 from bases.charts import Charts, ChartError, create_runtime_chart
13 -from bases.collection import OldVersionCompatibility, safe_print
13 +from bases.collection import safe_print
14 from bases.loggers import PythonDLimitedLogger
15
16 RUNTIME_CHART_UPDATE = 'BEGIN netdata.runtime_{job_name} {since_last}\n' \
@@ -55,7 +55,7 @@ class RuntimeCounters:
55 self.penalty = round(min(self.retries * self.update_every / 2, MAX_PENALTY))
56
57
58 -class SimpleService(PythonDLimitedLogger, OldVersionCompatibility, object):
58 +class SimpleService(PythonDLimitedLogger, object):
59 """
60 Prototype of Service class.
61 Implemented basic functionality to run jobs by `python.d.plugin`
@@ -66,7 +66,6 @@ class SimpleService(PythonDLimitedLogger, OldVersionCompatibility, object):
66 :param name: <str>
67 """
68 PythonDLimitedLogger.__init__(self)
69 - OldVersionCompatibility.__init__(self)
69 self.configuration = configuration
70 self.order = list()
71 self.definitions = dict()
collectors/python.d.plugin/python_modules/bases/collection.py
-61
@@ -82,64 +82,3 @@ def read_last_line(f):
82 break
83 result = opened.readline()
84 return result.decode()
85 -
86 -
87 -class OldVersionCompatibility:
88 -
89 - def __init__(self):
90 - self._data_stream = str()
91 -
92 - def begin(self, type_id, microseconds=0):
93 - """
94 - :param type_id: <str>
95 - :param microseconds: <str> or <int>: must be a digit
96 - :return:
97 - """
98 - self._data_stream += CHART_BEGIN.format(type_id, microseconds)
99 -
100 - def set(self, dim_id, value):
101 - """
102 - :param dim_id: <str>
103 - :param value: <int> or <str>: must be a digit
104 - :return:
105 - """
106 - self._data_stream += DIMENSION_SET.format(dim_id, value)
107 -
108 - def end(self):
109 - self._data_stream += 'END\n'
110 -
111 - def chart(self, type_id, name='', title='', units='', family='', category='', chart_type='line',
112 - priority='', update_every=''):
113 - """
114 - :param type_id: <str>
115 - :param name: <str>
116 - :param title: <str>
117 - :param units: <str>
118 - :param family: <str>
119 - :param category: <str>
120 - :param chart_type: <str>
121 - :param priority: <str> or <int>
122 - :param update_every: <str> or <int>
123 - :return:
124 - """
125 - self._data_stream += CHART_CREATE.format(type_id, name, title, units,
126 - family, category, chart_type,
127 - priority, update_every)
128 -
129 - def dimension(self, dim_id, name=None, algorithm="absolute", multiplier=1, divisor=1, hidden=False):
130 - """
131 - :param dim_id: <str>
132 - :param name: <str> or None
133 - :param algorithm: <str>
134 - :param multiplier: <str> or <int>: must be a digit
135 - :param divisor: <str> or <int>: must be a digit
136 - :param hidden: <str>: literally "hidden" or ""
137 - :return:
138 - """
139 - self._data_stream += DIMENSION_CREATE.format(dim_id, name or dim_id, algorithm,
140 - multiplier, divisor, hidden or str())
141 -
142 - @on_try_except_finally(on_except=(exit, 1))
143 - def commit(self):
144 - print(self._data_stream)
145 - self._data_stream = str()