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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
958c519970d376f900cc0be260879ec46823dc5807638df4e45e2ec164ef7fb8
|
|
| MD5 |
a2b3b478f4916518f26be64eae51342b
|
|
| BLAKE2b-256 |
ad55ada7a2aa03e653b19c269caca7cdf1990b5c4d50e9fb3bdaca3daba567b5
|
Provenance
The following attestation bundles were made for name_conflict_resolver-0.0.1.tar.gz:
Publisher:
package.yml on actapia/name_conflict_resolver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
name_conflict_resolver-0.0.1.tar.gz -
Subject digest:
958c519970d376f900cc0be260879ec46823dc5807638df4e45e2ec164ef7fb8 - Sigstore transparency entry: 495812849
- Sigstore integration time:
-
Permalink:
actapia/name_conflict_resolver@449e6a79e5172ebca240fbcfcc7ddacaded7babc -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/actapia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@449e6a79e5172ebca240fbcfcc7ddacaded7babc -
Trigger Event:
release
-
Statement type:
File details
Details for the file name_conflict_resolver-0.0.1-py3-none-any.whl.
File metadata
- Download URL: name_conflict_resolver-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8c223adf7c5d849206d25ca1ba5f66e4bed5d54a73ede105fe2cf16398bbb8a
|
|
| MD5 |
86cb532697814c2dc1a211fa706fb182
|
|
| BLAKE2b-256 |
db4e1b0e8bd1255cdb602803bef7dfa26166a2e2844582e892bd7a8d77f474f5
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
name_conflict_resolver-0.0.1-py3-none-any.whl -
Subject digest:
c8c223adf7c5d849206d25ca1ba5f66e4bed5d54a73ede105fe2cf16398bbb8a - Sigstore transparency entry: 495812872
- Sigstore integration time:
-
Permalink:
actapia/name_conflict_resolver@449e6a79e5172ebca240fbcfcc7ddacaded7babc -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/actapia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
package.yml@449e6a79e5172ebca240fbcfcc7ddacaded7babc -
Trigger Event:
release
-
Statement type: