MCPcopy
hub / github.com/tirth8205/code-review-graph / _nix_attrpath_parts

Method _nix_attrpath_parts

code_review_graph/parser.py:2648–2659  ·  view source on GitHub ↗

Flatten a Nix ``attrpath`` node into a list of identifier parts. ``packages.default`` → ``["packages", "default"]``; ``inputs.nixpkgs.url`` → ``["inputs", "nixpkgs", "url"]``. Dotted attrpaths have ``identifier`` children separated by ``.`` tokens.

(self, attrpath_node)

Source from the content-addressed store, hash-verified

2646 return Path(file_path).name == "flake.nix"
2647
2648 def _nix_attrpath_parts(self, attrpath_node) -> list[str]:
2649 """Flatten a Nix ``attrpath`` node into a list of identifier parts.
2650
2651 ``packages.default`` → ``["packages", "default"]``;
2652 ``inputs.nixpkgs.url`` → ``["inputs", "nixpkgs", "url"]``. Dotted
2653 attrpaths have ``identifier`` children separated by ``.`` tokens.
2654 """
2655 parts: list[str] = []
2656 for child in attrpath_node.children:
2657 if child.type == "identifier":
2658 parts.append(child.text.decode("utf-8", errors="replace"))
2659 return parts
2660
2661 def _extract_nix_flake_input_urls(
2662 self, attrset_node,

Callers 2

visitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected