Skip to main content

Path object VC index

Project description

ci python3.8 pypi codecov.io mit black

Path object VC index

Install

pip install lsfiles

Development

poetry install

Usage

>>> from lsfiles import LSFiles
>>> from pathlib import Path
>>> files = LSFiles()  # begin with an empty index
>>> # the `LSFiles` object is a mutable sequence (list-like object)
>>> print(files)
<LSFiles []>
>>> # `lsfiles` is designed to work with `git`, and only versioned files
>>> # are indexed
>>> # $ git init
>>> files.populate()  # <LSFiles []>
>>> # $ git add .
>>> files.populate()  # <LSFiles [PosixPath(...), ...]>
>>> files.clear()  # clear the index
>>> print(files)
<LSFiles []>
>>> # as `lsfiles` is an index of unique file paths, its implementation
>>> # of extend prevents duplicates
>>> values = [Path.cwd() / "1", Path.cwd() / "1"]
>>> files.extend(values)  # <LSFiles [PosixPath('.../lsfiles/1')]>
>>> files.clear()
>>> # reduce minimizes index to directories and individual files
>>> # the list value is returned, leaving `LSFiles` unaltered
>>> values = [
...     Path.cwd() / "f1",
...     Path.cwd() / 'd1' / "1",
...     Path.cwd() / 'd1' / "2",
... ]
>>> files.extend(values)
>>> files.reduce() # -> [PosixPath('.../f1'), PosixPath('.../d1')]
>>> # exclusions are evaluated by their basename, and does not have
>>> # have to be an absolute path
>>> # exclusions can be added on instantiation
>>> files = LSFiles("f1")
>>> # or with the add exclusions method
>>> files = LSFiles()
>>> files.add_exclusions()

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

lsfiles-0.1.1.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

lsfiles-0.1.1-py3-none-any.whl (4.8 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