Skip to content

Draft: Support full Python slice syntax in expand_node_string using real instance/device counts#77

Open
harsh-sikhwal wants to merge 14 commits into
mainfrom
enhance-node-expansion
Open

Draft: Support full Python slice syntax in expand_node_string using real instance/device counts#77
harsh-sikhwal wants to merge 14 commits into
mainfrom
enhance-node-expansion

Conversation

@harsh-sikhwal

Copy link
Copy Markdown
Member

Summary

  • Replaced the digit-only [start:stop] regex in expand_node_string (infragraph_service.py) with a slice parser supporting full Python slice syntax: [:], [:-1], [1:], [::2], and bare/negative single indices.
  • Added a _resolve_slice_indices() helper that resolves open-ended or negative slice bounds using real counts pulled from:
    • _instance_data — for the leading instance name
    • _device_data[...].components — for chained nested component/device names
  • Falls back to the old explicit non-negative start:stop behavior when counts aren't known yet; raises InfrastructureError when a slice can't be resolved without a known count.
  • Fixed test_expand_node_string.py, which was calling a nonexistent _expand_node_string method (pre-existing bug — all 7 tests were erroring). Corrected to expand_node_string and added 2 new tests covering count-based slice resolution and the unresolvable-count error case.

@harsh-sikhwal harsh-sikhwal changed the title Support full Python slice syntax in expand_node_string using real instance/device counts Draft: Support full Python slice syntax in expand_node_string using real instance/device counts Jul 23, 2026
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.

2 participants