Skip to content

Commit 298bd83

Browse files
authored
Merge pull request #2827 from fermga/copilot/run-copilot-code-review
Fix import errors, remove outdated tests, and apply code formatting
2 parents 46037db + d3c675a commit 298bd83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3500
-3542
lines changed

src/tnfr/alias.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,11 @@ def get_attr(
291291
conv: Callable[[Any], T] = _bepi_to_float,
292292
) -> T | None:
293293
"""Return the value for the first key in ``aliases`` found in ``d``.
294-
294+
295295
WARNING: This function searches for keys in alias order. If you manually
296296
wrote to a non-canonical key (e.g., 'vf' instead of 'νf'), this function
297297
will NOT find it and will return the default value instead.
298-
298+
299299
For structural frequency: ALWAYS use set_vf() to write, not d['vf'] = value.
300300
See module docstring for detailed guidance on canonical attribute access.
301301
"""
@@ -400,13 +400,13 @@ def set_attr_generic(
400400
conv: Callable[[Any], T],
401401
) -> T:
402402
"""Assign ``value`` to the FIRST (canonical) alias key in ``aliases``.
403-
403+
404404
CRITICAL: This function writes to the FIRST key in the alias tuple.
405405
For ALIAS_VF = ('νf', 'nu_f', ...), this writes to 'νf' (Greek nu), NOT 'vf'.
406-
406+
407407
If you later try to read with G.nodes[n]['vf'], you will NOT find the value.
408408
ALWAYS use get_attr() to read what set_attr() wrote.
409-
409+
410410
For high-level usage, prefer set_vf(), set_theta(), etc. which handle this correctly.
411411
See module docstring for detailed guidance on canonical attribute access.
412412
"""

src/tnfr/cli/validate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def main():
146146
# Handle interactive mode
147147
if args.interactive:
148148
from .interactive_validator import run_interactive_validator
149+
149150
return run_interactive_validator(seed=args.seed)
150151

151152
# Require graph_file for non-interactive mode

src/tnfr/config/operator_names.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@
120120
# R4 Extended: Bifurcation windows by destabilizer intensity
121121
# These define how many operators can separate a destabilizer from a transformer
122122
BIFURCATION_WINDOWS = {
123-
'strong': 4, # OZ permits ZHIR/THOL within 4 operators
124-
'moderate': 2, # NAV/VAL permit ZHIR/THOL within 2 operators
125-
'weak': 1, # EN requires ZHIR/THOL as immediate successor
123+
"strong": 4, # OZ permits ZHIR/THOL within 4 operators
124+
"moderate": 2, # NAV/VAL permit ZHIR/THOL within 2 operators
125+
"weak": 1, # EN requires ZHIR/THOL as immediate successor
126126
}
127127

128128

@@ -175,42 +175,42 @@ def operator_display_name(name: str) -> str:
175175

176176
def validate_physics_derivation() -> dict[str, Any]:
177177
"""Validate that operator sets are consistent with TNFR physics derivation.
178-
178+
179179
This function verifies that VALID_START_OPERATORS and VALID_END_OPERATORS
180180
match what would be derived from first principles using the physics_derivation
181181
module.
182-
182+
183183
Returns
184184
-------
185185
dict[str, Any]
186186
Validation report with keys:
187187
- "start_operators_valid": bool
188-
- "end_operators_valid": bool
188+
- "end_operators_valid": bool
189189
- "start_operators_expected": frozenset
190190
- "start_operators_actual": frozenset
191191
- "end_operators_expected": frozenset
192192
- "end_operators_actual": frozenset
193193
- "discrepancies": list of str
194-
194+
195195
Notes
196196
-----
197197
This function is primarily for testing and validation. It ensures that
198198
any manual updates to VALID_START_OPERATORS or VALID_END_OPERATORS remain
199199
consistent with TNFR canonical physics.
200-
200+
201201
If discrepancies are found, the function logs warnings but does not raise
202202
exceptions, allowing for intentional overrides with clear audit trail.
203203
"""
204204
from .physics_derivation import (
205205
derive_start_operators_from_physics,
206206
derive_end_operators_from_physics,
207207
)
208-
208+
209209
expected_starts = derive_start_operators_from_physics()
210210
expected_ends = derive_end_operators_from_physics()
211-
211+
212212
discrepancies = []
213-
213+
214214
start_valid = VALID_START_OPERATORS == expected_starts
215215
if not start_valid:
216216
missing = expected_starts - VALID_START_OPERATORS
@@ -223,7 +223,7 @@ def validate_physics_derivation() -> dict[str, Any]:
223223
discrepancies.append(
224224
f"VALID_START_OPERATORS contains non-physics operators: {extra}"
225225
)
226-
226+
227227
end_valid = VALID_END_OPERATORS == expected_ends
228228
if not end_valid:
229229
missing = expected_ends - VALID_END_OPERATORS
@@ -236,7 +236,7 @@ def validate_physics_derivation() -> dict[str, Any]:
236236
discrepancies.append(
237237
f"VALID_END_OPERATORS contains non-physics operators: {extra}"
238238
)
239-
239+
240240
return {
241241
"start_operators_valid": start_valid,
242242
"end_operators_valid": end_valid,

0 commit comments

Comments
 (0)