Skip to content

Commit f89393a

Browse files
Kasper JungeRalphify
authored andcommitted
refactor: replace _is_relative_to helper with Path.is_relative_to
The helper duplicated stdlib functionality available since Python 3.9. Other modules (_install_common.py, sdk/skill.py) already use the built-in method directly; package.py now matches that convention. Co-authored-by: Ralphify <noreply@ralphify.co>
1 parent 0e9a150 commit f89393a

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

agr/package.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ class _QueueItem:
6363
parent_identifier: str | None
6464

6565

66-
def _is_relative_to(path: Path, parent: Path) -> bool:
67-
"""Return True when *path* is inside *parent*."""
68-
try:
69-
path.relative_to(parent)
70-
except ValueError:
71-
return False
72-
return True
73-
74-
7566
def _remote_dep_from_repo_path(
7667
sub_dep: Dependency,
7768
repo_dir: Path,
@@ -85,7 +76,7 @@ def _remote_dep_from_repo_path(
8576

8677
repo_root = repo_dir.resolve()
8778
resolved_path = (repo_root / sub_dep.path).resolve()
88-
if not _is_relative_to(resolved_path, repo_root):
79+
if not resolved_path.is_relative_to(repo_root):
8980
raise ConfigError(
9081
f"Local path dependency '{sub_dep.identifier}' resolves outside "
9182
"the downloaded repository"

0 commit comments

Comments
 (0)