diff options
| author | Bryan Thompson <238056179+bryan-anthropic@users.noreply.github.com> | 2026-08-20 14:50:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-20 14:50:15 -0500 |
| commit | 240c4b2c17b19868e880f2bfdd909144d67224e1 (patch) | |
| tree | 9deddb18cf7c137cd56c93b25763eba0946a7ad6 /plugins/claude-security/scripts/lib/absolute.py | |
| parent | 81182783dc1c15ae70e8a489b1edee5450b1434d (diff) | |
| parent | cbe94d02bc8ea7375e13b39cc400e17eeabfcbee (diff) | |
Merge branch 'main' into add-unleashadd-unleash
Diffstat (limited to 'plugins/claude-security/scripts/lib/absolute.py')
| -rw-r--r-- | plugins/claude-security/scripts/lib/absolute.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/claude-security/scripts/lib/absolute.py b/plugins/claude-security/scripts/lib/absolute.py new file mode 100644 index 00000000..45f28ed3 --- /dev/null +++ b/plugins/claude-security/scripts/lib/absolute.py @@ -0,0 +1,15 @@ +"""Whether a path is spelled absolutely on any platform, not just the one this runs on.""" + +from __future__ import annotations + +import ntpath +import os + + +def spelled(path: str) -> bool: + """True for a rooted, drive-qualified or UNC path, whichever platform reads it.""" + return ( + os.path.isabs(path) + or path.replace("\\", "/").startswith("/") + or bool(ntpath.splitdrive(path)[0]) + ) |
