Yield each file in the tree under the given directory name. If "suffix" is provided then only files with that suffix will be included.
(root, *,
suffix=None,
walk=_walk_tree,
)
| 217 | |
| 218 | |
| 219 | def walk_tree(root, *, |
| 220 | suffix=None, |
| 221 | walk=_walk_tree, |
| 222 | ): |
| 223 | """Yield each file in the tree under the given directory name. |
| 224 | |
| 225 | If "suffix" is provided then only files with that suffix will |
| 226 | be included. |
| 227 | """ |
| 228 | if suffix and not isinstance(suffix, str): |
| 229 | raise ValueError('suffix must be a string') |
| 230 | |
| 231 | for filename in walk(root): |
| 232 | if suffix and not filename.endswith(suffix): |
| 233 | continue |
| 234 | yield filename |
| 235 | |
| 236 | |
| 237 | def glob_tree(root, *, |