Strip a trailing .py or .pyi suffix. Return None if no such suffix is found.
(arg: str)
| 247 | |
| 248 | |
| 249 | def strip_py(arg: str) -> str | None: |
| 250 | """Strip a trailing .py or .pyi suffix. |
| 251 | |
| 252 | Return None if no such suffix is found. |
| 253 | """ |
| 254 | for ext in PY_EXTENSIONS: |
| 255 | if arg.endswith(ext): |
| 256 | return arg[: -len(ext)] |
| 257 | return None |