forked from carbonblack/cbapi-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
30 lines (21 loc) · 667 Bytes
/
utils.py
File metadata and controls
30 lines (21 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from __future__ import absolute_import
from cbapi.six import iteritems
import sys
def convert_query_params(qd):
o = []
for k, v in iteritems(qd):
if type(v) == list:
for item in v:
o.append((k, item))
else:
o.append((k, v))
return o
def calculate_elapsed_time_new(td):
return td.total_seconds()
def calculate_elapsed_time_old(td):
return float((td.microseconds +
(td.seconds + td.days * 24 * 3600) * 10**6)) / 10**6
if sys.version_info < (2, 7):
calculate_elapsed_time = calculate_elapsed_time_old
else:
calculate_elapsed_time = calculate_elapsed_time_new