MCPcopy Index your code
hub / github.com/python/cpython / iterdir

Method iterdir

Lib/pathlib/__init__.py:1027–1039  ·  view source on GitHub ↗

Yield path objects of the directory contents. The children are yielded in arbitrary order, and the special entries '.' and '..' are not included.

(self)

Source from the content-addressed store, hash-verified

1025 return path
1026
1027 def iterdir(self):
1028 """Yield path objects of the directory contents.
1029
1030 The children are yielded in arbitrary order, and the
1031 special entries '.' and '..' are not included.
1032 """
1033 root_dir = str(self)
1034 with os.scandir(root_dir) as scandir_it:
1035 entries = list(scandir_it)
1036 if root_dir == '.':
1037 return (self._from_dir_entry(e, e.name) for e in entries)
1038 else:
1039 return (self._from_dir_entry(e, e.path) for e in entries)
1040
1041 def glob(self, pattern, *, case_sensitive=None, recurse_symlinks=False):
1042 """Iterate over this subtree and yield all existing files (of any

Callers 15

test_iterdir_on_fileMethod · 0.95
test_openMethod · 0.95
test_readMethod · 0.95
test_mutabilityMethod · 0.95
test_malformed_pathsMethod · 0.95
setup_ciFunction · 0.45

Calls 4

_from_dir_entryMethod · 0.95
strFunction · 0.85
listClass · 0.85
scandirMethod · 0.45

Tested by 11

test_iterdir_on_fileMethod · 0.76
test_openMethod · 0.76
test_readMethod · 0.76
test_mutabilityMethod · 0.76
test_malformed_pathsMethod · 0.76