Skip to content

Commit 4d03eb7

Browse files
committed
remove python2 methods (basestring, xrange)
1 parent 05b1f05 commit 4d03eb7

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

source/queryHandler/Query.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@
2020
@author: NSCHULD
2121
'''
2222
#
23-
import sys
2423

2524

2625
def isString(val):
27-
if sys.version < '3':
28-
return isinstance(val, basestring)
29-
else:
30-
return isinstance(val, str)
26+
return isinstance(val, str)
3127

3228

3329
class Query(object):

source/queryHandler/QueryHandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
import SysmonLogger
3636
except Exception:
3737
pass
38-
if sys.version < '3':
39-
range = xrange
4038

4139

4240
EMPTY = json.loads('{"header" : {"bcount" : 0, "bsize" : 0, "t_start" : 0, "t_end" : 0 }, "legend" : [], "rows" : [], "rangeData": [] }')
@@ -148,6 +146,7 @@ def start_str(self):
148146
def end_str(self):
149147
return time.strftime("%Y-%m-%d_%H:%M:%S", time.localtime(self.end))
150148

149+
151150
DEFAULT_DOMAIN = Domain(99, 0, 6666666666, 666)
152151

153152

@@ -331,7 +330,7 @@ def dAVG(self, valList):
331330
l = len(valList)
332331
if l == 0:
333332
return None
334-
return int(round(s/l))
333+
return int(round(s / l))
335334

336335
def __colstat(self, column, fn, reverse=False):
337336
if isinstance(column, ColumnInfo):

source/zimonGrafanaIntf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ def _getTimeMultiplier(self, timeunit):
279279
'd': 86400,
280280
'w': 604800,
281281
'n': 2628000,
282-
'y': 31536000,
283-
}.get(timeunit, -1)
282+
'y': 31536000, }.get(timeunit, -1)
284283

285284
def _retrieveData(self, query, dsOp=None, dsInterval=None):
286285
'''Executes zimon query and returns results'''
@@ -409,7 +408,7 @@ def _calc_bucketSize(self, downsample):
409408
bstr = downsample
410409

411410
if '-' in bstr:
412-
x = re.split('(\d+)', bstr[:bstr.find('-')])
411+
x = re.split(r'(\d+)', bstr[:bstr.find('-')])
413412
if len(x) == 3: # if not 3, then split failed
414413
if x[1]: # there is a time value
415414
if x[1].isdigit():

0 commit comments

Comments
 (0)