Skip to content

Commit

Permalink
Update .flake8 config to reflect 5 -> 6 update
Browse files Browse the repository at this point in the history
  • Loading branch information
henryrobbins committed Jul 17, 2024
1 parent e06ff08 commit 05a6bc2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
18 changes: 12 additions & 6 deletions .flake8
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions simpar/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions simpar/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion simpar/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = \
Expand Down
2 changes: 1 addition & 1 deletion simpar/tests/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit 05a6bc2

Please sign in to comment.