Purpose
The filepaths module is designed to ease file path navigation in python scripts. It is particularly useful for iterating through many files in a directory.
Use
Installation
pip install filepaths
Example
from filepaths import Root
paths = Root(__file__).paths()
for csv in paths.data.filepaths:
pd.read_csv(csv)
Options
file=None: for default behavior pass in __file__
depth=0: how many levels up up from __file__ to start the walk down
ignore_hidden=True: whether or not to include hidden files/paths
alt_path=False: if desired, specify an absolute path to another directory instead of file=__file__
Description
The Root object stores information to build the strings for the desired directories and paths. The paths() method returns a nested dictionary of files, directories and the paths to them as values to the keys. If needed, paths() can be called again to return an updated dictionary.
The .paths() method returns an addict dictionary. This dictionary inherits the standard dictionary class; it can be accessed with either root[data][files] or root.data.files. The keys of the dictionary are the names of the directories below the root directory, as well as ['files', 'dirs', 'path', filepaths'].
The keys 'files', 'dirs', 'path', and 'filepaths' are reserved for the dictionary: if there are directories with these names in any of the children directories, an error will be thrown.
The values to the mentioned keys are as follows:
root.example.pathreturns the absolute path to theexample/as a string.root.example.dirsreturns a list of the child directories inexample/.root.example.filesreturns a list of the filenames, as strings, for every file inexample/.root.example.filepathsreturns a list of the absolute paths, as strings, to every file inexample/.
Metadata
Release files for filepaths 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| filepaths-0.0.8.tar.gz | 2.8 kB | Without provenance | Details for filepaths-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| filepaths-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for filepaths-0.0.8-py3-none-any.whl |
Total release size: 6.6 kB
Release files / filepaths-0.0.8.tar.gz
| Download URL | filepaths-0.0.8.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef15cdadfbcb509ca8f4c9accc64b92972dacfc90b7a4c6c451c5a0cf713cba6
|
|
BLAKE2b-256 checksum How to use checksums |
242a834651bc85d42a21da3c836e9bc0fb558dc7cf66ca971afa14692301b796
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
|
Release files / filepaths-0.0.8-py3-none-any.whl
| Download URL | filepaths-0.0.8-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b1a6a24172256e333f584fa43b39ffce9c927248df39da48ef2f0a5eaf99146
|
|
BLAKE2b-256 checksum How to use checksums |
dffc161bd352443ada791c677918bcc70b066e26fef5b5ee916aac6ac5307fb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
|
Security for filepaths 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.