Skip to content

Commit 9352431

Browse files
committed
fix: support for PY3
1 parent bedaf6a commit 9352431

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

mamonsu/plugins/system/windows/helpers.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ def get(cls, counters, fmts=None, english=True, delay=0):
143143

144144
errs = pdh.PdhOpenQueryW(None, 0, byref(hQuery))
145145
if errs:
146-
raise(
147-
BaseException,
148-
'PdhOpenQueryW error: {0}'.format(errs))
146+
raise BaseException
149147

150148
for counter in counters:
151149
hCounter = HCOUNTER()
@@ -156,39 +154,29 @@ def get(cls, counters, fmts=None, english=True, delay=0):
156154
errs = pdh.PdhAddCounterW(
157155
hQuery, counter, 0, byref(hCounter))
158156
if errs:
159-
raise(
160-
BaseException,
161-
'PdhAddCounterW error: {0}'.format(errs))
157+
raise BaseException
162158
hCounters.append(hCounter)
163159

164160
errs = pdh.PdhCollectQueryData(hQuery)
165161
if errs:
166-
raise(
167-
BaseException,
168-
'PdhCollectQueryData error: {0}'.format(errs))
162+
raise BaseException
169163
if delay:
170164
kernel32.Sleep(delay)
171165
errs = pdh.PdhCollectQueryData(hQuery)
172166
if errs:
173-
raise(
174-
BaseException,
175-
'PdhCollectQueryData error: {0}'.format(errs))
167+
raise BaseException
176168

177169
for i, hCounter in enumerate(hCounters):
178170
value = PDHFmtCounterValue()
179171
errs = pdh.PdhGetFormattedCounterValue(
180172
hCounter, ifmts[i], None, byref(value))
181173
if errs:
182-
raise(
183-
BaseException,
184-
'PdhGetFormattedCounterValue error: {0}'.format(errs))
174+
raise BaseException
185175
values.append(value)
186176

187177
errs = pdh.PdhCloseQuery(hQuery)
188178
if errs:
189-
raise(
190-
BaseException,
191-
'PdhCloseQuery failed, error: {0}'.format(errs))
179+
raise BaseException
192180

193181
return tuple([getattr(value.union, fmts[i] + 'Value')
194182
for i, value in enumerate(values)])

mamonsu/tools/agent/start.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import print_function
23
import sys
34
import optparse
45

mamonsu/tools/report/start.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3+
from __future__ import print_function
34
import sys
45
import logging
56
import optparse

mamonsu/tools/zabbix_cli/operations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3+
from __future__ import print_function
34
import sys
45
import json
56
from mamonsu.tools.zabbix_cli.request import Request

0 commit comments

Comments
 (0)