mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Fix name arrows
I seem to have (re-)implemented them incorrectly and never tested them.
This commit is contained in:
parent
70ec64a48b
commit
57aef26217
@ -142,17 +142,22 @@ class RenamingPartsTf(Transformation):
|
|||||||
|
|
||||||
def transform(self, path: PurePath) -> TransformResult:
|
def transform(self, path: PurePath) -> TransformResult:
|
||||||
result = PurePath()
|
result = PurePath()
|
||||||
|
any_part_matched = False
|
||||||
for part in path.parts:
|
for part in path.parts:
|
||||||
transformed = self.sub_tf.transform(PurePath(part))
|
transformed = self.sub_tf.transform(PurePath(part))
|
||||||
if not transformed:
|
if not transformed:
|
||||||
result /= part
|
result /= part
|
||||||
elif isinstance(transformed, Transformed):
|
elif isinstance(transformed, Transformed):
|
||||||
result /= transformed.path
|
result /= transformed.path
|
||||||
|
any_part_matched = True
|
||||||
elif isinstance(transformed, Ignored):
|
elif isinstance(transformed, Ignored):
|
||||||
return transformed
|
return transformed
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(f"Invalid transform result of type {type(transformed)}: {transformed}")
|
raise RuntimeError(f"Invalid transform result of type {type(transformed)}: {transformed}")
|
||||||
|
|
||||||
|
if any_part_matched:
|
||||||
|
return Transformed(result)
|
||||||
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user