Skip to content

Commit

Permalink
Merge pull request #20 from DavidNemeskey/master
Browse files Browse the repository at this point in the history
Fixed GetStatistics() again -- let's hope that this time, it's for good.
  • Loading branch information
hendrikmuhs committed Sep 21, 2015
2 parents 59cee97 + 59056e5 commit 46470fe
Show file tree
Hide file tree
Showing 3 changed files with 842 additions and 830 deletions.
9 changes: 5 additions & 4 deletions pykeyvi/src/addons/Dictionary.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@

def GetManifest(self):
cdef libcpp_string _r = self.inst.get().GetManifestAsString()
py_result = <libcpp_string>_r
cdef bytes py_result = _r
import json
return json.loads(py_result)

def GetStatistics(self):
cdef libcpp_string _r = self.inst.get().GetStatistics()
py_result = <libcpp_string>_r
cdef bytes py_result = _r
import json
return {k: json.loads(v) for k, v in filter(
lambda kv: kv[1], [s.rstrip().split("\n")
for s in py_result.split("\n\n")])}
lambda kv: kv and isinstance(kv, list) and len(kv) > 1 and kv[1],
[s.rstrip().split("\n") for s in py_result.split("\n\n")]
)}
Loading

0 comments on commit 46470fe

Please sign in to comment.