@@ -101,23 +101,7 @@ def _check_path(path: Path, fspath: LEGACY_PATH) -> None:
101
101
)
102
102
103
103
104
- def _imply_path (
105
- path : Optional [Path ], fspath : Optional [LEGACY_PATH ]
106
- ) -> Tuple [Path , LEGACY_PATH ]:
107
- if path is not None :
108
- if fspath is not None :
109
- _check_path (path , fspath )
110
- else :
111
- fspath = legacy_path (path )
112
- return path , fspath
113
- else :
114
- assert fspath is not None
115
- return Path (fspath ), fspath
116
-
117
-
118
- # Optimization: use _imply_path_only over _imply_path when only need Path.
119
- # This is to avoid `legacy_path(path)` which is surprisingly heavy.
120
- def _imply_path_only (path : Optional [Path ], fspath : Optional [LEGACY_PATH ]) -> Path :
104
+ def _imply_path (path : Optional [Path ], fspath : Optional [LEGACY_PATH ]) -> Path :
121
105
if path is not None :
122
106
if fspath is not None :
123
107
_check_path (path , fspath )
@@ -212,7 +196,7 @@ def __init__(
212
196
#: Filesystem path where this node was collected from (can be None).
213
197
if path is None and fspath is None :
214
198
path = getattr (parent , "path" , None )
215
- self .path = _imply_path_only (path , fspath = fspath )
199
+ self .path = _imply_path (path , fspath = fspath )
216
200
217
201
# The explicit annotation is to avoid publicly exposing NodeKeywords.
218
202
#: Keywords/markers collected from all scopes.
@@ -589,7 +573,7 @@ def __init__(
589
573
assert path is None
590
574
path = path_or_parent
591
575
592
- path = _imply_path_only (path , fspath = fspath )
576
+ path = _imply_path (path , fspath = fspath )
593
577
if name is None :
594
578
name = path .name
595
579
if parent is not None and parent .path != path :
0 commit comments