diff --git a/.flake8 b/.flake8 index 2fc3b1a..ba7c72a 100644 --- a/.flake8 +++ b/.flake8 @@ -1,11 +1,17 @@ [flake8] ignore = - E121, E123, E133, E226, E24, ; default - E231, ; sometimes no whitespace between commas is clearer - W503, ; W503 conflicts with W504 standard - E402, ; must define path before some local imports - E741, ; ignoring ambiguous variable name 'l' - E743, ; ignoring ambiguous function name 'I' + ; default + E121, E123, E133, E226, E24, + ; sometimes no whitespace between commas is clearer + E231, + ; W503 conflicts with W504 standard + W503, + ; must define path before some local imports + E402, + ; ignoring ambiguous variable name 'l' + E741, + ; ignoring ambiguous function name 'I' + E743, max-line-length = 79 per-file-ignores = simpar/__init__.py:F401 diff --git a/simpar/groups.py b/simpar/groups.py index 1f90d05..a571296 100644 --- a/simpar/groups.py +++ b/simpar/groups.py @@ -62,8 +62,8 @@ def infection_matrix(self, infections_per_contact_unit: float): def outside_rate(self, outside_rate: float): """Return the outside rate.""" # Outside rate assumes well-mixed with external population - return outside_rate * (self.pop * self.contact_units / - np.sum(self.pop * self.contact_units)) + return outside_rate * (self.pop * self.contact_units + / np.sum(self.pop * self.contact_units)) def get_init_SIR_and_DH(self, init_infections: float, init_recovered: float, diff --git a/simpar/sim.py b/simpar/sim.py index aedbf62..7b9d7b8 100644 --- a/simpar/sim.py +++ b/simpar/sim.py @@ -212,7 +212,7 @@ def step(self, n: int = 1, infection_rate: np.ndarray = None, outside_rate (np.ndarray): infections per time period, weighed by \ population of each group in a meta-group. """ - assert(n >= 1) + assert (n >= 1) if n > 1: for _ in range(n): self.step(infection_rate=infection_rate, @@ -241,7 +241,7 @@ def step(self, n: int = 1, infection_rate: np.ndarray = None, t = self._t - assert(t < self.max_T) # enforce max generation + assert (t < self.max_T) # enforce max generation # Fraction susceptible in each group # self._S[t] / (self._S[t] + self._I[t] + self._R[t]) diff --git a/simpar/strategy.py b/simpar/strategy.py index 2b2113b..796d95a 100644 --- a/simpar/strategy.py +++ b/simpar/strategy.py @@ -303,7 +303,7 @@ def from_dictionary(d: Dict, arrival_testing_regimes: Dict, arrival_regime = arrival_testing_regimes[arrival_regime] isolation_regime = d.get("isolation_regime", None) if isolation_regime is not None: - if type(isolation_regime) == str: + if isolation_regime is str: isolation_regime = isolation_regimes[isolation_regime] else: isolation_regime = \ diff --git a/simpar/tests/test_groups.py b/simpar/tests/test_groups.py index 307d44e..c74d6b4 100644 --- a/simpar/tests/test_groups.py +++ b/simpar/tests/test_groups.py @@ -48,4 +48,4 @@ def test_sim8(): s.step(T) inf_2 = sim.I - assert(np.isclose(inf_1, inf_2).all()) + assert (np.isclose(inf_1, inf_2).all())