@@ -253,34 +253,9 @@ def with_suffix(self, suffix):
253253 self .drive , self .root , self ._tail [:- 1 ] + [name ]
254254 )
255255
256- def relative_to (self , other , / , * _deprecated , walk_up = False ):
257- if _deprecated :
258- msg = (
259- "support for supplying more than one positional argument "
260- "to pathlib.PurePath.relative_to() is deprecated and "
261- "scheduled for removal in Python 3.14"
262- )
263- warnings .warn (
264- f"pathlib.PurePath.relative_to(*args) { msg } " ,
265- DeprecationWarning ,
266- stacklevel = 2 ,
267- )
268- other = self .with_segments (other , * _deprecated )
269- for step , path in enumerate ([other ] + list (other .parents )): # noqa: B007
270- if self .is_relative_to (path ):
271- break
272- elif not walk_up :
273- raise ValueError (
274- f"{ str (self )!r} is not in the subpath of { str (other )!r} "
275- )
276- elif path .name == ".." :
277- raise ValueError (f"'..' segment in { str (other )!r} cannot be walked" )
278- else :
279- raise ValueError (
280- f"{ str (self )!r} and { str (other )!r} have different anchors"
281- )
282- parts = [".." ] * step + self ._tail [len (path ._tail ) :]
283- return self .with_segments (* parts )
256+ # NOTE relative_to was elevated to UPath as otherwise this would
257+ # cause a circular dependency
258+ # def relative_to(self, other, /, *_deprecated, walk_up=False):
284259
285260 def is_relative_to (self , other , / , * _deprecated ):
286261 if _deprecated :
0 commit comments