System Path Utilities¶
Utilities for working with system paths.
Path Module¶
Path operation utilities.
This submodule provides utilities for path operations and queries using pathlib.
Examples¶
from rite.system.path import path_exists, path_join path_exists("/tmp") True path_join("/tmp", "file.txt") '/tmp/file.txt'
Modules¶
path_absolute
¶
Path Absolute¶
Get absolute path.
Examples¶
from rite.system.path import path_absolute path_absolute(".") '/current/working/directory'
Functions¶
path_absolute(path: str | Path) -> str
¶
Get absolute path as string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Relative or absolute path. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Absolute path string. |
Examples:
>>> path_absolute(".")
'/current/working/directory'
>>> path_absolute("../parent")
'/parent/directory'
Notes
Resolves symlinks and relative paths.
path_exists
¶
path_is_dir
¶
path_is_file
¶
path_join
¶
Path Join¶
Join path components.
Examples¶
from rite.system.path import path_join path_join("/tmp", "file.txt") '/tmp/file.txt'
Functions¶
path_join(*parts: str) -> str
¶
Join path components into single path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*parts
|
str
|
Path components to join. |
()
|
Returns:
| Type | Description |
|---|---|
str
|
Joined path string. |
Examples:
>>> path_join("/tmp", "dir", "file.txt")
'/tmp/dir/file.txt'
>>> path_join(".", "file.txt")
'./file.txt'
Notes
Uses platform-specific separator.
options: show_root_heading: true show_source: false heading_level: 2