Removes segments. Positive values shave the first segments, negative shave the last segments.
(path, n_shave_prefix_segments=1)
| 94 | |
| 95 | |
| 96 | def shave_segments(path, n_shave_prefix_segments=1): |
| 97 | """ |
| 98 | Removes segments. Positive values shave the first segments, negative shave the last segments. |
| 99 | """ |
| 100 | if n_shave_prefix_segments >= 0: |
| 101 | return ".".join(path.split(".")[n_shave_prefix_segments:]) |
| 102 | else: |
| 103 | return ".".join(path.split(".")[:n_shave_prefix_segments]) |
| 104 | |
| 105 | |
| 106 | def renew_temp_conv_paths(old_list, n_shave_prefix_segments=0): |
no outgoing calls
no test coverage detected