If you are annoyed by PyCharm's complain about np.open
expecting str
but not pathlib.Path
, use this script.
- Make sure you have activated the correct Python environment.
- Make sure you have write access to the package's directory.
- Run the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Lodour/fix-pycharm-numpy-typehints/main/fix.sh)"
This issue was initially reported in PY-48807.
Essentially PyCharm cannot parse NumPy's docstring about "str or pathlib.Path instance" vs. "str, pathlib.Path".
This script uses sed
to remove "or" and "instance" from the docstring in NumPy's source files.