Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement initial Python3 support #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libmetric/alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def _aggregate_series(self):
return float(self.data_frame[self.series].item())

def evaluate(self):
print "Question: {} {} {}?".format(self.alarm_threshold,
print("Question: {} {} {}?".format(self.alarm_threshold,
self.alarm_operator,
self.value)
self.value))
response = False
if self.alarm_operator == 'gt':
if self.alarm_threshold > self.value:
Expand Down
10 changes: 5 additions & 5 deletions libmetric/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _range_metric(engine, url, user, password, partition, query,
else:
raise Exception("Unsupported engine {}.".format(engine))

print query.get()
print(query.get())


def range_metric():
Expand Down Expand Up @@ -121,7 +121,7 @@ def _range_alarm(engine, url, user, password, partition, query, start, end,
'data_frame': data_frame
}
result = RangeAlarm(**alarm).evaluate()
print "Response: {}".format(result)
print("Response: {}".format(result))


def range_alarm():
Expand Down Expand Up @@ -164,7 +164,7 @@ def _instant_metric(engine, url, user, password, partition, query, moment):
else:
raise Exception("Unsupported engine {}.".format(engine))

print query.get()
print(query.get())


def instant_metric():
Expand Down Expand Up @@ -222,7 +222,7 @@ def _instant_alarm(engine, url, user, password, partition, query, moment,
'data_frame': data_frame
}
result = InstantAlarm(**alarm).evaluate()
print "Response: {}".format(result)
print("Response: {}".format(result))


def instant_alarm():
Expand Down Expand Up @@ -269,7 +269,7 @@ def _search_metrics(engine, url, user, password, partition, search,
else:
raise Exception("Unsupported engine {}".format(engine))

print search.get()
print(search.get())


def search_metrics():
Expand Down
6 changes: 3 additions & 3 deletions libmetric/query_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ def get(self):
start, end, step = result[0]
ds = result[1]
rows = result[2]
print start, end, step
print ds
print rows
print(start, end, step)
print(ds)
print(rows)
# return self._process(data)

def _url(self):
Expand Down
4 changes: 2 additions & 2 deletions libmetric/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _url(self):
return self.base_url + url

def _process(self, response):
print response
print(response)


class RrdSearch(Search):
Expand All @@ -75,7 +75,7 @@ def _url(self):
def get(self):
data_sources = set()
info = rrdtool.info(self._url())
for datum, real_value in info.items():
for datum, real_value in list(info.items()):
if datum.startswith('ds'):
value = datum.replace('ds[', '').split('].')
# if value[0] not in data_source:
Expand Down