Skip to main content

Top-level package for disambigufile.

Project description

https://img.shields.io/pypi/v/disambigufile.svg https://img.shields.io/travis/datagazing/disambigufile.svg Documentation Status

Class with file-like interface to a file found in provided search path

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


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)

Uploaded Source

Built Distribution

disambigufile-0.1.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page