Wrong Python version in PyCharm's inspections
Go to Settings->Editor->Inspections. There in Python->Code compatibility inspections, you should see that Python 3.5's box is ticked in.
This allows you to choose for which versions of Python your code will be inspected.
I totally agree with @Eskapp's answer, but here are a few additions that I had to do.
- Press Ctrl + Alt + S OR Command + Option + S To open the Settings
- Settings > Editor > Inspections > Python | Code compatibility inspection > Select the version(s) (In my case 3.7 and 3.8 and disselcting 2.7)
- Settings > Project: | Project Interpreter > Make sure correct version and interpreter is selected.
- File > Invalidate Caches / Restart...
- Done.