Align with original methods
Rewrote the results method a bit so it returned something similar to the original result, which will make the transition easier.
This commit is contained in:
parent
48ff24daa9
commit
9331558340
|
@ -71,14 +71,6 @@ class Result(object):
|
||||||
template = 'Error {code}: {msg}'
|
template = 'Error {code}: {msg}'
|
||||||
raise Exception(template.format(code=code, msg=msg))
|
raise Exception(template.format(code=code, msg=msg))
|
||||||
|
|
||||||
def _flatten(self, lists):
|
|
||||||
'''
|
|
||||||
src: http://stackoverflow.com/a/952952/4241708
|
|
||||||
usr: intuited
|
|
||||||
'''
|
|
||||||
from itertools import chain
|
|
||||||
return list(chain.from_iterable(lists))
|
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self.info)
|
return iter(self.info)
|
||||||
|
|
||||||
|
@ -88,7 +80,7 @@ class Result(object):
|
||||||
@property
|
@property
|
||||||
def results(self):
|
def results(self):
|
||||||
''' Get the response to a simple, discrete query. '''
|
''' Get the response to a simple, discrete query. '''
|
||||||
return self._flatten([pod.details for pod in self.pods if pod.primary or pod.title=='Result'])
|
return [pod for pod in self.pods if pod.primary or pod.title=='Result']
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def details(self):
|
def details(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user