Skip to content

osfs ⚓︎

Os specific filesystem utils/operations

Classes:

  • OsFsAbc

    Abstract base class for OS-specific symlink operations

  • LIN

    Linux (and Mac) shell commands/methods container

  • WIN

    Windows shell commands/methods container

OsFsAbc ⚓︎

Bases: ABC

Abstract base class for OS-specific symlink operations

Implemented by LIN (linux/mac) and WIN (windows); all members are static methods, so the subclasses are used as namespaces rather than instantiated.

Methods:

link_dir(
    linkpath: str,
    targetpath: str,
    *,
    exist_ok: bool = False,
) -> None

Make a directory symlink

Parameters:

  • (str) –

    Path to the link to be made

  • (str) –

    Path to the target of the link to be made

  • (bool, default: False ) –

    Allow the link to already exist

link_dirs(
    link_target_tuples: list[tuple[str, str]],
    *,
    exist_ok: bool = False,
) -> None

Make multiple directory symlinks

Parameters:

  • (list[tuple[str, str]]) –

    Iterable of (link, target) tuples

  • (bool, default: False ) –

    Allow the links to already exist

link_file(
    linkpath: str,
    targetpath: str,
    *,
    exist_ok: bool = False,
) -> None

Make a file symlink

Parameters:

  • (str) –

    Path to the link to be made

  • (str) –

    Path to the target of the link to be made

  • (bool, default: False ) –

    Allow the link to already exist

link_files(
    link_target_tuples: list[tuple[str, str]],
    *,
    exist_ok: bool = False,
) -> None

Make multiple file symlinks

Parameters:

  • (list[tuple[str, str]]) –

    Iterable of (link, target) tuples

  • (bool, default: False ) –

    Allow the links to already exist

unlink_dir(link: str) -> None

Unlink a directory symlink

Parameters:

unlink_dirs(links: Iterable[str]) -> None

Unlink multiple directory symlinks

Parameters:

unlink_file(link: str) -> None

Unlink a file symlink

Parameters:

unlink_files(links: Iterable[str]) -> None

Unlink multiple file symlinks

Parameters:

LIN ⚓︎

Bases: OsFsAbc

Linux (and Mac) shell commands/methods container

Methods:

  • link_dir

    Make a directory symlink

  • link_dirs

    Make multiple directory symlinks

  • link_file

    Make a file symlink

  • link_files

    Make multiple file symlinks

  • unlink_dir

    Unlink a directory symlink given a path to the symlink

  • unlink_dirs

    Unlink directory symlinks given the paths the links

  • unlink_file

    Unlink a file symlink given a path to the symlink

  • unlink_files

    Unlink directory symlinks given the paths the links

link_dir(
    linkpath: str,
    targetpath: str,
    *,
    exist_ok: bool = False,
) -> None

Make a directory symlink

Parameters:

  • (str) –

    Path to the link to be made

  • (str) –

    Path to the target of the link to be made

  • (bool, default: False ) –

    Allow link to exist

link_dirs(
    link_target_tuples: list[tuple[str, str]],
    *,
    exist_ok: bool = False,
) -> None

Make multiple directory symlinks

Parameters:

  • (list[tuple[str, str]]) –

    Iterable of tuples of the form: (link, target) or a dictionary mapping with key => value pairs of the form link => target.

  • (bool, default: False ) –

    Allow link to exist

link_file(
    linkpath: str,
    targetpath: str,
    *,
    exist_ok: bool = False,
) -> None

Make a file symlink

Parameters:

  • (str) –

    Path to the link to be made

  • (str) –

    Path to the target of the link to be made

  • (bool, default: False ) –

    Allow links to already exist

link_files(
    link_target_tuples: list[tuple[str, str]],
    *,
    exist_ok: bool = False,
) -> None

Make multiple file symlinks

Parameters:

  • (bool, default: False ) –

    Allow links to already exist

  • (list[tuple[str, str]]) –

    Iterable of tuples of the form: (link, target) or a dictionary mapping with key => value pairs of the form link => target.

unlink_dir(link: str) -> None

Unlink a directory symlink given a path to the symlink

Parameters:

unlink_dirs(links: Iterable[str]) -> None

Unlink directory symlinks given the paths the links

Parameters:

unlink_file(link: str) -> None

Unlink a file symlink given a path to the symlink

Parameters:

unlink_files(links: Iterable[str]) -> None

Unlink directory symlinks given the paths the links

Parameters:

WIN ⚓︎

Bases: OsFsAbc

Windows shell commands/methods container

Methods:

  • link_dir

    Make a directory symlink

  • link_dirs

    Make multiple directory symlinks

  • link_file

    Make a file symlink

  • link_files

    Make multiple file symlinks

  • unlink_dir

    Unlink a directory symlink given a path to the symlink

  • unlink_dirs

    Unlink directory symlinks given the paths the links

  • unlink_file

    Unlink a file symlink given a path to the symlink

  • unlink_files

    Unlink directory symlinks given the paths the links

link_dir(
    linkpath: str,
    targetpath: str,
    *,
    exist_ok: bool = False,
) -> None

Make a directory symlink

Parameters:

  • (str) –

    Path to the link to be made

  • (str) –

    Path to the target of the link to be made

  • (bool, default: False ) –

    If True, do not raise an exception if the link exists

link_dirs(
    link_target_tuples: list[tuple[str, str]],
    *,
    exist_ok: bool = False,
) -> None

Make multiple directory symlinks

Parameters:

  • (list[tuple[str, str]]) –

    Iterable of tuples of the form: (link, target) or a dictionary mapping with key => value pairs of the form link => target.

  • (bool, default: False ) –

    If True, do not raise an exception if the link(s) exist

link_file(
    linkpath: str,
    targetpath: str,
    *,
    exist_ok: bool = False,
) -> None

Make a file symlink

Parameters:

  • (str) –

    Path to the link to be made

  • (str) –

    Path to the target of the link to be made

  • (bool, default: False ) –

    If True, don't raise an exception if the link exists

link_files(
    link_target_tuples: list[tuple[str, str]],
    *,
    exist_ok: bool = False,
) -> None

Make multiple file symlinks

Parameters:

  • (list[tuple[str, str]]) –

    Iterable of tuples of the form: (link, target) or a dictionary mapping with key => value pairs of the form link => target.

  • (bool, default: False ) –

    If True, don't raise an exception if the link exists

unlink_dir(link: str) -> None

Unlink a directory symlink given a path to the symlink

Parameters:

unlink_dirs(links: Iterable[str]) -> None

Unlink directory symlinks given the paths the links

Parameters:

unlink_file(link: str) -> None

Unlink a file symlink given a path to the symlink

Parameters:

unlink_files(links: Iterable[str]) -> None

Unlink directory symlinks given the paths the links

Parameters: