Top-level package for disambigufile.
Project description
Class with file-like interface to a file found in provided search path
Free software: MIT license
Documentation: https://disambigufile.readthedocs.io.
Features
Search a path for a file that matches a pattern
Search a path for a file inside directories that match a pattern
Examples
from disambigufile import Disambigufile
import disambigufile.exceptions
path = '/bin:/usr/bin:/usr/local/bin'
try:
print(Disambigufile('^ls', path=path))
except disambigufile.exceptions.Error as e:
print(f"unable to disambiguate file; exception: {e}")
path = 'path1:path2'
try:
with Disambigufile(r'^asdf', path=path).open() as f:
print(f.read())
except disambigufile.exceptions.Error as e:
print(f"unable to disambiguate file; exception: {e}")
# search for unique file matching ~/Datasets/*2019-08-19*/data*
path='~/Datasets'
try:
hit = Disambigufile(
pattern='2019-08-19',
path=path,
dir=True,
subpattern='^data',
)
print(hit)
except disambigufile.exceptions.Error as e:
print(f"unable to disambiguate file; exception: {e}")
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
disambigufile-0.1.0.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for disambigufile-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 861def5e6050c71b5172a5a3d2434f613ab7bf0a9411040b48fa7b72ce96b7a6 |
|
MD5 | 853927922c88e9e3222ff4fa199b8cf3 |
|
BLAKE2b-256 | c4c74eaa7efe48554edee7b0cc970f2abe903dbd18676abae6bb429fb55fdcde |