Removes segments. Positive values shave the first segments, negative shave the last segments.
(path, n_shave_prefix_segments=1)
| 211 | |
| 212 | |
| 213 | def shave_segments(path, n_shave_prefix_segments=1): |
| 214 | """ |
| 215 | Removes segments. Positive values shave the first segments, negative shave the last segments. |
| 216 | """ |
| 217 | if n_shave_prefix_segments >= 0: |
| 218 | return ".".join(path.split(".")[n_shave_prefix_segments:]) |
| 219 | else: |
| 220 | return ".".join(path.split(".")[:n_shave_prefix_segments]) |
| 221 | |
| 222 | |
| 223 | def renew_resnet_paths(old_list, n_shave_prefix_segments=0): |
no outgoing calls
no test coverage detected