Check if the include uses a banned internal subpath. Returns the corrected path if banned, None otherwise.
(include_path: str)
| 246 | |
| 247 | |
| 248 | def get_banned_subpath_replacement(include_path: str) -> str | None: |
| 249 | """Check if the include uses a banned internal subpath. |
| 250 | |
| 251 | Returns the corrected path if banned, None otherwise. |
| 252 | """ |
| 253 | for banned_prefix, replacement_prefix in BANNED_INTERNAL_SUBPATHS.items(): |
| 254 | if include_path.startswith(banned_prefix): |
| 255 | return replacement_prefix + include_path[len(banned_prefix) :] |
| 256 | return None |
| 257 | |
| 258 | |
| 259 | def is_valid_include_path(include_path: str) -> bool: |
no test coverage detected