Normalize docstrings per PEP 257.
This commit is contained in:
parent
bee228a1d5
commit
760a6a6a92
|
@ -55,9 +55,9 @@ class Client(object):
|
||||||
|
|
||||||
|
|
||||||
class Result(object):
|
class Result(object):
|
||||||
'''
|
"""
|
||||||
Handles processing the response for the programmer.
|
Handles processing the response for the programmer.
|
||||||
'''
|
"""
|
||||||
def __init__(self, stream):
|
def __init__(self, stream):
|
||||||
self.tree = xmltodict.parse(stream, dict_constructor=dict)['queryresult']
|
self.tree = xmltodict.parse(stream, dict_constructor=dict)['queryresult']
|
||||||
self._handle_error()
|
self._handle_error()
|
||||||
|
@ -97,16 +97,23 @@ class Result(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def results(self):
|
def results(self):
|
||||||
''' Get the pods that hold the response to a simple, discrete query. '''
|
"""
|
||||||
|
Get the pods that hold the response to a simple, discrete query.
|
||||||
|
"""
|
||||||
return [pod 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):
|
||||||
''' Get a simplified set of answers with some context. '''
|
"""
|
||||||
|
Get a simplified set of answers with some context.
|
||||||
|
"""
|
||||||
return {pod.title: pod.text for pod in self.pods}
|
return {pod.title: pod.text for pod in self.pods}
|
||||||
|
|
||||||
|
|
||||||
class Pod(object):
|
class Pod(object):
|
||||||
''' Groups answers and information contextualizing those answers. '''
|
"""
|
||||||
|
Groups answers and information contextualizing those answers.
|
||||||
|
"""
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
self.error = node['@error']
|
self.error = node['@error']
|
||||||
|
@ -142,11 +149,16 @@ class Pod(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def text(self):
|
def text(self):
|
||||||
''' Simply get the text from each subpod in this pod and return it in a list. '''
|
"""
|
||||||
|
Simply get the text from each subpod in this pod and return it in a list.
|
||||||
|
"""
|
||||||
return [subpod.text for subpod in self.subpods]
|
return [subpod.text for subpod in self.subpods]
|
||||||
|
|
||||||
|
|
||||||
class Subpod(object):
|
class Subpod(object):
|
||||||
''' Holds a specific answer or additional information relevant to said answer. '''
|
"""
|
||||||
|
Holds a specific answer or additional information relevant to said answer.
|
||||||
|
"""
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
self.title = node['@title']
|
self.title = node['@title']
|
||||||
|
@ -158,6 +170,7 @@ class Subpod(object):
|
||||||
self.img = [self.img]
|
self.img = [self.img]
|
||||||
self.img = list(map(Image, self.img))
|
self.img = list(map(Image, self.img))
|
||||||
|
|
||||||
|
|
||||||
# Needs work. At the moment this should be considered a placeholder.
|
# Needs work. At the moment this should be considered a placeholder.
|
||||||
class Assumption(object):
|
class Assumption(object):
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
|
@ -179,6 +192,7 @@ class Assumption(object):
|
||||||
pass
|
pass
|
||||||
return text[:text.index('. ') + 1]
|
return text[:text.index('. ') + 1]
|
||||||
|
|
||||||
|
|
||||||
# Needs work. At the moment this should be considered a placeholder.
|
# Needs work. At the moment this should be considered a placeholder.
|
||||||
class Warning(object):
|
class Warning(object):
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
|
@ -190,8 +204,11 @@ class Warning(object):
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(node)
|
return len(node)
|
||||||
|
|
||||||
|
|
||||||
class Image(object):
|
class Image(object):
|
||||||
''' Holds information about an image included with an answer. '''
|
"""
|
||||||
|
Holds information about an image included with an answer.
|
||||||
|
"""
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
self.node = node
|
self.node = node
|
||||||
self.title = node['@title']
|
self.title = node['@title']
|
||||||
|
|
Loading…
Reference in New Issue
Block a user