Skip to content

Commit

Permalink
docs: correct some docstrings to remove warnings
Browse files Browse the repository at this point in the history
* Some more docstrings cause warnings
  • Loading branch information
Midnighter committed Jan 31, 2018
1 parent 35b4ee5 commit 37a5320
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
17 changes: 10 additions & 7 deletions cobra/core/dictlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ class DictList(list):
This object behaves like a list, but has the O(1) speed
benefits of a dict when looking up elements by their id.
Parameters
----------
*args : iterable
iterable as single argument to create new DictList from
"""

def __init__(self, *args):
"""Instantiate a combined dict and list.
Parameters
----------
args : iterable
iterable as single argument to create new DictList from
"""
if len(args) > 2:
raise TypeError("takes at most 1 argument (%d given)" % len(args))
super(DictList, self).__init__(self)
Expand Down Expand Up @@ -93,13 +97,12 @@ def query(self, search_function, attribute=None):
Parameters
----------
search_function : a string, regular expression or function
used to find the matching elements in the list.
Used to find the matching elements in the list.
- a regular expression (possibly compiled), in which case the
given attribute of the object should match the regular expression.
- a function which takes one argument and returns True for
desired values
attribute : string or None
the name attribute of the object to passed as argument to the
`search_function`. If this is None, the object itself is used.
Expand Down
4 changes: 2 additions & 2 deletions cobra/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ def add_boundary(self, metabolite, type="exchange", reaction_id=None,
If you set the reaction `type` to something else, you must specify the
desired identifier of the created reaction along with its upper and
lower bound. The name will be given by the metabolite name and the
given `type`.
lower bound. The name will be given by the metabolite name and the
given `type`.
Parameters
----------
Expand Down
19 changes: 11 additions & 8 deletions cobra/core/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,8 @@ def get_coefficient(self, metabolite_id):
return self._metabolites[_id_to_metabolites[metabolite_id]]

def get_coefficients(self, metabolite_ids):
"""Return the stoichiometric coefficients for a list of
metabolites in the reaction.
"""
Return the stoichiometric coefficients for a list of metabolites.
Parameters
----------
Expand Down Expand Up @@ -806,11 +806,16 @@ def add_metabolites(self, metabolites_to_add, combine=True,
combine=False, reversibly=False))

def subtract_metabolites(self, metabolites, combine=True, reversibly=True):
"""This function will 'subtract' metabolites from a reaction, which
means add the metabolites with -1*coefficient. If the final coefficient
for a metabolite is 0 then the metabolite is removed from the reaction.
"""Subtract metabolites from a reaction.
The change is reverted upon exit when using the model as a context.
That means add the metabolites with -1*coefficient. If the final
coefficient for a metabolite is 0 then the metabolite is removed from
the reaction.
Notes
-----
* A final coefficient < 0 implies a reactant.
* The change is reverted upon exit when using the model as a context.
Parameters
----------
Expand All @@ -828,8 +833,6 @@ def subtract_metabolites(self, metabolites, combine=True, reversibly=True):
Whether to add the change to the context to make the change
reversibly or not (primarily intended for internal use).
.. note:: A final coefficient < 0 implies a reactant.
"""
self.add_metabolites({
k: -v for k, v in iteritems(metabolites)},
Expand Down

0 comments on commit 37a5320

Please sign in to comment.