module documentation

Undocumented

Function from_package Return a Traversable object for the given package.
Function get_resource_reader Return the package's loader if it's a ResourceReader.
Function package_to_anchor Replace 'package' parameter as 'anchor' and warn about the change.
Function resolve Undocumented
Function _ Degenerate behavior for pathlib.Path objects.
Function _infer_caller Walk the stack and find the frame of the first caller not in this module.
Function _is_present_dir Some Traversables implement ``is_dir()`` to raise an exception (i.e. ``FileNotFoundError``) when the directory doesn't exist. This function wraps that call to always return a boolean and only return True if there's a dir and it exists.
Function _temp_dir Given a traversable dir, recursively replicate the whole tree to the file system in a context manager.
Function _temp_file Undocumented
Function _temp_path Wrap tempfile.TemporyDirectory to return a pathlib object.
Function _tempfile Undocumented
Function _write_contents Undocumented
def from_package(package: types.ModuleType): (source)

Return a Traversable object for the given package.

def get_resource_reader(package: types.ModuleType) -> Optional[ResourceReader]: (source)

Return the package's loader if it's a ResourceReader.

def package_to_anchor(func): (source)

Replace 'package' parameter as 'anchor' and warn about the change. Other errors should fall through. >>> files('a', 'b') Traceback (most recent call last): TypeError: files() takes from 0 to 1 positional arguments but 2 were given

Undocumented

Degenerate behavior for pathlib.Path objects.

def _infer_caller(): (source)

Walk the stack and find the frame of the first caller not in this module.

def _is_present_dir(path: Traversable) -> bool: (source)

Some Traversables implement ``is_dir()`` to raise an exception (i.e. ``FileNotFoundError``) when the directory doesn't exist. This function wraps that call to always return a boolean and only return True if there's a dir and it exists.

Given a traversable dir, recursively replicate the whole tree to the file system in a context manager.

def _temp_file(path): (source)

Undocumented

Wrap tempfile.TemporyDirectory to return a pathlib object.

@contextlib.contextmanager
def _tempfile(reader, suffix='', *, _os_remove=os.remove): (source)

Undocumented

def _write_contents(target, source): (source)

Undocumented