Skip to main content

No project description provided

Project description

directoryshard

Shard filenames into subdirectories.

A large number of files in a single directory can make operations such as listing or browsing cumbersome. Splitting files into subdirectories alleviates this.

API

Two methods are provided:

def shardprefix(filename: str) -> str:
"""Return a 2 character alphanumeric string by deterministically hashing filename"""

def sharded(filepath: Path) -> Path:
 """Return path sharded into subdirectory"""

Class

ShardedDirectory provides getting file paths from a directory:

sharded_tmp = ShardedDirectory('/tmp)
print(sharded_tmp.filepath('python'))

return /tmp/ep.python.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

directoryshard-1.0.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

directoryshard-1.0-py3-none-any.whl (3.6 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