Did I find the right examples for you? yes no

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
Walks the specified root path for all files.

*root* (``str``) is the root directory to search for files.

Raises ``RecursionError`` if recursion is detected.

Returns an ``Iterable`` yielding each file path (``str``) relative to
*root*.

.. _`recursion`: http://docs.python.org/2/library/os.html#os.walk

        def iter_tree(root):
	"""
	Walks the specified root path for all files.

	*root* (``str``) is the root directory to search for files.

	Raises ``RecursionError`` if recursion is detected.

	Returns an ``Iterable`` yielding each file path (``str``) relative to
	*root*.

	.. _`recursion`: http://docs.python.org/2/library/os.html#os.walk
	"""
	# Keep track of files encountered. Map real path to relative path.
	memo = {}

	root = os.path.abspath(root)
	for parent, _dirs, files in os.walk(root, followlinks=True):
		# Get parent path relative to root path.
		parent = os.path.relpath(parent, root)

		# Check for recursion.
		real = os.path.realpath(parent)
		if real in memo:
			raise RecursionError(real_path=real, first_path=memo[real], second_path=parent)
		memo[real] = parent

		# Yield files.
		for path in files:
			if parent != '.':
				path = os.path.join(parent, path)
			yield path
        


src/p/a/pathspec-0.2.2/pathspec/__init__.py   pathspec(Download)
from .pathspec import PathSpec
from .pattern import Pattern, RegexPattern
from .util import iter_tree, match_files, RecursionError