Skip to main content

A library for deciding how to rename conflicting file paths.

Project description

name_conflict_resolver

A small Python library that decides how to rename files to avoid conflicts.

example

This example can also be found in eample.py

from pathlib import PurePosixPath as p
from name_conflict_resolver import NameConflictResolver

names = [p("/home/andrew/foo"), p("/home/andrew/bar"), p("/home/andrew/foo")]

# We can currently distinguish these names by their index in the array, so
# we use the list of indices as the keys. Meanwhile, we can obtain a 
# corresponding path from a key using the __getitem__ method of names.
resolver = NameConflictResolver.from_keys(range(len(names)), names.__getitem__)

for f, (orig_destination, destination) in resolver.resolve():
    print(f"Path at index {f}: {orig_destination} -> {destination}")

Output:

Path at index 2: /home/andrew/foo -> /home/andrew/foo_1
Path at index 0: /home/andrew/foo -> /home/andrew/foo
Path at index 1: /home/andrew/bar -> /home/andrew/bar

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

name_conflict_resolver-0.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

name_conflict_resolver-0.0.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file name_conflict_resolver-0.0.1.tar.gz.

File metadata

  • Download URL: name_conflict_resolver-0.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for name_conflict_resolver-0.0.1.tar.gz
Algorithm Hash digest
SHA256 958c519970d376f900cc0be260879ec46823dc5807638df4e45e2ec164ef7fb8
MD5 a2b3b478f4916518f26be64eae51342b
BLAKE2b-256 ad55ada7a2aa03e653b19c269caca7cdf1990b5c4d50e9fb3bdaca3daba567b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for name_conflict_resolver-0.0.1.tar.gz:

Publisher: package.yml on actapia/name_conflict_resolver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file name_conflict_resolver-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for name_conflict_resolver-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c223adf7c5d849206d25ca1ba5f66e4bed5d54a73ede105fe2cf16398bbb8a
MD5 86cb532697814c2dc1a211fa706fb182
BLAKE2b-256 db4e1b0e8bd1255cdb602803bef7dfa26166a2e2844582e892bd7a8d77f474f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for name_conflict_resolver-0.0.1-py3-none-any.whl:

Publisher: package.yml on actapia/name_conflict_resolver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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