Removes segments. Positive values shave the first segments, negative shave the last segments.
(path, n_shave_prefix_segments=1)
| 537 | |
| 538 | |
| 539 | def shave_segments(path, n_shave_prefix_segments=1): |
| 540 | """ |
| 541 | Removes segments. Positive values shave the first segments, negative shave the last segments. |
| 542 | """ |
| 543 | if n_shave_prefix_segments >= 0: |
| 544 | return ".".join(path.split(".")[n_shave_prefix_segments:]) |
| 545 | else: |
| 546 | return ".".join(path.split(".")[:n_shave_prefix_segments]) |
| 547 | |
| 548 | |
| 549 | def renew_resnet_paths(old_list, n_shave_prefix_segments=0): |
no outgoing calls
no test coverage detected