Skip to content

Commit fa26b39

Browse files
committed
Rename __safe_path__ to _split_path
1 parent 6f8a558 commit fa26b39

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

dpath/util.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MergeType(IntFlag):
1919
IntAwareSegment = Union[int, Any]
2020

2121

22-
def __safe_path__(path: str, separator: str) -> Union[List[IntAwareSegment], IntAwareSegment]:
22+
def _split_path(path: str, separator: str) -> Union[List[IntAwareSegment], IntAwareSegment]:
2323
"""
2424
Given a path and separator, return a tuple of segments. If path is
2525
already a non-leaf thing, return it.
@@ -67,7 +67,7 @@ def new(obj, path, value, separator='/', creator=None):
6767
responsible for creating missing keys at arbitrary levels of
6868
the path (see the help for dpath.path.set)
6969
"""
70-
segments = __safe_path__(path, separator)
70+
segments = _split_path(path, separator)
7171
if creator:
7272
return dpath.segments.set(obj, segments, value, creator=creator)
7373
return dpath.segments.set(obj, segments, value)
@@ -80,7 +80,7 @@ def delete(obj, glob, separator='/', afilter=None):
8080
Returns the number of deleted objects. Raises PathNotFound if no paths are
8181
found to delete.
8282
"""
83-
globlist = __safe_path__(glob, separator)
83+
globlist = _split_path(glob, separator)
8484

8585
def f(obj, pair, counter):
8686
(segments, value) = pair
@@ -135,7 +135,7 @@ def set(obj, glob, value, separator='/', afilter=None):
135135
Given a path glob, set all existing elements in the document
136136
to the given value. Returns the number of elements changed.
137137
"""
138-
globlist = __safe_path__(glob, separator)
138+
globlist = _split_path(glob, separator)
139139

140140
def f(obj, pair, counter):
141141
(segments, found) = pair
@@ -168,7 +168,7 @@ def get(obj: Dict, glob: str, separator="/", default: Any = _DEFAULT_SENTINEL) -
168168
if glob == "/":
169169
return obj
170170

171-
globlist = __safe_path__(glob, separator)
171+
globlist = _split_path(glob, separator)
172172

173173
def f(obj, pair, results):
174174
(segments, found) = pair
@@ -211,7 +211,7 @@ def search(obj, glob, yielded=False, separator='/', afilter=None, dirs=True):
211211
every element in the document that matched the glob.
212212
"""
213213

214-
globlist = __safe_path__(glob, separator)
214+
globlist = _split_path(glob, separator)
215215

216216
def keeper(segments, found):
217217
"""

tests/test_util_paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
def test_util_safe_path_list():
5-
res = dpath.util.__safe_path__(["Ignore", "the/separator"], None)
5+
res = dpath.util._split_path(["Ignore", "the/separator"], None)
66

77
assert(len(res) == 2)
88
assert(res[0] == "Ignore")

0 commit comments

Comments
 (0)