plistsync.core.rewrite

Path rewriting utilities.

This module provides utilities for rewriting file paths in a consistent manner.

Overview

Classes

PathRewrite

A tuple for managing and applying path rewriting rules.

Module Contents

class plistsync.core.rewrite.PathRewrite

Bases: NamedTuple

A tuple for managing and applying path rewriting rules.

classmethod from_str(old: str, new: str) PathRewrite

Create a PathRewrite instance from string representations of paths.

Parameters:
  • old (str) – The old path prefix to be replaced.

  • new (str) – The new path prefix to replace with.

apply(path: T) T

Apply the rewrite rule to a given path.

Parameters:

path (PurePath) – The path to be rewritten.

property invert: PathRewrite

Invert the rewrite rule.