Skip to content

Require node and layer counts by name across the package - #18

Open
rodvals wants to merge 2 commits into
refactor/uniform-argument-orderfrom
refactor/keyword-only-dimensions
Open

Require node and layer counts by name across the package#18
rodvals wants to merge 2 commits into
refactor/uniform-argument-orderfrom
refactor/keyword-only-dimensions

Conversation

@rodvals

@rodvals rodvals commented Jul 28, 2026

Copy link
Copy Markdown
Member

Dependency

Stacked on #17. Merge after its parents, then rebase onto master and retarget.

Problem

After the previous pull request, half the package requires the dimensions to be named and half does not, and a caller has no way to remember which half. This applies one rule everywhere: a node count and a layer count are always passed by name.

Nothing unsafe changes here. A transposed call into these functions already returned the wrong length: on 4 nodes and 3 layers, compute_aggregated_multidegree(supra, 3, 4) returns 3 values where 4 are expected. The gain is consistency and the cost is a wider break, which is why it is separate and can be declined on its own. The parameters were also named n and l; since callers now have to write the names out, this is the only moment to fix that without breaking the same signatures twice.

Changes

  • n and l renamed to nodes and layers in 43 functions in versatility.py, global_descriptors.py, mesoscale.py and utils/parsing.py, and both become keyword-only
  • four further functions already used the right names but took them positionally, and are brought in line; three of those also had them in the reversed order
  • one local list called layers renamed to layer_matrices, so the parameter name is free
  • all call sites updated
  • get_percolation in percolation.py, the one function I missed from the first commit

Verification

  • every discovered function was called on one fixed network before and after the change. The harness can supply arguments for 49 of the 54, and all 49 return identical results; the other five need arguments it cannot guess, such as a kind string
  • full suite: 750 passed, 63 skipped, against 648 and 63 on the base branch. The old seven-case test is replaced by 109 cases: one discovery check and two per function
  • mypy src/: no issues found in 17 source files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant