Skip to content

Commit 584a523

Browse files
[pre-commit.ci] auto fixes from pre-commit hooks
1 parent e54cfa2 commit 584a523

File tree

4 files changed

+58
-58
lines changed

4 files changed

+58
-58
lines changed

profiling/gprof2dot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ class AXEParser(Parser):
13671367
attrs[name] = value
13681368
return Struct(attrs)
13691369

1370-
_cg_header_re = re.compile("^Index |" "^-----+ ")
1370+
_cg_header_re = re.compile("^Index |^-----+ ")
13711371

13721372
_cg_footer_re = re.compile(r"^Index\s+Function\s*$")
13731373

test/test_big_phi_robust.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,17 @@ def test_sia_standard_example_has_repertoires(self, s):
175175
# Check cause repertoire exists and has required attributes
176176
assert result.cause is not None, "SIA missing cause repertoire"
177177
assert hasattr(result.cause, "phi"), "Cause RIA missing phi attribute"
178-
assert hasattr(
179-
result.cause, "mechanism"
180-
), "Cause RIA missing mechanism attribute"
178+
assert hasattr(result.cause, "mechanism"), (
179+
"Cause RIA missing mechanism attribute"
180+
)
181181
assert hasattr(result.cause, "purview"), "Cause RIA missing purview attribute"
182182

183183
# Check effect repertoire exists and has required attributes
184184
assert result.effect is not None, "SIA missing effect repertoire"
185185
assert hasattr(result.effect, "phi"), "Effect RIA missing phi attribute"
186-
assert hasattr(
187-
result.effect, "mechanism"
188-
), "Effect RIA missing mechanism attribute"
186+
assert hasattr(result.effect, "mechanism"), (
187+
"Effect RIA missing mechanism attribute"
188+
)
189189
assert hasattr(result.effect, "purview"), "Effect RIA missing purview attribute"
190190

191191
def test_sia_standard_example_has_system_state(self, s):
@@ -242,9 +242,9 @@ def test_sia_standard_example_partition_type(self, s):
242242

243243
# System has phi > 0, so should have non-null partition
244244
assert result.phi > 0, "Standard example should have phi > 0"
245-
assert not isinstance(
246-
result.partition, NullCut
247-
), "Irreducible system has NullCut partition"
245+
assert not isinstance(result.partition, NullCut), (
246+
"Irreducible system has NullCut partition"
247+
)
248248

249249
def test_reducible_system_has_null_partition(self, reducible):
250250
"""Reducible system should have null partition.
@@ -254,12 +254,12 @@ def test_reducible_system_has_null_partition(self, reducible):
254254
"""
255255
result = reducible.sia()
256256

257-
assert isinstance(
258-
result, NullSystemIrreducibilityAnalysis
259-
), "Reducible system should return NullSIA"
260-
assert isinstance(
261-
result.partition, NullCut
262-
), "Reducible system should have NullCut partition"
257+
assert isinstance(result, NullSystemIrreducibilityAnalysis), (
258+
"Reducible system should return NullSIA"
259+
)
260+
assert isinstance(result.partition, NullCut), (
261+
"Reducible system should have NullCut partition"
262+
)
263263
assert result.phi == 0.0, "Reducible system should have phi=0"
264264

265265
def test_empty_subsystem_has_null_partition(self, s_empty):
@@ -270,12 +270,12 @@ def test_empty_subsystem_has_null_partition(self, s_empty):
270270
"""
271271
result = s_empty.sia()
272272

273-
assert isinstance(
274-
result, NullSystemIrreducibilityAnalysis
275-
), "Empty subsystem should return NullSIA"
276-
assert isinstance(
277-
result.partition, NullCut
278-
), "Empty subsystem should have NullCut partition"
273+
assert isinstance(result, NullSystemIrreducibilityAnalysis), (
274+
"Empty subsystem should return NullSIA"
275+
)
276+
assert isinstance(result.partition, NullCut), (
277+
"Empty subsystem should have NullCut partition"
278+
)
279279
assert result.phi == 0.0, "Empty subsystem should have phi=0"
280280

281281

test/test_iit4_robust.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ def test_phi_structure_has_distinctions_attribute(self, example_name):
195195
subsystem = EXAMPLES["subsystem"][example_name]()
196196
result = new_big_phi.phi_structure(subsystem)
197197

198-
assert hasattr(
199-
result, "distinctions"
200-
), f"PhiStructure for '{example_name}' missing 'distinctions' attribute"
198+
assert hasattr(result, "distinctions"), (
199+
f"PhiStructure for '{example_name}' missing 'distinctions' attribute"
200+
)
201201

202202
@pytest.mark.parametrize(
203203
"example_name",
@@ -227,9 +227,9 @@ def test_phi_structure_has_relations_attribute(self, example_name):
227227
subsystem = EXAMPLES["subsystem"][example_name]()
228228
result = new_big_phi.phi_structure(subsystem)
229229

230-
assert hasattr(
231-
result, "relations"
232-
), f"PhiStructure for '{example_name}' missing 'relations' attribute"
230+
assert hasattr(result, "relations"), (
231+
f"PhiStructure for '{example_name}' missing 'relations' attribute"
232+
)
233233

234234
@pytest.mark.parametrize(
235235
"example_name",
@@ -255,9 +255,9 @@ def test_phi_structure_distinctions_are_non_empty(self, example_name):
255255
subsystem = EXAMPLES["subsystem"][example_name]()
256256
result = new_big_phi.phi_structure(subsystem)
257257

258-
assert hasattr(
259-
result, "distinctions"
260-
), "PhiStructure missing distinctions attribute"
258+
assert hasattr(result, "distinctions"), (
259+
"PhiStructure missing distinctions attribute"
260+
)
261261

262262
distinctions = result.distinctions
263263
assert distinctions is not None, (
@@ -310,9 +310,9 @@ def test_distinctions_have_mechanism_attribute(self):
310310

311311
# Check each distinction has a mechanism
312312
for i, distinction in enumerate(concepts):
313-
assert hasattr(
314-
distinction, "mechanism"
315-
), f"Distinction {i} missing 'mechanism' attribute"
313+
assert hasattr(distinction, "mechanism"), (
314+
f"Distinction {i} missing 'mechanism' attribute"
315+
)
316316

317317
def test_distinctions_mechanisms_are_within_subsystem(self):
318318
"""Distinction mechanisms should be subsets of subsystem nodes.

