Commit 7139f0c4 authored by eladnoor's avatar eladnoor

styling: flake8

parent 03a777dc
Pipeline #82646834 passed with stages
in 6 minutes and 26 seconds
......@@ -11,7 +11,7 @@ test36:
stage: test
image: python:3.6
script:
- tox -e isort,black,safety # ,flake8
- tox -e isort,black,safety,flake8
- tox -e py36 -- --cov-report=xml --cov-report=term tests
- bash <(curl -s https://codecov.io/bash)
......
......@@ -53,16 +53,14 @@ class BaseBounds(object):
def GetLowerBound(self, compound: Compound):
"""Get the lower bound for this key.
Args:
key: a compound
:param key: a compound
"""
raise NotImplementedError
def GetUpperBound(self, compound: Compound):
"""Get the upper bound for this key.
Args:
key: a compound
:param key: a compound
"""
raise NotImplementedError
......@@ -150,11 +148,10 @@ class BaseBounds(object):
def SetBounds(self, compound: Compound, lb: Q_, ub: Q_):
"""Set bounds for a specific key.
Args:
key: a string representation of a KEGG compound ID,
i.e. C00001 for water
lb: the lower bound value
ub: the upper bound value
:param key: a string representation of a KEGG compound ID,
i.e. C00001 for water
:param lb: the lower bound value
:param ub: the upper bound value
"""
assert lb <= ub
self.lower_bounds[compound] = lb
......@@ -164,7 +161,8 @@ class BaseBounds(object):
class Bounds(BaseBounds):
"""Contains upper and lower bounds for various keys.
Allows for defaults
Allows for defaults.
"""
@ureg.check(None, None, None, "[concentration]", "[concentration]")
......@@ -177,11 +175,12 @@ class Bounds(BaseBounds):
) -> object:
"""Initialize the bounds object.
Args:
lower_bounds: a dictionary mapping keys to lower bounds
upper_bounds: a dictionary mapping keys to upper bounds
default_lb: default lower bound to if no specific one is provided
default_lb: default upper bound to if no specific one is provided
:param lower_bounds: a dictionary mapping keys to lower bounds
:param upper_bounds: a dictionary mapping keys to upper bounds
:param default_lb: default lower bound to if no specific one is
provided
:param default_lb: default upper bound to if no specific one is
provided
"""
self.lower_bounds = lower_bounds or dict()
self.upper_bounds = upper_bounds or dict()
......
......@@ -304,8 +304,7 @@ class ComponentContribution(object):
delta_p_h: ureg.Measurement,
delta_phi: ureg.Measurement,
) -> ureg.Measurement:
"""Calculate the transformed reaction energies of a
multi-compartmental reaction.
"""Calculate the transformed energies of a multi-compartmental reaction.
Based on the equations from
Harandsdottir et al. 2012 (https://doi.org/10.1016/j.bpj.2012.02.032)
......
......@@ -76,14 +76,14 @@ class Pathway(object):
) -> object:
"""Initialize.
Args:
reactions: a list of gibbs.reaction.Reaction objects.
fluxes: numpy.array of relative fluxes in same order as reactions.
standard_dg_primes: reaction energies (in kJ/mol)
dg_sigma: square root of the uncertainty covariance matrix
(in kJ/mol)
bounds: bounds on metabolite concentrations.
Uses default bounds if None provided.
:param reactions: a list of gibbs.reaction.Reaction objects.
:param fluxes: numpy.array of relative fluxes in same order as
reactions.
:param standard_dg_primes: reaction energies (in kJ/mol)
:param dg_sigma: square root of the uncertainty covariance matrix
(in kJ/mol)
:param bounds: bounds on metabolite concentrations. Uses default
bounds if None provided.
"""
self.reactions = reactions
Nr = len(reactions)
......
......@@ -106,6 +106,7 @@ def test_mdf(p_h, ionic_strength, stdev_factor, expected_mdf, toy_pathway):
def test_default_bounds():
"""Test the default bounds file."""
bounds = Bounds.GetDefaultBounds()
bound_df = bounds.to_data_frame()
assert bound_df.shape == (112, 3)
......
......@@ -111,7 +111,7 @@ def test_search_compound(name: str, identifier: str):
],
)
def test_search_reaction(text_formula: str, id_formula: str):
"""Test parsing of freetext reaction formulas"""
"""Test parsing of freetext reaction formulas."""
rxn1 = search_reaction(text_formula)
rxn2 = parse_reaction_formula(id_formula)
if rxn1 != rxn2:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment