Skip to content

Commit

Permalink
hhvm module: Improved implementation for vm_tc_space data parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jj-wolf committed Feb 13, 2015
1 parent 3d53974 commit 005cb68
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions hhvm/python_modules/hhvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def __init__(self):
def get(self, name):
try:
logging.debug('TCSpaceData get method called')
self.data = tab_to_dict(fetch_url(self.url))
self.data = parse_vm_tcspace(fetch_url(self.url))
return int(self.data[name_map[name]])
except Exception as e:
logging.error('TCSpaceData get method failed, '
Expand All @@ -239,15 +239,11 @@ def flatten(structure, key="", path="", flattened=None):
return flattened


def tab_to_dict(tsvdata, result=None):
def parse_vm_tcspace(tsv_data, result=None):
if result is None:
result = {}
for line in tsvdata:
splitted = line.rstrip().split()
f1 = splitted[1]
f5 = splitted[5]
result[''+str(f5)] = int(f1)

result = dict((line.rstrip().split()[5], line.rstrip().split()[1])
for line in tsv_data)
return result


Expand Down

0 comments on commit 005cb68

Please sign in to comment.