hscommon.conflict¶
When you have to deal with names that have to be unique and can conflict together, you can use
this module that deals with conflicts by prepending unique numbers in [] brackets to the name.
-
hscommon.conflict.get_conflicted_name(other_names: List[str], name: str) → str¶ Returns name with a
[000]number in front of it.The number between brackets depends on how many conlicted filenames there already are in other_names.
-
hscommon.conflict.get_unconflicted_name(name: str) → str¶ Returns
namewithout[]brackets.Brackets which, of course, might have been added by func:get_conflicted_name.
-
hscommon.conflict.is_conflicted(name: str) → bool¶ Returns whether
nameis prepended with a bracketed number.
-
hscommon.conflict.smart_copy(source_path: pathlib.Path, dest_path: pathlib.Path) → None¶ Copies
source_pathtodest_path, recursively and with conflict resolution.
-
hscommon.conflict.smart_move(source_path: pathlib.Path, dest_path: pathlib.Path) → None¶ Same as
smart_copy(), but it moves files instead.