Return an iterable of paths at `location` recursively. :param location: a file or a directory. :param ignored: a callable accepting a location argument and returning True if the location should be ignored. :return: an iterable of file and directory locations.
(location, ignored=ignore_nothing, with_dirs=True, follow_symlinks=False)
| 362 | |
| 363 | |
| 364 | def resource_iter(location, ignored=ignore_nothing, with_dirs=True, follow_symlinks=False): |
| 365 | """ |
| 366 | Return an iterable of paths at `location` recursively. |
| 367 | |
| 368 | :param location: a file or a directory. |
| 369 | :param ignored: a callable accepting a location argument and returning True |
| 370 | if the location should be ignored. |
| 371 | :return: an iterable of file and directory locations. |
| 372 | """ |
| 373 | for top, dirs, files in walk(location, ignored, follow_symlinks=follow_symlinks): |
| 374 | if with_dirs: |
| 375 | for d in dirs: |
| 376 | yield os.path.join(top, d) |
| 377 | for f in files: |
| 378 | yield os.path.join(top, f) |
| 379 | |
| 380 | |
| 381 | # |