The reason you are getting this is because of PyCharm's static analysis. Now, what Python does is use static skeletons (some are pre-generated and some are generated) to give you the analysis. Take a look at the pre-generated skeletons here -> https://github.com/JetBrains/python-skeletons
This might be solved, by enabling the following:
However, if that does not work:
which will block off the error, it will appear as a comment above the line.