Removes segments. Positive values shave the first segments, negative shave the last segments.
(path, n_shave_prefix_segments=1)
| 195 | |
| 196 | |
| 197 | def shave_segments(path, n_shave_prefix_segments=1): |
| 198 | """ |
| 199 | Removes segments. Positive values shave the first segments, negative shave the last segments. |
| 200 | """ |
| 201 | if n_shave_prefix_segments >= 0: |
| 202 | return ".".join(path.split(".")[n_shave_prefix_segments:]) |
| 203 | else: |
| 204 | return ".".join(path.split(".")[:n_shave_prefix_segments]) |
| 205 | |
| 206 | |
| 207 | def renew_resnet_paths(old_list, n_shave_prefix_segments=0): |
no outgoing calls
no test coverage detected