test/test_invariants.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,21 @@ def test_sia_partition_attribute_consistency(self, s, micro_s, reducible):
156156
# Irreducible systems with phi > 0 should have non-null partitions
157157
s_result = s.sia()
158158
if s_result.phi > 0:
159-
assert not isinstance(
160-
s_result.partition, NullCut
161-
), "System with phi > 0 has NullCut partition (should have real partition)"
159+
assert not isinstance(s_result.partition, NullCut), (
160+
"System with phi > 0 has NullCut partition (should have real partition)"
161+
)
162162

163163
micro_result = micro_s.sia()
164164
if micro_result.phi > 0:
165-
assert not isinstance(
166-
micro_result.partition, NullCut
167-
), "System with phi > 0 has NullCut partition (should have real partition)"
165+
assert not isinstance(micro_result.partition, NullCut), (
166+
"System with phi > 0 has NullCut partition (should have real partition)"
167+
)
168168

169169
# Reducible system should have null partition
170170
reducible_result = reducible.sia()
171-
assert isinstance(
172-
reducible_result.partition, NullCut
173-
), "Reducible system should have NullCut partition"
171+
assert isinstance(reducible_result.partition, NullCut), (
172+
"Reducible system should have NullCut partition"
173+
)
174174

175175
def test_partition_reduces_or_maintains_phi(self, s, micro_s):
176176
"""Partitioned system cannot have more phi than unpartitioned.
@@ -220,9 +220,9 @@ def test_selfloop_phi_depends_on_config(self, noisy_selfloop_single):
220220
# With config disabled, phi should be 0
221221
with config.override(SINGLE_MICRO_NODES_WITH_SELFLOOPS_HAVE_PHI=False):
222222
result_disabled = noisy_selfloop_single.sia()
223-
assert (
224-
result_disabled.phi == 0.0
225-
), "Expected phi=0 when SINGLE_MICRO_NODES_WITH_SELFLOOPS_HAVE_PHI=False"
223+
assert result_disabled.phi == 0.0, (
224+
"Expected phi=0 when SINGLE_MICRO_NODES_WITH_SELFLOOPS_HAVE_PHI=False"
225+
)
226226

227227
# With config enabled and EMD, phi should be > 0
228228
with config.override(
@@ -251,9 +251,9 @@ def test_cache_clearing_option(self, s):
251251
CACHE_REPERTOIRES=True,
252252
):
253253
_ = s.sia()
254-
assert (
255-
s._repertoire_cache.cache
256-
), "Cache should have entries when clearing is disabled"
254+
assert s._repertoire_cache.cache, (
255+
"Cache should have entries when clearing is disabled"
256+
)
257257

258258
# Test with cache clearing enabled
259259
with config.override(
@@ -262,9 +262,9 @@ def test_cache_clearing_option(self, s):
262262
CACHE_REPERTOIRES=True,
263263
):
264264
_ = s.sia()
265-
assert (
266-
not s._repertoire_cache.cache
267-
), "Cache should be empty when clearing is enabled"
265+
assert not s._repertoire_cache.cache, (
266+
"Cache should be empty when clearing is enabled"
267+
)
268268

269269

270270
class TestPhiStructureInvariants:
@@ -291,12 +291,12 @@ def test_phi_structure_has_distinctions(self, example_name):
291291

292292
# Systems that have phi should have distinctions
293293
if hasattr(result, "phi") and result.phi > 0:
294-
assert hasattr(
295-
result, "distinctions"
296-
), f"System '{example_name}' has phi > 0 but no distinctions attribute"
297-
assert (
298-
len(result.distinctions) > 0
299-
), f"System '{example_name}' has phi > 0 but zero distinctions"
294+
assert hasattr(result, "distinctions"), (
295+
f"System '{example_name}' has phi > 0 but no distinctions attribute"
296+
)
297+
assert len(result.distinctions) > 0, (
298+
f"System '{example_name}' has phi > 0 but zero distinctions"
299+
)
300300

301301
@pytest.mark.parametrize("example_name", ["basic", "fig4"])
302302
def test_phi_structure_has_relations(self, example_name):

0 commit comments

Comments
 (0)