MCPcopy Create free account
hub / github.com/mlco2/codecarbon / resolve_path

Function resolve_path

codecarbon/core/util.py:34–46  ·  view source on GitHub ↗

Fully resolve a path: resolve env vars ($HOME etc.) -> expand user (~) -> make absolute Args: path (Union[str, Path]): Path to a file or repository to resolve as string or pathlib.Path Returns: pathlib.Path: resolved absolute path

(path: Union[str, Path])

Source from the content-addressed store, hash-verified

32
33
34def resolve_path(path: Union[str, Path]) -> Path:
35 """
36 Fully resolve a path:
37 resolve env vars ($HOME etc.) -> expand user (~) -> make absolute
38
39 Args:
40 path (Union[str, Path]): Path to a file or repository to resolve as
41 string or pathlib.Path
42
43 Returns:
44 pathlib.Path: resolved absolute path
45 """
46 return Path(expandvars(str(path))).expanduser().resolve()
47
48
49def backup(file_path: Union[str, Path], ext: Optional[str] = ".bak") -> None:

Callers 2

test_backupFunction · 0.90
backupFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_backupFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…