Skip to content

NodeAccessor getitem#93

Merged
p1c2u merged 1 commit intomasterfrom
feature/node-accessor-getitem
Feb 15, 2026
Merged

NodeAccessor getitem#93
p1c2u merged 1 commit intomasterfrom
feature/node-accessor-getitem

Conversation

@p1c2u
Copy link
Owner

@p1c2u p1c2u commented Feb 15, 2026

This pull request refactors the NodeAccessor and related classes in pathable/accessors.py to use the new __getitem__ method for path traversal instead of directly calling _get_node. This change improves code readability and consistency by centralizing node access logic in a single method.

Refactoring for centralized node access:

  • Added a __getitem__ method to NodeAccessor that retrieves a node given a sequence of path parts, encapsulating path traversal logic.
  • Replaced all direct calls to _get_node(self.node, parts) with self[parts] throughout the file, ensuring all node lookups go through the new __getitem__ method. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Documentation and comment updates:

  • Updated comments to refer to the new access pattern (get() or self[parts]) instead of the old _get_node() method, reflecting the refactor. [1] [2]

This refactor makes the codebase easier to maintain and less error-prone by reducing duplication and clarifying the intended node access pattern.

@p1c2u p1c2u merged commit 870cf6a into master Feb 15, 2026
10 checks passed
@p1c2u p1c2u deleted the feature/node-accessor-getitem branch February 15, 2026 20:50
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