Skip to content

Commit

Permalink
Fix sphinx doc string layout issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Jan 17, 2017
1 parent c0e031e commit 2161f54
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 24 deletions.
6 changes: 2 additions & 4 deletions kripodb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def add_molecules(self, mols):
"""Adds molecules to to molecules table.
Args:
mols (List[rdkit.Chem.Mol]): List of molecules
mols (list[rdkit.Chem.Mol]): List of molecules
"""
with FastInserter(self.cursor):
for mol in mols:
Expand Down Expand Up @@ -258,8 +258,6 @@ def add_molecule(self, mol):
Args:
mol (rdkit.Chem.AllChem.Mol): the rdkit molecule
Returns:
"""
sql = '''INSERT OR REPLACE INTO molecules (frag_id, smiles, mol) VALUES (?, ?, ?)'''

Expand Down Expand Up @@ -392,7 +390,7 @@ def by_pdb_code(self, pdb_code):
pdb_code (str): PDB code
Returns:
List[Fragment]
List[Fragment]: List of fragments
Raises:
LookupError: When pdb_code could not be found
Expand Down
4 changes: 2 additions & 2 deletions kripodb/frozen.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def find(self, query, cutoff, limit=None):
limit (int): Maximum number of hits. Default is None for no limit.
Returns:
Tuple[(str, float)]: Hit fragment idenfier and similarity score
list[tuple[str,float]]: Hit fragment identifier and similarity score
"""
precision = float(self.score_precision)
precision10 = float(10**(floor(log10(precision))))
Expand All @@ -121,7 +121,7 @@ def __getitem__(self, item):
item (STR): Label of a fragment
Returns:
List((str, float)): list of (fragment_label, score)
list[tuple[str, float]]: list of (fragment_label, score)
"""
precision = float(self.score_precision)
Expand Down
16 changes: 8 additions & 8 deletions kripodb/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def update(self, similarities_iter, label2id):
"""Store pairs of fragment identifier with their similarity score and label 2 id lookup
Args:
similarities_iter (Iterator): Iterator which yields (label1, label2, similarity_score)
label2id (Dict): Dictionary with fragment label as key and fragment identifier as value.
similarities_iter (iterator): Iterator which yields (label1, label2, similarity_score)
label2id (dict): Dictionary with fragment label as key and fragment identifier as value.
"""
self.pairs.update(similarities_iter, label2id)
Expand All @@ -104,7 +104,7 @@ def find(self, query, cutoff, limit=None):
limit (int): Maximum number of hits. Default is None for no limit.
Yields:
Tuple[(str, float)]: Hit fragment idenfier and similarity score
(str, float): Hit fragment idenfier and similarity score
"""
if self.cache_l2i:
frag_id = self.cache_l2i[query]
Expand All @@ -122,7 +122,7 @@ def count(self, frame_size):
frame_size (int): Size of matrix loaded each time. Larger requires more memory and smaller is slower.
Returns:
Tuple[(str, int)]: Score and number of occurrences
(str, int): Score and number of occurrences
"""
return self.pairs.count(frame_size)

Expand Down Expand Up @@ -393,7 +393,7 @@ def label2ids(self):
"""Return whole table as a dictionary
Returns:
Dict: Dictionary with label as key and frag_id as value.
dict: Dictionary with label as key and frag_id as value.
"""
return {r['label'].decode(): r['frag_id'] for r in self.table}
Expand All @@ -402,7 +402,7 @@ def update(self, label2id):
"""Update labels lookup by adding labels in label2id.
Args:
label2id (Dict): Dictionary with fragment label as key and fragment identifier as value.
label2id (dict): Dictionary with fragment label as key and fragment identifier as value.
"""
for label, frag_id in six.iteritems(label2id):
Expand Down Expand Up @@ -432,10 +432,10 @@ def merge(self, label2id):
When label does exist the id of the label in self is kept.
Args:
label2id (Dict): Dictionary with fragment label as key and fragment identifier as value.
label2id (dict]): Dictionary with fragment label as key and fragment identifier as value.
Returns:
Dict: Dictionary of label/id which where in label2id, but missing in self
dict: Dictionary of label/id which where in label2id, but missing in self
"""
id_offset = max([r['frag_id'] for r in self.table]) + 1

