Skip to content

Commit

Permalink
remove
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Oct 25, 2024
1 parent 5674c92 commit 317e384
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions yarl/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ def __init__(self, path: str, strip_tail: bool = False) -> None:
self.path = "/".join(parts) or "."
self.parts = parts

@property
def name(self) -> str:
"""Return the last part of the path."""
return self.parts[-1] if self.parts else ""

def parents(self) -> Generator["URLPath", None, None]:
"""Return a list of parent paths for a given path."""
parts = self.parts
Expand Down Expand Up @@ -105,7 +100,7 @@ def calculate_relative_path(target: str, base: str) -> str:
if target_path_parts is not None:
if base_walk.path in target_path_parts:
break
elif base_walk.name == "..":
elif base_walk.parts[-1] == "..":
raise ValueError(f"'..' segment in {base_path.path!r} cannot be walked")
continue
target_path_parts = set()
Expand All @@ -118,7 +113,7 @@ def calculate_relative_path(target: str, base: str) -> str:
target_path_parts.add(target_parent.path)
else:
# If we didn't break, it means we didn't find a common parent
if base_walk.name == "..":
if base_walk.parts[-1] == "..":
raise ValueError(f"'..' segment in {base_path.path!r} cannot be walked")
continue
break
Expand Down

0 comments on commit 317e384

Please sign in to comment.