class documentation

class RootPathMapper:

Constructor: RootPathMapper(oldRoot, itGen)

View In Hierarchy

A Callable[[Path], Iterator[Path]] which maps paths provided by another iterator to a new prefix, think ["src/a.py", "src/b.py"] mapped to ["dest/a.py", "dest/b.py"].

Method __call__ Maps the paths defined in the constructor to have a the new prefix path newRoot by replacing the oldRoot defined in the constructor.
Method __init__ Creates the mapper by its input.
Instance Variable _itGen Undocumented
Instance Variable _oldRoot Undocumented
def __call__(self, newRoot: Path) -> Iterator[Path]:

Maps the paths defined in the constructor to have a the new prefix path newRoot by replacing the oldRoot defined in the constructor.

Parameters
newRoot:Pathnew path prefix of the paths defined in the constructor
Returns
Iterator[Path]an iterator over the mapped paths, restartable
def __init__(self, oldRoot: Path, itGen: Callable[[Path], Iterable[Path]]):

Creates the mapper by its input.

The second parameter, itGen is not just an iterator but a function to provide one so that our result can be iterated over more than once.

Parameters
oldRoot:Patha path prefix of all paths provided by itGen
itGen:Callable[[Path], Iterable[Path]]given oldRoot, must return an Iterator[Path] which may on only have paths prefixed with oldRoot, the canonical example being lambda p: p.glob(...)
_itGen =

Undocumented

_oldRoot =

Undocumented