Expand Down
2 changes: 1 addition & 1 deletion kripodb/modifiedtanimoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def corrections(mean_onbit_density):
mean_onbit_density (float): Mean on bit density
Returns:
S\ :sub:`T` correction, S\ :sub:`T0` correction
float: S\ :sub:`T` correction, S\ :sub:`T0` correction
"""
p0 = mean_onbit_density
corr_st = (2 - p0) / 3
Expand Down
2 changes: 1 addition & 1 deletion kripodb/pairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def open_similarity_matrix(fn):
fn (str): Filename of similarity matrix
Returns:
SimilarityMatrix|FrozenSimilarityMatrix: A read-only similarity matrix object
SimilarityMatrix | FrozenSimilarityMatrix: A read-only similarity matrix object
"""
# peek in file to detect format
Expand Down
2 changes: 1 addition & 1 deletion kripodb/script/dive.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def dive_sphere(inputfile, outputfile, onlyfrag1):
Args:
inputfile (str): fragments db input file
outputfile (file): fragments dive output file
onlyfrag1 (bool):O nly *_frag1
onlyfrag1 (bool): Only \*_frag1
"""
frags_db = FragmentsDb(inputfile)
Expand Down
6 changes: 3 additions & 3 deletions kripodb/webservice/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def similar_fragments(self, fragment_id, cutoff, limit=1000):
limit (int): Maximum number of hits. Default is None for no limit.
Returns:
List(Dict()): Query fragment identifier, hit fragment identifier and similarity score
list[dict]: Query fragment identifier, hit fragment identifier and similarity score
"""
url = self.base_url + '/fragments/{fragment_id}/similar'.format(fragment_id=fragment_id)
params = {'cutoff': cutoff, 'limit': limit}
Expand All @@ -56,7 +56,7 @@ def fragments_by_pdb_codes(self, pdb_codes, chunk_size=450):
chunk_size (int): Number of PDB codes to retrieve in a single http request
Returns:
List(Dict()): List of fragment information
list[dict]: List of fragment information
Raises:
requests.HTTPError: When one of the PDB codes could not be found.
Expand All @@ -71,7 +71,7 @@ def fragments_by_id(self, fragment_ids, chunk_size=100):
chunk_size (int): Number of PDB codes to retrieve in a single http request
Returns:
List(Dict()): List of fragment information
list[dict]: List of fragment information
Raises:
requests.HTTPError: When one of the identifiers could not be found.
Expand Down
18 changes: 14 additions & 4 deletions kripodb/webservice/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_similar_fragments(fragment_id, cutoff, limit):
limit (int): Maximum number of hits. Default is None for no limit.
Returns:
List(Dict()): Query fragment identifier, hit fragment identifier and similarity score
list[dict]: List of dict with query fragment identifier, hit fragment identifier and similarity score
Raises:
werkzeug.exceptions.NotFound: When the fragments_id could not be found
Expand All @@ -72,7 +72,7 @@ def get_similar_fragments(fragment_id, cutoff, limit):
# add query column
for hit_id, score in raw_hits:
hits.append({'query_frag_id': query_id, 'hit_frag_id': hit_id, 'score': score})
except LookupError as e:
except LookupError:
abort(404, 'Fragment with identifier \'{0}\' not found'.format(fragment_id))
return hits

Expand All @@ -85,7 +85,7 @@ def get_fragments(fragment_ids=None, pdb_codes=None):
pdb_codes (List[str]): List of PDB codes
Returns:
List(Dict()): List of fragment information
list[dict]: List of fragment information
Raises:
werkzeug.exceptions.NotFound: When one of the fragments_ids or pdb_code could not be found
Expand Down Expand Up @@ -119,6 +119,16 @@ def mol2svg(mol, width, height):


def get_fragment_svg(fragment_id, width, height):
"""2D drawing of fragment in SVG format
Args:
fragment_id (str): Fragment identifier
width (int): Width of SVG in pixels
height (int): Height of SVG in pixels
Returns:
str: SVG document
"""
fragments_db_filename = current_app.config['db_fn']
with FragmentsDb(fragments_db_filename) as fragmentsdb:
try:
Expand All @@ -133,7 +143,7 @@ def get_fragment_svg(fragment_id, width, height):
def get_version():
"""
Returns:
Dict: Version of web service
dict[version]: Version of web service
"""
# TODO check if matrix is usable
return {'version': __version__}
Expand Down

0 comments on commit 2161f54

Please sign in to comment.