pathfinder
==========
A utility to find file paths.
Examples
--------
from pathfinder import find
# get all directories and sub-directories in current directory
paths = find(".", just_dirs=True)
# get all files in the current directory and all sub-directories
paths = find(".", just_files=True)
# get all jpg files using a regex
paths = find(".", regex=".*\.jpg$")
# get all jpg files using posix wildcards
paths = find(".", fnmatch="*.jpg")
# get all jpg files and png files
from pathfinder import FnmatchFilter
from pathfinder import OrFilter
jpg_filter = FnmatchFilter("*.jpg")
png_filter = FnmatchFilter("*.png")
gif_filter = FnmatchFilter("*.gif")
image_filter = OrFilter(jpg_filter, png_filter, gif_filter)
paths = find(".", filter=image_filter)
# shortcut using bitwise or
paths = find(".", filter=jpg_filter | png_filter | gif_filter)
# even shorter using ImageFilter to find all images
from pathfinder import ImageFilter
paths = find(".", filter=ImageFilter())
# and an even shorter way
paths = ImageFilter().find(".")
==========
A utility to find file paths.
Examples
--------
from pathfinder import find
# get all directories and sub-directories in current directory
paths = find(".", just_dirs=True)
# get all files in the current directory and all sub-directories
paths = find(".", just_files=True)
# get all jpg files using a regex
paths = find(".", regex=".*\.jpg$")
# get all jpg files using posix wildcards
paths = find(".", fnmatch="*.jpg")
# get all jpg files and png files
from pathfinder import FnmatchFilter
from pathfinder import OrFilter
jpg_filter = FnmatchFilter("*.jpg")
png_filter = FnmatchFilter("*.png")
gif_filter = FnmatchFilter("*.gif")
image_filter = OrFilter(jpg_filter, png_filter, gif_filter)
paths = find(".", filter=image_filter)
# shortcut using bitwise or
paths = find(".", filter=jpg_filter | png_filter | gif_filter)
# even shorter using ImageFilter to find all images
from pathfinder import ImageFilter
paths = find(".", filter=ImageFilter())
# and an even shorter way
paths = ImageFilter().find(".")
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pathfinder-0.4.tar.gz
(1.0 kB
view details)
File details
Details for the file pathfinder-0.4.tar.gz.
File metadata
- Download URL: pathfinder-0.4.tar.gz
- Upload date:
- Size: 1.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ea6f80100f2a4c619db50ebed865f5175d05e8fe4b449581c419c7e94aa9833
|
|
| MD5 |
e6ec01112fec7511912289eb403f05be
|
|
| BLAKE2b-256 |
5603d4e874c5fb1e317fa24e3d5a1b69ef42580b1e336965343af11df653d46d
|